From f0562f780f82e0d6dc8d9f80a3f3cec863cd306f Mon Sep 17 00:00:00 2001 From: adeatcu-ionos Date: Fri, 7 Feb 2025 07:09:36 +0200 Subject: [PATCH] refactor: Use bundle instead of SDK for Cloud API --- docs/resources/server.md | 1 + go.mod | 4 +- go.sum | 2 - internal/framework/provider/provider.go | 11 +- ionoscloud/config.go | 7 +- .../data_source_application_loadbalancer.go | 11 +- ...application_loadbalancer_forwardingrule.go | 11 +- ionoscloud/data_source_backup_unit.go | 15 +- ionoscloud/data_source_cube_server.go | 117 +- ionoscloud/data_source_datacenter.go | 23 +- ionoscloud/data_source_firewall.go | 9 +- ionoscloud/data_source_group.go | 9 +- ionoscloud/data_source_image.go | 197 +- ionoscloud/data_source_ipblock.go | 23 +- ionoscloud/data_source_ipfailover.go | 6 +- ionoscloud/data_source_k8s_cluster.go | 19 +- ionoscloud/data_source_k8s_clusters.go | 33 +- ionoscloud/data_source_k8s_node_pool.go | 13 +- ionoscloud/data_source_k8s_node_pool_nodes.go | 18 +- ionoscloud/data_source_lan.go | 9 +- ionoscloud/data_source_location.go | 64 +- ionoscloud/data_source_natgateway.go | 9 +- ionoscloud/data_source_natgateway_rule.go | 9 +- ionoscloud/data_source_networkloadbalancer.go | 9 +- ...urce_networkloadbalancer_forwardingrule.go | 9 +- ionoscloud/data_source_nic.go | 6 +- ionoscloud/data_source_nic_test.go | 21 +- ionoscloud/data_source_nsg.go | 36 +- .../data_source_private_crossconnect.go | 59 +- ionoscloud/data_source_resource.go | 6 +- ionoscloud/data_source_server.go | 195 +- ionoscloud/data_source_servers.go | 81 +- ionoscloud/data_source_share.go | 3 - ionoscloud/data_source_snapshot.go | 11 +- ionoscloud/data_source_target_group.go | 11 +- ionoscloud/data_source_template.go | 49 +- ionoscloud/data_source_user.go | 17 +- ionoscloud/data_source_volume.go | 9 +- ...rt_certificate_manager_certificate_test.go | 2 +- ...mport_certificate_manager_provider_test.go | 2 +- ionoscloud/labels_service.go | 10 +- ionoscloud/provider.go | 21 +- ionoscloud/provider_test.go | 11 +- .../resource_application_loadbalancer.go | 98 +- ...application_loadbalancer_forwardingrule.go | 208 +- ...cation_loadbalancer_forwardingrule_test.go | 2 +- .../resource_application_loadbalancer_test.go | 2 +- ionoscloud/resource_backup_unit.go | 73 +- ionoscloud/resource_backup_unit_test.go | 2 +- ionoscloud/resource_cube_server.go | 261 ++- ionoscloud/resource_cube_server_test.go | 2 +- ionoscloud/resource_datacenter.go | 121 +- .../resource_datacenter_nsg_selection.go | 2 +- ionoscloud/resource_datacenter_test.go | 2 +- ionoscloud/resource_firewall.go | 129 +- ionoscloud/resource_firewall_test.go | 2 +- ionoscloud/resource_group.go | 220 +-- ionoscloud/resource_group_test.go | 2 +- ionoscloud/resource_ipblock.go | 30 +- ionoscloud/resource_ipblock_test.go | 2 +- ionoscloud/resource_ipfailover.go | 32 +- ionoscloud/resource_ipfailover_test.go | 4 +- ionoscloud/resource_k8s_cluster.go | 165 +- ionoscloud/resource_k8s_cluster_test.go | 2 +- ionoscloud/resource_k8s_node_pool.go | 259 ++- ionoscloud/resource_k8s_node_pool_test.go | 2 +- ionoscloud/resource_lan.go | 62 +- ionoscloud/resource_lan_test.go | 2 +- ionoscloud/resource_loadbalancer.go | 22 +- ionoscloud/resource_loadbalancer_test.go | 2 +- ionoscloud/resource_natgateway.go | 84 +- ionoscloud/resource_natgateway_rule.go | 100 +- ionoscloud/resource_natgateway_rule_test.go | 2 +- ionoscloud/resource_natgateway_test.go | 2 +- ionoscloud/resource_networkloadbalancer.go | 127 +- ...urce_networkloadbalancer_forwardingrule.go | 195 +- ...networkloadbalancer_forwardingrule_test.go | 2 +- .../resource_networkloadbalancer_test.go | 2 +- ionoscloud/resource_nic.go | 7 +- ionoscloud/resource_nic_test.go | 2 +- ionoscloud/resource_nsg.go | 34 +- ionoscloud/resource_nsg_firewallrule.go | 2 +- ionoscloud/resource_nsg_test.go | 2 +- ionoscloud/resource_private_crossconnect.go | 20 +- .../resource_private_crossconnect_test.go | 6 +- ionoscloud/resource_s3_key.go | 11 +- ionoscloud/resource_s3_key_test.go | 2 +- ionoscloud/resource_server.go | 329 ++-- .../resource_server_boot_device_selection.go | 6 +- ionoscloud/resource_server_test.go | 6 +- ionoscloud/resource_share.go | 6 +- ionoscloud/resource_share_test.go | 2 +- ionoscloud/resource_snapshot.go | 157 +- ionoscloud/resource_snapshot_test.go | 2 +- ionoscloud/resource_target_group.go | 211 +- ionoscloud/resource_target_group_test.go | 2 +- ionoscloud/resource_user.go | 86 +- ionoscloud/resource_user_test.go | 2 +- ionoscloud/resource_vcpu_server_test.go | 6 +- ionoscloud/resource_volume.go | 50 +- ionoscloud/resource_volume_test.go | 2 +- ionoscloud/testUtil.go | 9 +- ionoscloud/utils.go | 9 +- main.go | 4 +- services/clients.go | 2 +- .../cloudapi/cloudapifirewall/firewall.go | 79 +- services/cloudapi/cloudapilan/lan.go | 5 +- services/cloudapi/cloudapinic/nic.go | 177 +- services/cloudapi/cloudapiserver/server.go | 28 +- services/cloudapi/flowlog/flowlog.go | 23 +- services/cloudapi/nsg/nsg.go | 2 +- services/cloudapi/state.go | 4 +- utils/utils.go | 53 +- .../products/cloud/v2}/.gitignore | 1 - .../products/cloud/v2}/.travis.yml | 0 .../products/cloud/v2}/README.md | 233 +-- .../products/cloud/v2}/api_.go | 53 +- .../v2}/api_application_load_balancers.go | 1014 ++++------ .../products/cloud/v2/api_backup_service.go} | 409 ++-- .../cloud/v2}/api_contract_resources.go | 55 +- .../products/cloud/v2/api_cross_connects.go} | 306 ++- .../products/cloud/v2}/api_data_centers.go | 328 ++-- .../products/cloud/v2}/api_firewall_rules.go | 364 ++-- .../products/cloud/v2}/api_flow_logs.go | 352 ++-- .../products/cloud/v2}/api_images.go | 264 +-- .../products/cloud/v2}/api_ip_blocks.go | 328 ++-- .../products/cloud/v2}/api_kubernetes.go | 875 ++++----- .../products/cloud/v2}/api_labels.go | 1743 +++++++---------- .../products/cloud/v2}/api_lans.go | 526 ++--- .../products/cloud/v2}/api_load_balancers.go | 561 +++--- .../products/cloud/v2}/api_locations.go | 165 +- .../products/cloud/v2}/api_nat_gateways.go | 1002 ++++------ .../cloud/v2}/api_network_interfaces.go | 352 ++-- .../cloud/v2}/api_network_load_balancers.go | 1014 ++++------ .../products/cloud/v2}/api_requests.go | 201 +- .../products/cloud/v2}/api_security_groups.go | 742 +++---- .../products/cloud/v2}/api_servers.go | 1210 +++++------- .../products/cloud/v2}/api_snapshots.go | 262 +-- .../products/cloud/v2}/api_target_groups.go | 328 ++-- .../products/cloud/v2}/api_templates.go | 91 +- .../products/cloud/v2}/api_user_management.go | 1293 +++++------- .../products/cloud/v2}/api_user_s3_keys.go | 319 ++- .../products/cloud/v2}/api_volumes.go | 443 ++--- .../products/cloud/v2}/client.go | 554 +++--- .../v2}/model_application_load_balancer.go | 237 +-- ...odel_application_load_balancer_entities.go | 50 +- ...plication_load_balancer_forwarding_rule.go | 194 +- ...oad_balancer_forwarding_rule_properties.go | 258 +-- ...ation_load_balancer_forwarding_rule_put.go | 155 +- ...lication_load_balancer_forwarding_rules.go | 274 ++- ...del_application_load_balancer_http_rule.go | 338 ++-- ...ation_load_balancer_http_rule_condition.go | 188 +- ...el_application_load_balancer_properties.go | 262 +-- .../model_application_load_balancer_put.go | 155 +- .../v2}/model_application_load_balancers.go | 274 ++- .../cloud/v2}/model_attached_volumes.go | 274 ++- .../products/cloud/v2}/model_backup_unit.go | 190 +- .../cloud/v2}/model_backup_unit_properties.go | 118 +- .../cloud/v2}/model_backup_unit_sso.go | 50 +- .../products/cloud/v2}/model_backup_units.go | 163 +- .../products/cloud/v2}/model_balanced_nics.go | 274 ++- .../products/cloud/v2}/model_cdroms.go | 274 ++- .../cloud/v2}/model_connectable_datacenter.go | 124 +- .../products/cloud/v2}/model_contract.go | 81 +- .../cloud/v2}/model_contract_properties.go | 198 +- .../products/cloud/v2}/model_contracts.go | 163 +- .../v2}/model_cpu_architecture_properties.go | 161 +- .../cloud/v2}/model_create_snapshot.go | 50 +- .../v2}/model_create_snapshot_properties.go | 161 +- .../products/cloud/v2}/model_datacenter.go | 235 +-- .../v2}/model_datacenter_element_metadata.go | 324 ++- .../cloud/v2/model_datacenter_entities.go | 341 ++++ .../cloud/v2}/model_datacenter_post.go | 85 +- .../cloud/v2}/model_datacenter_properties.go | 364 ++-- .../v2}/model_datacenter_properties_post.go | 347 ++-- .../v2}/model_datacenter_properties_put.go | 384 ++-- .../cloud/v2}/model_datacenter_put.go | 85 +- .../products/cloud/v2}/model_datacenters.go | 274 ++- .../products/cloud/v2}/model_error.go | 91 +- .../products/cloud/v2}/model_error_message.go | 87 +- .../products/cloud/v2}/model_firewall_rule.go | 190 +- .../cloud/v2}/model_firewall_rules.go | 274 ++- .../v2}/model_firewallrule_properties.go | 529 +++-- .../products/cloud/v2}/model_flow_log.go | 190 +- .../cloud/v2}/model_flow_log_properties.go | 141 +- .../products/cloud/v2}/model_flow_log_put.go | 155 +- .../products/cloud/v2}/model_flow_logs.go | 274 ++- .../products/cloud/v2}/model_group.go | 198 +- .../cloud/v2}/model_group_entities.go | 87 +- .../products/cloud/v2}/model_group_members.go | 163 +- .../cloud/v2}/model_group_properties.go | 987 ++++------ .../products/cloud/v2}/model_group_share.go | 155 +- .../cloud/v2}/model_group_share_properties.go | 87 +- .../products/cloud/v2}/model_group_shares.go | 163 +- .../products/cloud/v2}/model_group_users.go | 163 +- .../products/cloud/v2}/model_groups.go | 163 +- .../products/cloud/v2}/model_image.go | 190 +- .../cloud/v2}/model_image_properties.go | 751 +++---- .../products/cloud/v2}/model_images.go | 163 +- .../products/cloud/v2}/model_info.go | 124 +- .../products/cloud/v2}/model_ip_block.go | 190 +- .../cloud/v2}/model_ip_block_properties.go | 194 +- .../products/cloud/v2}/model_ip_blocks.go | 274 ++- .../products/cloud/v2}/model_ip_consumer.go | 346 ++-- .../products/cloud/v2}/model_ip_failover.go | 87 +- .../v2}/model_kubernetes_auto_scaling.go | 75 +- .../cloud/v2}/model_kubernetes_cluster.go | 237 +-- .../v2}/model_kubernetes_cluster_entities.go | 50 +- .../v2}/model_kubernetes_cluster_for_post.go | 237 +-- .../v2}/model_kubernetes_cluster_for_put.go | 237 +-- .../model_kubernetes_cluster_properties.go | 426 ++-- ..._kubernetes_cluster_properties_for_post.go | 348 ++-- ...l_kubernetes_cluster_properties_for_put.go | 196 +- .../cloud/v2}/model_kubernetes_clusters.go | 163 +- .../model_kubernetes_maintenance_window.go | 75 +- .../cloud/v2}/model_kubernetes_node.go | 194 +- .../v2}/model_kubernetes_node_metadata.go | 220 +-- .../cloud/v2}/model_kubernetes_node_pool.go | 194 +- .../model_kubernetes_node_pool_for_post.go | 194 +- .../v2}/model_kubernetes_node_pool_for_put.go | 194 +- .../v2}/model_kubernetes_node_pool_lan.go | 159 +- .../model_kubernetes_node_pool_lan_routes.go | 87 +- .../model_kubernetes_node_pool_properties.go | 610 ++---- ...ubernetes_node_pool_properties_for_post.go | 571 ++---- ...kubernetes_node_pool_properties_for_put.go | 346 ++-- .../cloud/v2}/model_kubernetes_node_pools.go | 163 +- .../v2}/model_kubernetes_node_properties.go | 149 +- .../cloud/v2}/model_kubernetes_nodes.go | 163 +- .../products/cloud/v2}/model_label.go | 190 +- .../cloud/v2}/model_label_properties.go | 198 +- .../cloud/v2}/model_label_resource.go | 194 +- .../v2}/model_label_resource_properties.go | 87 +- .../cloud/v2}/model_label_resources.go | 274 ++- .../products/cloud/v2}/model_labels.go | 163 +- .../products/cloud/v2}/model_lan.go | 231 +-- .../products/cloud/v2}/model_lan_entities.go | 50 +- .../products/cloud/v2}/model_lan_nics.go | 274 ++- .../cloud/v2}/model_lan_properties.go | 305 +-- .../products/cloud/v2}/model_lans.go | 274 ++- .../products/cloud/v2}/model_list_of_ids.go | 42 +- .../products/cloud/v2}/model_loadbalancer.go | 231 +-- .../cloud/v2}/model_loadbalancer_entities.go | 50 +- .../v2}/model_loadbalancer_properties.go | 142 +- .../products/cloud/v2}/model_loadbalancers.go | 274 ++- .../products/cloud/v2}/model_location.go | 190 +- .../cloud/v2}/model_location_properties.go | 167 +- .../products/cloud/v2}/model_locations.go | 163 +- .../products/cloud/v2}/model_nat_gateway.go | 231 +-- .../cloud/v2}/model_nat_gateway_entities.go | 87 +- .../v2}/model_nat_gateway_lan_properties.go | 83 +- .../cloud/v2}/model_nat_gateway_properties.go | 116 +- .../cloud/v2}/model_nat_gateway_put.go | 155 +- .../cloud/v2}/model_nat_gateway_rule.go | 190 +- .../v2}/model_nat_gateway_rule_properties.go | 258 +-- .../v2}/model_nat_gateway_rule_protocol.go | 1 + .../cloud/v2}/model_nat_gateway_rule_put.go | 155 +- .../cloud/v2}/model_nat_gateway_rule_type.go | 1 + .../cloud/v2}/model_nat_gateway_rules.go | 163 +- .../products/cloud/v2}/model_nat_gateways.go | 274 ++- .../cloud/v2}/model_network_load_balancer.go | 237 +-- .../model_network_load_balancer_entities.go | 87 +- ...l_network_load_balancer_forwarding_rule.go | 194 +- ...d_balancer_forwarding_rule_health_check.go | 161 +- ...oad_balancer_forwarding_rule_properties.go | 244 +-- ...twork_load_balancer_forwarding_rule_put.go | 155 +- ...rk_load_balancer_forwarding_rule_target.go | 184 +- ...cer_forwarding_rule_target_health_check.go | 124 +- ..._network_load_balancer_forwarding_rules.go | 274 ++- .../model_network_load_balancer_properties.go | 262 +-- .../v2}/model_network_load_balancer_put.go | 155 +- .../cloud/v2}/model_network_load_balancers.go | 274 ++- .../products/cloud/v2}/model_nic.go | 231 +-- .../products/cloud/v2}/model_nic_entities.go | 124 +- .../cloud/v2}/model_nic_properties.go | 526 +++-- .../products/cloud/v2}/model_nic_put.go | 155 +- .../products/cloud/v2}/model_nics.go | 274 ++- .../cloud/v2}/model_no_state_meta_data.go | 287 ++- .../cloud/v2}/model_pagination_links.go | 124 +- .../products/cloud/v2}/model_peer.go | 198 +- .../cloud/v2}/model_private_cross_connect.go | 194 +- .../model_private_cross_connect_properties.go | 165 +- .../cloud/v2}/model_private_cross_connects.go | 163 +- .../cloud/v2}/model_remote_console_url.go | 50 +- .../products/cloud/v2}/model_request.go | 194 +- .../cloud/v2}/model_request_metadata.go | 171 +- .../cloud/v2}/model_request_properties.go | 161 +- .../cloud/v2}/model_request_status.go | 161 +- .../v2}/model_request_status_metadata.go | 165 +- .../cloud/v2}/model_request_target.go | 87 +- .../products/cloud/v2}/model_requests.go | 258 +-- .../products/cloud/v2}/model_resource.go | 235 +-- .../cloud/v2}/model_resource_entities.go | 50 +- .../cloud/v2}/model_resource_groups.go | 163 +- .../cloud/v2/model_resource_limits.go | 790 ++++++++ .../cloud/v2}/model_resource_properties.go | 87 +- .../cloud/v2}/model_resource_reference.go | 118 +- .../products/cloud/v2}/model_resources.go | 163 +- .../cloud/v2}/model_resources_users.go | 163 +- .../cloud/v2}/model_restore_snapshot.go | 50 +- .../v2}/model_restore_snapshot_properties.go | 50 +- .../products/cloud/v2}/model_s3_bucket.go | 42 +- .../products/cloud/v2}/model_s3_key.go | 194 +- .../cloud/v2}/model_s3_key_metadata.go | 287 ++- .../cloud/v2}/model_s3_key_properties.go | 87 +- .../products/cloud/v2}/model_s3_keys.go | 163 +- .../cloud/v2}/model_s3_object_storage_sso.go | 50 +- .../cloud/v2}/model_security_group.go | 231 +-- .../v2}/model_security_group_entities.go | 124 +- .../model_security_group_entities_request.go | 50 +- .../v2}/model_security_group_properties.go | 81 +- .../cloud/v2}/model_security_group_request.go | 81 +- .../cloud/v2}/model_security_groups.go | 274 ++- .../products/cloud/v2}/model_server.go | 231 +-- .../cloud/v2}/model_server_entities.go | 161 +- .../cloud/v2}/model_server_properties.go | 493 +++-- .../products/cloud/v2}/model_servers.go | 274 ++- .../products/cloud/v2}/model_snapshot.go | 190 +- .../cloud/v2}/model_snapshot_properties.go | 642 +++--- .../products/cloud/v2}/model_snapshots.go | 163 +- .../products/cloud/v2}/model_target_group.go | 190 +- .../v2}/model_target_group_health_check.go | 124 +- .../model_target_group_http_health_check.go | 227 +-- .../v2}/model_target_group_properties.go | 260 +-- .../cloud/v2}/model_target_group_put.go | 155 +- .../cloud/v2}/model_target_group_target.go | 221 +-- .../products/cloud/v2}/model_target_groups.go | 274 ++- .../cloud/v2}/model_target_port_range.go | 87 +- .../products/cloud/v2}/model_template.go | 190 +- .../cloud/v2}/model_template_properties.go | 174 +- .../products/cloud/v2}/model_templates.go | 163 +- .../products/cloud/v2}/model_token.go | 50 +- .../products/cloud/v2}/model_type.go | 1 + .../products/cloud/v2}/model_user.go | 237 +-- .../cloud/v2}/model_user_group_post.go | 42 +- .../products/cloud/v2}/model_user_metadata.go | 331 ++-- .../products/cloud/v2}/model_user_post.go | 42 +- .../cloud/v2}/model_user_properties.go | 309 ++- .../cloud/v2}/model_user_properties_post.go | 309 ++- .../cloud/v2}/model_user_properties_put.go | 309 ++- .../products/cloud/v2}/model_user_put.go | 81 +- .../products/cloud/v2}/model_users.go | 274 ++- .../cloud/v2}/model_users_entities.go | 87 +- .../products/cloud/v2}/model_volume.go | 190 +- .../cloud/v2}/model_volume_properties.go | 884 ++++----- .../products/cloud/v2}/model_volumes.go | 274 ++- .../sdk-go-bundle/products/cloud/v2/utils.go | 358 ++++ .../ionos-cloud/sdk-go/v6/.gitbook.yaml | 4 - .../github.com/ionos-cloud/sdk-go/v6/LICENSE | 190 -- .../ionos-cloud/sdk-go/v6/configuration.go | 315 --- .../ionos-cloud/sdk-go/v6/git_push.sh | 55 - .../ionos-cloud/sdk-go/v6/logger.go | 80 - .../sdk-go/v6/model_data_center_entities.go | 379 ---- .../sdk-go/v6/model_resource_limits.go | 1204 ------------ .../ionos-cloud/sdk-go/v6/response.go | 73 - .../sdk-go/v6/sonar-project.properties | 12 - .../github.com/ionos-cloud/sdk-go/v6/utils.go | 790 -------- vendor/modules.txt | 7 +- 357 files changed, 27040 insertions(+), 37808 deletions(-) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/.gitignore (97%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/.travis.yml (100%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/README.md (86%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/api_.go (80%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/api_application_load_balancers.go (80%) rename vendor/github.com/ionos-cloud/{sdk-go/v6/api_backup_units.go => sdk-go-bundle/products/cloud/v2/api_backup_service.go} (73%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/api_contract_resources.go (81%) rename vendor/github.com/ionos-cloud/{sdk-go/v6/api_private_cross_connects.go => sdk-go-bundle/products/cloud/v2/api_cross_connects.go} (70%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/api_data_centers.go (76%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/api_firewall_rules.go (78%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/api_flow_logs.go (78%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/api_images.go (76%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/api_ip_blocks.go (76%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/api_kubernetes.go (78%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/api_labels.go (77%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/api_lans.go (76%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/api_load_balancers.go (78%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/api_locations.go (78%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/api_nat_gateways.go (78%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/api_network_interfaces.go (77%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/api_network_load_balancers.go (79%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/api_requests.go (76%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/api_security_groups.go (79%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/api_servers.go (77%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/api_snapshots.go (77%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/api_target_groups.go (76%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/api_templates.go (81%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/api_user_management.go (77%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/api_user_s3_keys.go (78%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/api_volumes.go (77%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/client.go (81%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_application_load_balancer.go (62%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_application_load_balancer_entities.go (78%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_application_load_balancer_forwarding_rule.go (67%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_application_load_balancer_forwarding_rule_properties.go (69%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_application_load_balancer_forwarding_rule_put.go (71%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_application_load_balancer_forwarding_rules.go (62%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_application_load_balancer_http_rule.go (66%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_application_load_balancer_http_rule_condition.go (72%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_application_load_balancer_properties.go (66%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_application_load_balancer_put.go (69%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_application_load_balancers.go (61%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_attached_volumes.go (61%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_backup_unit.go (65%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_backup_unit_properties.go (73%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_backup_unit_sso.go (78%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_backup_units.go (64%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_balanced_nics.go (60%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_cdroms.go (59%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_connectable_datacenter.go (70%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_contract.go (74%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_contract_properties.go (65%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_contracts.go (64%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_cpu_architecture_properties.go (68%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_create_snapshot.go (78%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_create_snapshot_properties.go (69%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_datacenter.go (61%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_datacenter_element_metadata.go (67%) create mode 100644 vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_datacenter_entities.go rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_datacenter_post.go (70%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_datacenter_properties.go (60%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_datacenter_properties_post.go (56%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_datacenter_properties_put.go (58%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_datacenter_put.go (70%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_datacenters.go (60%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_error.go (67%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_error_message.go (73%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_firewall_rule.go (65%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_firewall_rules.go (60%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_firewallrule_properties.go (55%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_flow_log.go (65%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_flow_log_properties.go (66%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_flow_log_put.go (67%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_flow_logs.go (60%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_group.go (63%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_group_entities.go (72%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_group_members.go (65%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_group_properties.go (59%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_group_share.go (67%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_group_share_properties.go (74%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_group_shares.go (64%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_group_users.go (65%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_groups.go (64%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_image.go (64%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_image_properties.go (60%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_images.go (64%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_info.go (67%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_ip_block.go (65%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_ip_block_properties.go (65%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_ip_blocks.go (60%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_ip_consumer.go (60%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_ip_failover.go (71%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_kubernetes_auto_scaling.go (75%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_kubernetes_cluster.go (61%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_kubernetes_cluster_entities.go (79%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_kubernetes_cluster_for_post.go (62%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_kubernetes_cluster_for_put.go (62%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_kubernetes_cluster_properties.go (65%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_kubernetes_cluster_properties_for_post.go (68%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_kubernetes_cluster_properties_for_put.go (72%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_kubernetes_clusters.go (65%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_kubernetes_maintenance_window.go (76%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_kubernetes_node.go (64%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_kubernetes_node_metadata.go (65%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_kubernetes_node_pool.go (64%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_kubernetes_node_pool_for_post.go (65%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_kubernetes_node_pool_for_put.go (65%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_kubernetes_node_pool_lan.go (68%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_kubernetes_node_pool_lan_routes.go (74%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_kubernetes_node_pool_properties.go (59%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_kubernetes_node_pool_properties_for_post.go (61%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_kubernetes_node_pool_properties_for_put.go (65%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_kubernetes_node_pools.go (65%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_kubernetes_node_properties.go (71%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_kubernetes_nodes.go (65%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_label.go (65%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_label_properties.go (66%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_label_resource.go (64%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_label_resource_properties.go (73%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_label_resources.go (60%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_labels.go (64%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_lan.go (62%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_lan_entities.go (78%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_lan_nics.go (60%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_lan_properties.go (56%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_lans.go (59%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_list_of_ids.go (83%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_loadbalancer.go (63%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_loadbalancer_entities.go (78%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_loadbalancer_properties.go (67%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_loadbalancers.go (60%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_location.go (65%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_location_properties.go (61%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_locations.go (64%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_nat_gateway.go (63%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_nat_gateway_entities.go (72%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_nat_gateway_lan_properties.go (76%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_nat_gateway_properties.go (70%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_nat_gateway_put.go (68%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_nat_gateway_rule.go (66%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_nat_gateway_rule_properties.go (66%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_nat_gateway_rule_protocol.go (99%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_nat_gateway_rule_put.go (68%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_nat_gateway_rule_type.go (99%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_nat_gateway_rules.go (65%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_nat_gateways.go (60%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_network_load_balancer.go (61%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_network_load_balancer_entities.go (72%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_network_load_balancer_forwarding_rule.go (66%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_network_load_balancer_forwarding_rule_health_check.go (74%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_network_load_balancer_forwarding_rule_properties.go (66%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_network_load_balancer_forwarding_rule_put.go (69%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_network_load_balancer_forwarding_rule_target.go (73%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_network_load_balancer_forwarding_rule_target_health_check.go (77%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_network_load_balancer_forwarding_rules.go (62%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_network_load_balancer_properties.go (64%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_network_load_balancer_put.go (68%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_network_load_balancers.go (61%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_nic.go (62%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_nic_entities.go (68%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_nic_properties.go (60%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_nic_put.go (67%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_nics.go (59%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_no_state_meta_data.go (64%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_pagination_links.go (70%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_peer.go (64%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_private_cross_connect.go (64%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_private_cross_connect_properties.go (68%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_private_cross_connects.go (65%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_remote_console_url.go (79%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_request.go (63%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_request_metadata.go (68%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_request_properties.go (66%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_request_status.go (66%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_request_status_metadata.go (64%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_request_target.go (71%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_requests.go (61%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_resource.go (62%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_resource_entities.go (77%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_resource_groups.go (65%) create mode 100644 vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_resource_limits.go rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_resource_properties.go (76%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_resource_reference.go (73%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_resources.go (64%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_resources_users.go (65%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_restore_snapshot.go (78%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_restore_snapshot_properties.go (80%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_s3_bucket.go (84%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_s3_key.go (63%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_s3_key_metadata.go (64%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_s3_key_properties.go (73%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_s3_keys.go (64%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_s3_object_storage_sso.go (78%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_security_group.go (63%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_security_group_entities.go (69%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_security_group_entities_request.go (79%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_security_group_properties.go (78%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_security_group_request.go (74%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_security_groups.go (60%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_server.go (62%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_server_entities.go (65%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_server_properties.go (56%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_servers.go (59%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_snapshot.go (65%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_snapshot_properties.go (62%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_snapshots.go (64%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_target_group.go (65%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_target_group_health_check.go (72%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_target_group_http_health_check.go (67%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_target_group_properties.go (65%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_target_group_put.go (68%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_target_group_target.go (70%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_target_groups.go (60%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_target_port_range.go (73%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_template.go (65%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_template_properties.go (63%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_templates.go (64%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_token.go (77%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_type.go (99%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_user.go (60%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_user_group_post.go (85%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_user_metadata.go (62%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_user_post.go (81%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_user_properties.go (63%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_user_properties_post.go (62%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_user_properties_put.go (62%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_user_put.go (74%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_users.go (59%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_users_entities.go (71%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_volume.go (65%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_volume_properties.go (61%) rename vendor/github.com/ionos-cloud/{sdk-go/v6 => sdk-go-bundle/products/cloud/v2}/model_volumes.go (59%) create mode 100644 vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/utils.go delete mode 100644 vendor/github.com/ionos-cloud/sdk-go/v6/.gitbook.yaml delete mode 100644 vendor/github.com/ionos-cloud/sdk-go/v6/LICENSE delete mode 100644 vendor/github.com/ionos-cloud/sdk-go/v6/configuration.go delete mode 100644 vendor/github.com/ionos-cloud/sdk-go/v6/git_push.sh delete mode 100644 vendor/github.com/ionos-cloud/sdk-go/v6/logger.go delete mode 100644 vendor/github.com/ionos-cloud/sdk-go/v6/model_data_center_entities.go delete mode 100644 vendor/github.com/ionos-cloud/sdk-go/v6/model_resource_limits.go delete mode 100644 vendor/github.com/ionos-cloud/sdk-go/v6/response.go delete mode 100644 vendor/github.com/ionos-cloud/sdk-go/v6/sonar-project.properties delete mode 100644 vendor/github.com/ionos-cloud/sdk-go/v6/utils.go diff --git a/docs/resources/server.md b/docs/resources/server.md index 856b627d9..fb07e1452 100644 --- a/docs/resources/server.md +++ b/docs/resources/server.md @@ -1,3 +1,4 @@ + --- subcategory: "Compute Engine" layout: "ionoscloud" diff --git a/go.mod b/go.mod index bccf957f4..b6f893a25 100644 --- a/go.mod +++ b/go.mod @@ -2,6 +2,8 @@ module github.com/ionos-cloud/terraform-provider-ionoscloud/v6 go 1.22.0 +replace github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2 => ./../sdks/generated_locally/cloud-bundle + require ( github.com/aws/aws-sdk-go v1.55.5 github.com/cenkalti/backoff/v4 v4.3.0 @@ -17,6 +19,7 @@ require ( github.com/iancoleman/strcase v0.3.0 github.com/ionos-cloud/sdk-go-api-gateway v1.0.0 github.com/ionos-cloud/sdk-go-bundle/products/cdn/v2 v2.1.0 + github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2 v2.0.0-00010101000000-000000000000 github.com/ionos-cloud/sdk-go-bundle/products/logging/v2 v2.1.1 github.com/ionos-cloud/sdk-go-bundle/products/monitoring/v2 v2.0.0 github.com/ionos-cloud/sdk-go-bundle/products/vpn/v2 v2.0.2 @@ -34,7 +37,6 @@ require ( github.com/ionos-cloud/sdk-go-object-storage v1.1.0 github.com/ionos-cloud/sdk-go-object-storage-management v1.0.0 github.com/ionos-cloud/sdk-go-vm-autoscaling v1.0.1 - github.com/ionos-cloud/sdk-go/v6 v6.3.2 github.com/mitchellh/go-homedir v1.1.0 golang.org/x/crypto v0.26.0 gopkg.in/yaml.v3 v3.0.1 diff --git a/go.sum b/go.sum index 808fbb186..ebab994a2 100644 --- a/go.sum +++ b/go.sum @@ -150,8 +150,6 @@ github.com/ionos-cloud/sdk-go-object-storage-management v1.0.0 h1:pHRKSNT+cCcr5g github.com/ionos-cloud/sdk-go-object-storage-management v1.0.0/go.mod h1:BnEapZcQp6FEirEin6pY9NICXD1mCrI4sJ+wOSKpyCY= github.com/ionos-cloud/sdk-go-vm-autoscaling v1.0.1 h1:KABL25MC7DrIHn9lQzKSPkwXhqvRkPYtFd+1HEogmAE= github.com/ionos-cloud/sdk-go-vm-autoscaling v1.0.1/go.mod h1:Q5d1R6silarsX5jWLPBHd/1PSC5zZNf2ONvXB+fygC0= -github.com/ionos-cloud/sdk-go/v6 v6.3.2 h1:2mUmrZZz6cPyT9IRX0T8fBLc/7XU/eTxP2Y5tS7/09k= -github.com/ionos-cloud/sdk-go/v6 v6.3.2/go.mod h1:SXrO9OGyWjd2rZhAhEpdYN6VUAODzzqRdqA9BCviQtI= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo= github.com/jhump/protoreflect v1.15.1 h1:HUMERORf3I3ZdX05WaQ6MIpd/NJ434hTp5YiKgfCL6c= diff --git a/internal/framework/provider/provider.go b/internal/framework/provider/provider.go index 24d726dd2..d11352b3e 100644 --- a/internal/framework/provider/provider.go +++ b/internal/framework/provider/provider.go @@ -17,7 +17,8 @@ import ( "github.com/hashicorp/terraform-plugin-framework/types" "github.com/hashicorp/terraform-plugin-sdk/v2/meta" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" + "github.com/ionos-cloud/sdk-go-bundle/shared" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/internal/framework/services/monitoring" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/internal/framework/services/objectstorage" @@ -241,18 +242,16 @@ func (p *IonosCloudProvider) Configure(ctx context.Context, req provider.Configu } func newCloudapiClient(username, password, token, endpoint, version, terraformVersion string, insecure bool) *ionoscloud.APIClient { - newConfig := ionoscloud.NewConfiguration(username, password, token, endpoint) + newConfig := shared.NewConfiguration(username, password, token, endpoint) newConfig.UserAgent = fmt.Sprintf( "terraform-provider/%s_ionos-cloud-sdk-go/%s_hashicorp-terraform/%s_terraform-plugin-sdk/%s_os/%s_arch/%s", version, ionoscloud.Version, terraformVersion, meta.SDKVersionString(), runtime.GOOS, runtime.GOARCH, //nolint:staticcheck ) - if os.Getenv(constant.IonosDebug) != "" { - newConfig.Debug = true - } newConfig.MaxRetries = constant.MaxRetries newConfig.WaitTime = constant.MaxWaitTime - newConfig.HTTPClient = &http.Client{Transport: utils.CreateTransport(insecure)} client := ionoscloud.NewAPIClient(newConfig) + client.GetConfig().HTTPClient = &http.Client{Transport: utils.CreateTransport(insecure)} + return client } diff --git a/ionoscloud/config.go b/ionoscloud/config.go index b99353319..487ed86b5 100644 --- a/ionoscloud/config.go +++ b/ionoscloud/config.go @@ -6,7 +6,8 @@ import ( "runtime" "github.com/hashicorp/terraform-plugin-sdk/v2/meta" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" + "github.com/ionos-cloud/sdk-go-bundle/shared" ) // Config represents @@ -22,9 +23,9 @@ type Config struct { func (c *Config) Client(terraformVersion string) (*ionoscloud.APIClient, error) { var client *ionoscloud.APIClient if c.Token != "" { - client = ionoscloud.NewAPIClient(ionoscloud.NewConfiguration("", "", c.Token, c.Endpoint)) + client = ionoscloud.NewAPIClient(shared.NewConfiguration("", "", c.Token, c.Endpoint)) } else { - client = ionoscloud.NewAPIClient(ionoscloud.NewConfiguration(c.Username, c.Password, "", c.Endpoint)) + client = ionoscloud.NewAPIClient(shared.NewConfiguration(c.Username, c.Password, "", c.Endpoint)) } client.GetConfig().UserAgent = fmt.Sprintf( diff --git a/ionoscloud/data_source_application_loadbalancer.go b/ionoscloud/data_source_application_loadbalancer.go index 4dcf7c40c..da701d556 100644 --- a/ionoscloud/data_source_application_loadbalancer.go +++ b/ionoscloud/data_source_application_loadbalancer.go @@ -7,12 +7,13 @@ import ( "log" "strings" + "github.com/ionos-cloud/sdk-go-bundle/shared" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" cloudapiflowlog "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/cloudapi/flowlog" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" ) func dataSourceApplicationLoadBalancer() *schema.Resource { @@ -110,7 +111,7 @@ func dataSourceApplicationLoadBalancerRead(ctx context.Context, d *schema.Resour var applicationLoadBalancer ionoscloud.ApplicationLoadBalancer var err error - var apiResponse *ionoscloud.APIResponse + var apiResponse *shared.APIResponse if idOk { /* search by ID */ @@ -136,7 +137,7 @@ func dataSourceApplicationLoadBalancerRead(ctx context.Context, d *schema.Resour return diag.FromErr(fmt.Errorf("an error occurred while fetching application load balancers: %w", err)) } - results = *applicationLoadBalancers.Items + results = applicationLoadBalancers.Items } else { applicationLoadBalancers, apiResponse, err := client.ApplicationLoadBalancersApi.DatacentersApplicationloadbalancersGet(ctx, datacenterId).Depth(1).Execute() logApiRequestTime(apiResponse) @@ -146,8 +147,8 @@ func dataSourceApplicationLoadBalancerRead(ctx context.Context, d *schema.Resour } if applicationLoadBalancers.Items != nil { - for _, alb := range *applicationLoadBalancers.Items { - if alb.Properties != nil && alb.Properties.Name != nil && strings.EqualFold(*alb.Properties.Name, name) { + for _, alb := range applicationLoadBalancers.Items { + if strings.EqualFold(alb.Properties.Name, name) { tmpAlb, apiResponse, err := client.ApplicationLoadBalancersApi.DatacentersApplicationloadbalancersFindByApplicationLoadBalancerId(ctx, datacenterId, *alb.Id).Execute() logApiRequestTime(apiResponse) if err != nil { diff --git a/ionoscloud/data_source_application_loadbalancer_forwardingrule.go b/ionoscloud/data_source_application_loadbalancer_forwardingrule.go index 775385f6e..1537863e0 100644 --- a/ionoscloud/data_source_application_loadbalancer_forwardingrule.go +++ b/ionoscloud/data_source_application_loadbalancer_forwardingrule.go @@ -7,12 +7,13 @@ import ( "log" "strings" + "github.com/ionos-cloud/sdk-go-bundle/shared" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" ) func dataSourceApplicationLoadBalancerForwardingRule() *schema.Resource { @@ -183,7 +184,7 @@ func dataSourceApplicationLoadBalancerForwardingRuleRead(ctx context.Context, d var applicationLoadBalancerForwardingRule ionoscloud.ApplicationLoadBalancerForwardingRule var err error - var apiResponse *ionoscloud.APIResponse + var apiResponse *shared.APIResponse if idOk { /* search by ID */ @@ -209,7 +210,7 @@ func dataSourceApplicationLoadBalancerForwardingRuleRead(ctx context.Context, d return diag.FromErr(fmt.Errorf("an error occurred while fetching application loadbalancer forwarding rules: %w", err)) } - results = *applicationLoadBalancersForwardingRules.Items + results = applicationLoadBalancersForwardingRules.Items } else { applicationLoadBalancersForwardingRules, apiResponse, err := client.ApplicationLoadBalancersApi.DatacentersApplicationloadbalancersForwardingrulesGet(ctx, datacenterId, albId).Depth(1).Execute() logApiRequestTime(apiResponse) @@ -219,8 +220,8 @@ func dataSourceApplicationLoadBalancerForwardingRuleRead(ctx context.Context, d } if applicationLoadBalancersForwardingRules.Items != nil { - for _, albFr := range *applicationLoadBalancersForwardingRules.Items { - if albFr.Properties != nil && albFr.Properties.Name != nil && strings.EqualFold(*albFr.Properties.Name, name) { + for _, albFr := range applicationLoadBalancersForwardingRules.Items { + if strings.EqualFold(albFr.Properties.Name, name) { tmpAlbFr, apiResponse, err := client.ApplicationLoadBalancersApi.DatacentersApplicationloadbalancersForwardingrulesFindByForwardingRuleId(ctx, datacenterId, albId, *albFr.Id).Execute() logApiRequestTime(apiResponse) if err != nil { diff --git a/ionoscloud/data_source_backup_unit.go b/ionoscloud/data_source_backup_unit.go index 20266db7b..24c80c604 100644 --- a/ionoscloud/data_source_backup_unit.go +++ b/ionoscloud/data_source_backup_unit.go @@ -5,11 +5,12 @@ import ( "fmt" "log" + "github.com/ionos-cloud/sdk-go-bundle/shared" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" ) func dataSourceBackupUnit() *schema.Resource { @@ -57,7 +58,7 @@ func dataSourceBackupUnitRead(ctx context.Context, d *schema.ResourceData, meta } var backupUnit ionoscloud.BackupUnit var err error - var apiResponse *ionoscloud.APIResponse + var apiResponse *shared.APIResponse if idOk { /* search by ID */ @@ -66,14 +67,12 @@ func dataSourceBackupUnitRead(ctx context.Context, d *schema.ResourceData, meta if err != nil { return diag.FromErr(fmt.Errorf("an error occurred while fetching the backup unit %s: %w", id.(string), err)) } - if backupUnit.Properties != nil { - log.Printf("[INFO] Got backupUnit [Name=%s] [Id=%s]", *backupUnit.Properties.Name, *backupUnit.Id) - } + log.Printf("[INFO] Got backupUnit [Name=%s] [Id=%s]", backupUnit.Properties.Name, *backupUnit.Id) } else { /* search by name */ var backupUnits ionoscloud.BackupUnits - backupUnits, apiResponse, err := client.BackupUnitsApi.BackupunitsGet(ctx).Depth(1).Execute() + backupUnits, apiResponse, err := client.BackupServiceApi.BackupunitsGet(ctx).Depth(1).Execute() logApiRequestTime(apiResponse) if err != nil { @@ -82,8 +81,8 @@ func dataSourceBackupUnitRead(ctx context.Context, d *schema.ResourceData, meta var results []ionoscloud.BackupUnit if backupUnits.Items != nil { - for _, bu := range *backupUnits.Items { - if bu.Properties != nil && bu.Properties.Name != nil && *bu.Properties.Name == name.(string) { + for _, bu := range backupUnits.Items { + if bu.Properties.Name == name.(string) { tmpBackupUnit, apiResponse, err := BackupUnitFindByID(ctx, *bu.Id, client) logApiRequestTime(apiResponse) if err != nil { diff --git a/ionoscloud/data_source_cube_server.go b/ionoscloud/data_source_cube_server.go index e3332d9ba..ca957c094 100644 --- a/ionoscloud/data_source_cube_server.go +++ b/ionoscloud/data_source_cube_server.go @@ -5,13 +5,14 @@ import ( "errors" "fmt" + "github.com/ionos-cloud/sdk-go-bundle/shared" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/cloudapi/nsg" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" mongo "github.com/ionos-cloud/sdk-go-dbaas-mongo" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/cloudapi/cloudapinic" @@ -202,67 +203,65 @@ func setCubeServerData(d *schema.ResourceData, server *ionoscloud.Server, token } } - if server.Properties != nil { - if server.Properties.TemplateUuid != nil { - if err := d.Set("template_uuid", *server.Properties.TemplateUuid); err != nil { - return err - } + if server.Properties.TemplateUuid != nil { + if err := d.Set("template_uuid", *server.Properties.TemplateUuid); err != nil { + return err } + } - if server.Properties.Name != nil { - if err := d.Set("name", *server.Properties.Name); err != nil { - return err - } + if server.Properties.Name != nil { + if err := d.Set("name", *server.Properties.Name); err != nil { + return err } - if server.Properties.Hostname != nil { - if err := d.Set("hostname", *server.Properties.Hostname); err != nil { - return err - } + } + if server.Properties.Hostname != nil { + if err := d.Set("hostname", *server.Properties.Hostname); err != nil { + return err } - if server.Properties.Cores != nil { - if err := d.Set("cores", *server.Properties.Cores); err != nil { - return err - } + } + if server.Properties.Cores != nil { + if err := d.Set("cores", *server.Properties.Cores); err != nil { + return err } - if server.Properties.Ram != nil { - if err := d.Set("ram", *server.Properties.Ram); err != nil { - return err - } + } + if server.Properties.Ram != nil { + if err := d.Set("ram", *server.Properties.Ram); err != nil { + return err } + } - if server.Properties.AvailabilityZone != nil { - if err := d.Set("availability_zone", *server.Properties.AvailabilityZone); err != nil { - return err - } + if server.Properties.AvailabilityZone != nil { + if err := d.Set("availability_zone", *server.Properties.AvailabilityZone); err != nil { + return err } + } - if server.Properties.VmState != nil { - if err := d.Set("vm_state", *server.Properties.VmState); err != nil { - return err - } + if server.Properties.VmState != nil { + if err := d.Set("vm_state", *server.Properties.VmState); err != nil { + return err } + } - if server.Properties.CpuFamily != nil { - if err := d.Set("cpu_family", *server.Properties.CpuFamily); err != nil { - return err - } + if server.Properties.CpuFamily != nil { + if err := d.Set("cpu_family", *server.Properties.CpuFamily); err != nil { + return err } - if server.Properties.BootCdrom != nil && server.Properties.BootCdrom.Id != nil { - if err := d.Set("boot_cdrom", *server.Properties.BootCdrom.Id); err != nil { - return err - } + } + if server.Properties.BootCdrom != nil { + if err := d.Set("boot_cdrom", server.Properties.BootCdrom.Id); err != nil { + return err } + } - if server.Properties.BootVolume != nil && server.Properties.BootVolume.Id != nil { - if err := d.Set("boot_volume", *server.Properties.BootVolume.Id); err != nil { - return err - } + if server.Properties.BootVolume != nil { + if err := d.Set("boot_volume", server.Properties.BootVolume.Id); err != nil { + return err } - if server.Entities != nil && server.Entities.Volumes != nil && server.Entities.Volumes.Items != nil && len(*server.Entities.Volumes.Items) > 0 && - (*server.Entities.Volumes.Items)[0].Properties.Image != nil { - if err := d.Set("boot_image", *(*server.Entities.Volumes.Items)[0].Properties.Image); err != nil { - return err - } + } + if server.Entities != nil && server.Entities.Volumes != nil && server.Entities.Volumes.Items != nil && len(server.Entities.Volumes.Items) > 0 && + (server.Entities.Volumes.Items)[0].Properties.Image != nil { + if err := d.Set("boot_image", *(server.Entities.Volumes.Items)[0].Properties.Image); err != nil { + return err } } @@ -270,16 +269,16 @@ func setCubeServerData(d *schema.ResourceData, server *ionoscloud.Server, token return nil } - if server.Entities.Cdroms != nil && server.Entities.Cdroms.Items != nil && len(*server.Entities.Cdroms.Items) > 0 { - cdroms := setServerCDRoms(server.Entities.Cdroms.Items) + if server.Entities.Cdroms != nil && server.Entities.Cdroms.Items != nil && len(server.Entities.Cdroms.Items) > 0 { + cdroms := setServerCDRoms(&server.Entities.Cdroms.Items) if err := d.Set("cdroms", cdroms); err != nil { return err } } var volumes []interface{} - if server.Entities.Volumes != nil && server.Entities.Volumes.Items != nil && len(*server.Entities.Volumes.Items) > 0 { - for _, volume := range *server.Entities.Volumes.Items { + if server.Entities.Volumes != nil && server.Entities.Volumes.Items != nil && len(server.Entities.Volumes.Items) > 0 { + for _, volume := range server.Entities.Volumes.Items { entry := make(map[string]interface{}) entry["id"] = mongo.ToValueDefault(volume.Id) @@ -289,9 +288,9 @@ func setCubeServerData(d *schema.ResourceData, server *ionoscloud.Server, token entry["image_name"] = mongo.ToValueDefault(volume.Properties.Image) entry["image_password"] = mongo.ToValueDefault(volume.Properties.ImagePassword) - if volume.Properties.SshKeys != nil && len(*volume.Properties.SshKeys) > 0 { + if volume.Properties.SshKeys != nil && len(volume.Properties.SshKeys) > 0 { var sshKeys []interface{} - for _, sshKey := range *volume.Properties.SshKeys { + for _, sshKey := range volume.Properties.SshKeys { sshKeys = append(sshKeys, sshKey) } entry["ssh_keys"] = sshKeys @@ -323,9 +322,9 @@ func setCubeServerData(d *schema.ResourceData, server *ionoscloud.Server, token if server.Entities != nil { if server.Entities.Nics != nil && server.Entities.Nics.Items != nil { nicItems := server.Entities.Nics.Items - if nicItems != nil && len(*nicItems) > 0 { + if len(nicItems) > 0 { var nics []interface{} - for _, nic := range *server.Entities.Nics.Items { + for _, nic := range server.Entities.Nics.Items { nicMap := cloudapinic.SetNetworkProperties(nic) fw := setFirewallRules(nic) nicMap["firewall_rules"] = fw @@ -338,7 +337,7 @@ func setCubeServerData(d *schema.ResourceData, server *ionoscloud.Server, token } if server.Entities != nil && server.Entities.Securitygroups != nil && server.Entities.Securitygroups.Items != nil { - if err := nsg.SetNSGInResourceData(d, server.Entities.Securitygroups.Items); err != nil { + if err := nsg.SetNSGInResourceData(d, &server.Entities.Securitygroups.Items); err != nil { return err } } @@ -379,7 +378,7 @@ func dataSourceCubeServerRead(ctx context.Context, d *schema.ResourceData, meta } var server ionoscloud.Server var err error - var apiResponse *ionoscloud.APIResponse + var apiResponse *shared.APIResponse if idOk { /* search by ID */ @@ -399,8 +398,8 @@ func dataSourceCubeServerRead(ctx context.Context, d *schema.ResourceData, meta var results []ionoscloud.Server if servers.Items != nil { - for _, s := range *servers.Items { - if s.Properties != nil && s.Properties.Name != nil && *s.Properties.Name == name.(string) { + for _, s := range servers.Items { + if s.Properties.Name != nil && *s.Properties.Name == name.(string) { /* server found */ server, apiResponse, err = client.ServersApi.DatacentersServersFindById(ctx, datacenterId.(string), *s.Id).Depth(4).Execute() logApiRequestTime(apiResponse) diff --git a/ionoscloud/data_source_datacenter.go b/ionoscloud/data_source_datacenter.go index 232ed7321..a1ca6c6aa 100644 --- a/ionoscloud/data_source_datacenter.go +++ b/ionoscloud/data_source_datacenter.go @@ -8,9 +8,10 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/ionos-cloud/sdk-go-bundle/shared" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" ) func dataSourceDataCenter() *schema.Resource { @@ -101,7 +102,7 @@ func dataSourceDataCenterRead(ctx context.Context, d *schema.ResourceData, meta var datacenter ionoscloud.Datacenter var err error - var apiResponse *ionoscloud.APIResponse + var apiResponse *shared.APIResponse if !idOk && !nameOk && !locationOk { return diag.FromErr(fmt.Errorf("either id, location or name must be set")) @@ -120,14 +121,12 @@ func dataSourceDataCenterRead(ctx context.Context, d *schema.ResourceData, meta } } if locationOk { - if *datacenter.Properties.Location != location { + if datacenter.Properties.Location != location { return diag.FromErr(fmt.Errorf("location of dc (UUID=%s, location=%s) does not match expected location: %s", - *datacenter.Id, *datacenter.Properties.Location, location)) + *datacenter.Id, datacenter.Properties.Location, location)) } } - if datacenter.Properties != nil { - log.Printf("[INFO] Got dc [Name=%s, Location=%s]", *datacenter.Properties.Name, *datacenter.Properties.Location) - } + log.Printf("[INFO] Got dc [Name=%s, Location=%s]", *datacenter.Properties.Name, datacenter.Properties.Location) } else { datacenters, apiResponse, err := client.DataCentersApi.DatacentersGet(ctx).Depth(1).Execute() @@ -141,8 +140,8 @@ func dataSourceDataCenterRead(ctx context.Context, d *schema.ResourceData, meta if nameOk && datacenters.Items != nil { var resultsByDatacenter []ionoscloud.Datacenter - for _, dc := range *datacenters.Items { - if dc.Properties != nil && dc.Properties.Name != nil && *dc.Properties.Name == name { + for _, dc := range datacenters.Items { + if dc.Properties.Name != nil && *dc.Properties.Name == name { resultsByDatacenter = append(resultsByDatacenter, dc) } } @@ -158,14 +157,14 @@ func dataSourceDataCenterRead(ctx context.Context, d *schema.ResourceData, meta var resultsByLocation []ionoscloud.Datacenter if results != nil { for _, dc := range results { - if dc.Properties.Location != nil && *dc.Properties.Location == location { + if dc.Properties.Location == location { resultsByLocation = append(resultsByLocation, dc) } } } else if datacenters.Items != nil { /* find the first datacenter matching the location */ - for _, dc := range *datacenters.Items { - if dc.Properties.Location != nil && *dc.Properties.Location == location { + for _, dc := range datacenters.Items { + if dc.Properties.Location == location { resultsByLocation = append(resultsByLocation, dc) } } diff --git a/ionoscloud/data_source_firewall.go b/ionoscloud/data_source_firewall.go index 4b21c6103..4bdec278f 100644 --- a/ionoscloud/data_source_firewall.go +++ b/ionoscloud/data_source_firewall.go @@ -7,7 +7,8 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" + "github.com/ionos-cloud/sdk-go-bundle/shared" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" ) @@ -100,7 +101,7 @@ func dataSourceFirewallRead(ctx context.Context, d *schema.ResourceData, meta in } var firewall ionoscloud.FirewallRule var err error - var apiResponse *ionoscloud.APIResponse + var apiResponse *shared.APIResponse if idOk { /* search by ID */ @@ -123,8 +124,8 @@ func dataSourceFirewallRead(ctx context.Context, d *schema.ResourceData, meta in var results []ionoscloud.FirewallRule if firewalls.Items != nil { - for _, fr := range *firewalls.Items { - if fr.Properties != nil && fr.Properties.Name != nil && *fr.Properties.Name == name.(string) { + for _, fr := range firewalls.Items { + if fr.Properties.Name != nil && *fr.Properties.Name == name.(string) { tmpFirewall, apiResponse, err := client.FirewallRulesApi.DatacentersServersNicsFirewallrulesFindById(ctx, datacenterId, serverId, nicId, *fr.Id).Execute() logApiRequestTime(apiResponse) if err != nil { diff --git a/ionoscloud/data_source_group.go b/ionoscloud/data_source_group.go index fecc9403e..84452049f 100644 --- a/ionoscloud/data_source_group.go +++ b/ionoscloud/data_source_group.go @@ -7,7 +7,8 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" + "github.com/ionos-cloud/sdk-go-bundle/shared" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" ) @@ -139,7 +140,7 @@ func dataSourceGroupRead(ctx context.Context, d *schema.ResourceData, meta inter if idOk { /* search by ID */ - var apiResponse *ionoscloud.APIResponse + var apiResponse *shared.APIResponse group, apiResponse, err = client.UserManagementApi.UmGroupsFindById(ctx, id.(string)).Execute() logApiRequestTime(apiResponse) if err != nil { @@ -160,8 +161,8 @@ func dataSourceGroupRead(ctx context.Context, d *schema.ResourceData, meta inter var results []ionoscloud.Group if groups.Items != nil { - for _, g := range *groups.Items { - if g.Properties != nil && g.Properties.Name != nil && *g.Properties.Name == name.(string) { + for _, g := range groups.Items { + if g.Properties.Name != nil && *g.Properties.Name == name.(string) { /* group found */ group, apiResponse, err = client.UserManagementApi.UmGroupsFindById(ctx, *g.Id).Execute() logApiRequestTime(apiResponse) diff --git a/ionoscloud/data_source_image.go b/ionoscloud/data_source_image.go index 9e22b479d..af377b5d3 100644 --- a/ionoscloud/data_source_image.go +++ b/ionoscloud/data_source_image.go @@ -10,7 +10,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" ) func dataSourceImage() *schema.Resource { @@ -150,8 +150,8 @@ func dataSourceImageRead(ctx context.Context, d *schema.ResourceData, meta inter if versionOk && nameOk && version != "" && name != "" { nameVer := fmt.Sprintf("%s-%s", name, version) if images.Items != nil { - for _, img := range *images.Items { - if img.Properties != nil && img.Properties.Name != nil && strings.EqualFold(*img.Properties.Name, nameVer) { + for _, img := range images.Items { + if img.Properties.Name != nil && strings.EqualFold(*img.Properties.Name, nameVer) { results = append(results, img) } } @@ -162,8 +162,8 @@ func dataSourceImageRead(ctx context.Context, d *schema.ResourceData, meta inter } else if nameOk && name != "" { var exactMatches []ionoscloud.Image if images.Items != nil { - for _, img := range *images.Items { - if img.Properties != nil && img.Properties.Name != nil && strings.Contains(strings.ToLower(*img.Properties.Name), strings.ToLower(name)) { + for _, img := range images.Items { + if img.Properties.Name != nil && strings.Contains(strings.ToLower(*img.Properties.Name), strings.ToLower(name)) { results = append(results, img) // if the image name is an exact match, store it in a separate list of exact matches if strings.EqualFold(*img.Properties.Name, name) { @@ -180,13 +180,13 @@ func dataSourceImageRead(ctx context.Context, d *schema.ResourceData, meta inter return diag.FromErr(fmt.Errorf("no image found with the specified criteria: name %s", name)) } } else { - results = *images.Items + results = images.Items } if imageTypeOk && imageType != "" { var imageTypeResults []ionoscloud.Image for _, img := range results { - if img.Properties != nil && img.Properties.ImageType != nil && strings.EqualFold(*img.Properties.ImageType, imageType) { + if img.Properties.ImageType != nil && strings.EqualFold(*img.Properties.ImageType, imageType) { imageTypeResults = append(imageTypeResults, img) } @@ -196,11 +196,9 @@ func dataSourceImageRead(ctx context.Context, d *schema.ResourceData, meta inter if imgAliasOk && imgAlias != "" { var imageAliasResults []ionoscloud.Image for _, img := range results { - if img.Properties != nil { - for _, imgAliasIdx := range *img.Properties.ImageAliases { - if strings.EqualFold(imgAliasIdx, imgAlias) { - imageAliasResults = append(imageAliasResults, img) - } + for _, imgAliasIdx := range img.Properties.ImageAliases { + if strings.EqualFold(imgAliasIdx, imgAlias) { + imageAliasResults = append(imageAliasResults, img) } } } @@ -210,7 +208,7 @@ func dataSourceImageRead(ctx context.Context, d *schema.ResourceData, meta inter if locationOk && location != "" { var locationResults []ionoscloud.Image for _, img := range results { - if img.Properties != nil && img.Properties.Location != nil && strings.EqualFold(*img.Properties.Location, location) { + if img.Properties.Location != nil && strings.EqualFold(*img.Properties.Location, location) { locationResults = append(locationResults, img) } } @@ -220,7 +218,7 @@ func dataSourceImageRead(ctx context.Context, d *schema.ResourceData, meta inter if cloudInitOk && cloudInit != "" { var cloudInitResults []ionoscloud.Image for _, img := range results { - if img.Properties != nil && img.Properties.CloudInit != nil && strings.EqualFold(*img.Properties.CloudInit, cloudInit) { + if img.Properties.CloudInit != nil && strings.EqualFold(*img.Properties.CloudInit, cloudInit) { cloudInitResults = append(cloudInitResults, img) } } @@ -233,9 +231,7 @@ func dataSourceImageRead(ctx context.Context, d *schema.ResourceData, meta inter return diag.FromErr(fmt.Errorf("no image found with the specified criteria: name = %s, type = %s, location = %s, version = %s, cloudInit = %s, imageAlias = %s", name, imageType, location, version, cloudInit, imgAlias)) } else if len(results) > 1 { for _, result := range results { - if result.Properties != nil { - log.Printf("[DEBUG] found image %s in location %s", *result.Properties.Name, *result.Properties.Location) - } + log.Printf("[DEBUG] found image %s in location %s", *result.Properties.Name, *result.Properties.Location) } return diag.FromErr(fmt.Errorf("more than one image found, enable debug to learn more. Criteria used name = %s, type = %s, location = %s, version = %s, cloudInit = %s, imageAlias = %s", name, imageType, location, version, cloudInit, imgAlias)) } else { @@ -254,129 +250,124 @@ func ImageSetData(d *schema.ResourceData, image *ionoscloud.Image) error { d.SetId(*image.Id) } - if image.Properties != nil { - - if image.Properties.Name != nil { - err := d.Set("name", *image.Properties.Name) - if err != nil { - return fmt.Errorf("error while setting name property for image %s: %w", d.Id(), err) - } + if image.Properties.Name != nil { + err := d.Set("name", *image.Properties.Name) + if err != nil { + return fmt.Errorf("error while setting name property for image %s: %w", d.Id(), err) } + } - if image.Properties.Description != nil { - if err := d.Set("description", *image.Properties.Description); err != nil { - return err - } + if image.Properties.Description != nil { + if err := d.Set("description", *image.Properties.Description); err != nil { + return err } + } - if image.Properties.Size != nil { - if err := d.Set("size", *image.Properties.Size); err != nil { - return err - } + if image.Properties.Size != nil { + if err := d.Set("size", *image.Properties.Size); err != nil { + return err } + } - if image.Properties.CpuHotPlug != nil { - if err := d.Set("cpu_hot_plug", *image.Properties.CpuHotPlug); err != nil { - return err - } + if image.Properties.CpuHotPlug != nil { + if err := d.Set("cpu_hot_plug", *image.Properties.CpuHotPlug); err != nil { + return err } + } - if image.Properties.CpuHotUnplug != nil { - if err := d.Set("cpu_hot_unplug", *image.Properties.CpuHotUnplug); err != nil { - return err - } + if image.Properties.CpuHotUnplug != nil { + if err := d.Set("cpu_hot_unplug", *image.Properties.CpuHotUnplug); err != nil { + return err } + } - if image.Properties.RamHotPlug != nil { - if err := d.Set("ram_hot_plug", *image.Properties.RamHotPlug); err != nil { - return err - } + if image.Properties.RamHotPlug != nil { + if err := d.Set("ram_hot_plug", *image.Properties.RamHotPlug); err != nil { + return err } + } - if image.Properties.RamHotUnplug != nil { - if err := d.Set("ram_hot_unplug", *image.Properties.RamHotUnplug); err != nil { - return err - } + if image.Properties.RamHotUnplug != nil { + if err := d.Set("ram_hot_unplug", *image.Properties.RamHotUnplug); err != nil { + return err } + } - if image.Properties.NicHotPlug != nil { - if err := d.Set("nic_hot_plug", *image.Properties.NicHotPlug); err != nil { - return err - } + if image.Properties.NicHotPlug != nil { + if err := d.Set("nic_hot_plug", *image.Properties.NicHotPlug); err != nil { + return err } + } - if image.Properties.NicHotUnplug != nil { - if err := d.Set("nic_hot_unplug", *image.Properties.NicHotUnplug); err != nil { - return err - } + if image.Properties.NicHotUnplug != nil { + if err := d.Set("nic_hot_unplug", *image.Properties.NicHotUnplug); err != nil { + return err } + } - if image.Properties.DiscVirtioHotPlug != nil { - if err := d.Set("disc_virtio_hot_plug", *image.Properties.DiscVirtioHotPlug); err != nil { - return err - } + if image.Properties.DiscVirtioHotPlug != nil { + if err := d.Set("disc_virtio_hot_plug", *image.Properties.DiscVirtioHotPlug); err != nil { + return err } + } - if image.Properties.DiscVirtioHotUnplug != nil { - if err := d.Set("disc_virtio_hot_unplug", *image.Properties.DiscVirtioHotUnplug); err != nil { - return err - } + if image.Properties.DiscVirtioHotUnplug != nil { + if err := d.Set("disc_virtio_hot_unplug", *image.Properties.DiscVirtioHotUnplug); err != nil { + return err } + } - if image.Properties.DiscScsiHotPlug != nil { - if err := d.Set("disc_scsi_hot_plug", *image.Properties.DiscScsiHotPlug); err != nil { - return err - } + if image.Properties.DiscScsiHotPlug != nil { + if err := d.Set("disc_scsi_hot_plug", *image.Properties.DiscScsiHotPlug); err != nil { + return err } + } - if image.Properties.DiscScsiHotUnplug != nil { - if err := d.Set("disc_scsi_hot_unplug", *image.Properties.DiscScsiHotUnplug); err != nil { - return err - } + if image.Properties.DiscScsiHotUnplug != nil { + if err := d.Set("disc_scsi_hot_unplug", *image.Properties.DiscScsiHotUnplug); err != nil { + return err } + } - if image.Properties.LicenceType != nil { - if err := d.Set("licence_type", *image.Properties.LicenceType); err != nil { - return err - } - } + if err := d.Set("licence_type", image.Properties.LicenceType); err != nil { + return err + } - if image.Properties.Public != nil { - if err := d.Set("public", *image.Properties.Public); err != nil { - return err - } + if image.Properties.Public != nil { + if err := d.Set("public", *image.Properties.Public); err != nil { + return err } + } - if image.Properties.ExposeSerial != nil { - if err := d.Set("expose_serial", *image.Properties.ExposeSerial); err != nil { - return err - } + if image.Properties.ExposeSerial != nil { + if err := d.Set("expose_serial", *image.Properties.ExposeSerial); err != nil { + return err } + } - if image.Properties.ImageAliases != nil && len(*image.Properties.ImageAliases) > 0 { - if err := d.Set("image_aliases", *image.Properties.ImageAliases); err != nil { - return err - } + if len(image.Properties.ImageAliases) > 0 { + if err := d.Set("image_aliases", image.Properties.ImageAliases); err != nil { + return err } + } - if image.Properties.CloudInit != nil { - if err := d.Set("cloud_init", *image.Properties.CloudInit); err != nil { - return err - } + if image.Properties.CloudInit != nil { + if err := d.Set("cloud_init", *image.Properties.CloudInit); err != nil { + return err } + } - if image.Properties.ImageType != nil { - err := d.Set("type", *image.Properties.ImageType) - if err != nil { - return err - } + if image.Properties.ImageType != nil { + err := d.Set("type", *image.Properties.ImageType) + if err != nil { + return err } + } - if image.Properties.Location != nil { - err := d.Set("location", *image.Properties.Location) - if err != nil { - return err - } + if image.Properties.Location != nil { + err := d.Set("location", *image.Properties.Location) + if err != nil { + return err } } return nil diff --git a/ionoscloud/data_source_ipblock.go b/ionoscloud/data_source_ipblock.go index ca911f7f3..01646576c 100644 --- a/ionoscloud/data_source_ipblock.go +++ b/ionoscloud/data_source_ipblock.go @@ -5,13 +5,14 @@ import ( "fmt" "log" + "github.com/ionos-cloud/sdk-go-bundle/shared" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/utils/constant" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" ) func dataSourceIpBlock() *schema.Resource { @@ -111,7 +112,7 @@ func datasourceIpBlockRead(ctx context.Context, data *schema.ResourceData, meta var ipBlock ionoscloud.IpBlock var err error client := meta.(services.SdkBundle).CloudApiClient - var apiResponse *ionoscloud.APIResponse + var apiResponse *shared.APIResponse if !idOk && !nameOk && !locationOk { return diag.FromErr(fmt.Errorf("either id, location or name must be set")) @@ -123,18 +124,18 @@ func datasourceIpBlockRead(ctx context.Context, data *schema.ResourceData, meta return diag.FromErr(fmt.Errorf("error getting ip block with id %s %w", id.(string), err)) } if nameOk { - if ipBlock.Properties != nil && *ipBlock.Properties.Name != name { + if *ipBlock.Properties.Name != name { return diag.FromErr(fmt.Errorf("name of ip block (UUID=%s, name=%s) does not match expected name: %s", *ipBlock.Id, *ipBlock.Properties.Name, name)) } } if locationOk { - if ipBlock.Properties != nil && *ipBlock.Properties.Location != location { + if ipBlock.Properties.Location != location { return diag.FromErr(fmt.Errorf("location of ip block (UUID=%s, location=%s) does not match expected location: %s", - *ipBlock.Id, *ipBlock.Properties.Location, location)) + *ipBlock.Id, ipBlock.Properties.Location, location)) } } - log.Printf("[INFO] Got ip block [Name=%s, Location=%s]", *ipBlock.Properties.Name, *ipBlock.Properties.Location) + log.Printf("[INFO] Got ip block [Name=%s, Location=%s]", *ipBlock.Properties.Name, ipBlock.Properties.Location) } else { ipBlocks, apiResponse, err := client.IPBlocksApi.IpblocksGet(ctx).Depth(1).Limit(constant.IPBlockLimit).Execute() @@ -147,8 +148,8 @@ func datasourceIpBlockRead(ctx context.Context, data *schema.ResourceData, meta var results []ionoscloud.IpBlock if nameOk && ipBlocks.Items != nil { - for _, block := range *ipBlocks.Items { - if block.Properties != nil && block.Properties.Name != nil && *block.Properties.Name == name { + for _, block := range ipBlocks.Items { + if block.Properties.Name != nil && *block.Properties.Name == name { results = append(results, block) } } @@ -162,15 +163,15 @@ func datasourceIpBlockRead(ctx context.Context, data *schema.ResourceData, meta if results != nil { var locationResults []ionoscloud.IpBlock for _, block := range results { - if block.Properties != nil && block.Properties.Location != nil && *block.Properties.Location == location { + if block.Properties.Location == location { locationResults = append(locationResults, block) } } results = locationResults } else if ipBlocks.Items != nil { /* find the first ipblock matching the location */ - for _, block := range *ipBlocks.Items { - if block.Properties != nil && block.Properties.Location != nil && *block.Properties.Location == location { + for _, block := range ipBlocks.Items { + if block.Properties.Location == location { results = append(results, block) } } diff --git a/ionoscloud/data_source_ipfailover.go b/ionoscloud/data_source_ipfailover.go index 2eb1ff5e3..6e57bbf0f 100644 --- a/ionoscloud/data_source_ipfailover.go +++ b/ionoscloud/data_source_ipfailover.go @@ -61,14 +61,14 @@ func dataSourceIpFailoverRead(ctx context.Context, d *schema.ResourceData, meta } return diag.FromErr(fmt.Errorf("error while fetching LAN with ID: %s, datacenter ID: %s, err: %w", lanId, dcId, err)) } - if lan.Properties == nil || lan.Properties.IpFailover == nil { + if lan.Properties.IpFailover == nil { return diag.FromErr(fmt.Errorf("expected a LAN response containing IP failover groups but received 'nil' instead")) } ipFailoverGroups := lan.Properties.IpFailover ipFailoverGroupFound := false - if lan.Properties != nil && ipFailoverGroups != nil && len(*ipFailoverGroups) > 0 { - for _, ipFailoverGroup := range *ipFailoverGroups { + if len(ipFailoverGroups) > 0 { + for _, ipFailoverGroup := range ipFailoverGroups { // Search for the appropriate IP Failover Group using the provided IP if *ipFailoverGroup.Ip == ip { // Set the information only if the IP Failover Group exists diff --git a/ionoscloud/data_source_k8s_cluster.go b/ionoscloud/data_source_k8s_cluster.go index aa8a56cd8..059e01096 100644 --- a/ionoscloud/data_source_k8s_cluster.go +++ b/ionoscloud/data_source_k8s_cluster.go @@ -10,9 +10,10 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "gopkg.in/yaml.v3" + "github.com/ionos-cloud/sdk-go-bundle/shared" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" ) type KubeConfig struct { @@ -281,7 +282,7 @@ func dataSourceK8sReadCluster(ctx context.Context, d *schema.ResourceData, meta } var cluster ionoscloud.KubernetesCluster var err error - var apiResponse *ionoscloud.APIResponse + var apiResponse *shared.APIResponse if idOk { /* search by ID */ @@ -303,8 +304,8 @@ func dataSourceK8sReadCluster(ctx context.Context, d *schema.ResourceData, meta if clusters.Items != nil { var results []ionoscloud.KubernetesCluster - for _, c := range *clusters.Items { - if c.Properties != nil && c.Properties.Name != nil && *c.Properties.Name == name.(string) { + for _, c := range clusters.Items { + if c.Properties.Name == name.(string) { tmpCluster, apiResponse, err := client.KubernetesApi.K8sFindByClusterId(ctx, *c.Id).Execute() logApiRequestTime(apiResponse) if err != nil { @@ -451,9 +452,9 @@ func setAdditionalK8sClusterData(d *schema.ResourceData, cluster *ionoscloud.Kub return fmt.Errorf("an error occurred while fetching the kubernetes cluster node pools for cluster with ID %s: %w", *cluster.Id, err) } - if clusterNodePools.Items != nil && len(*clusterNodePools.Items) > 0 { + if len(clusterNodePools.Items) > 0 { var nodePools []interface{} - for _, nodePool := range *clusterNodePools.Items { + for _, nodePool := range clusterNodePools.Items { nodePools = append(nodePools, *nodePool.Id) } if err := d.Set("node_pools", nodePools); err != nil { @@ -461,9 +462,9 @@ func setAdditionalK8sClusterData(d *schema.ResourceData, cluster *ionoscloud.Kub } } - if cluster.Properties != nil && cluster.Properties.AvailableUpgradeVersions != nil { - availableUpgradeVersions := make([]interface{}, len(*cluster.Properties.AvailableUpgradeVersions), len(*cluster.Properties.AvailableUpgradeVersions)) - for i, availableUpgradeVersion := range *cluster.Properties.AvailableUpgradeVersions { + if cluster.Properties.AvailableUpgradeVersions != nil { + availableUpgradeVersions := make([]interface{}, len(cluster.Properties.AvailableUpgradeVersions), len(cluster.Properties.AvailableUpgradeVersions)) + for i, availableUpgradeVersion := range cluster.Properties.AvailableUpgradeVersions { availableUpgradeVersions[i] = availableUpgradeVersion } if err := d.Set("available_upgrade_versions", availableUpgradeVersions); err != nil { diff --git a/ionoscloud/data_source_k8s_clusters.go b/ionoscloud/data_source_k8s_clusters.go index 9a222bfe0..797f124ac 100644 --- a/ionoscloud/data_source_k8s_clusters.go +++ b/ionoscloud/data_source_k8s_clusters.go @@ -13,7 +13,7 @@ import ( "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/utils" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/utils/uuidgen" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" ) func dataSourceK8sClusters() *schema.Resource { @@ -65,10 +65,10 @@ func dataSourceK8sReadClusters(ctx context.Context, d *schema.ResourceData, meta if err != nil { return diag.FromErr(fmt.Errorf("an error occurred while fetching k8s clusters: %w", err)) } - if clusters.Items != nil && len(*clusters.Items) == 0 { + if len(clusters.Items) == 0 { return diag.FromErr(fmt.Errorf("no clusters found")) } - if err := setDataSourceK8sSetClusters(ctx, d, *clusters.Items, client); err != nil { + if err := setDataSourceK8sSetClusters(ctx, d, clusters.Items, client); err != nil { return diag.FromErr(err) } return nil @@ -100,13 +100,6 @@ func setDataSourceK8sSetClusters(ctx context.Context, d *schema.ResourceData, cl // K8sClusterProperties returns a map equivalent of dataSourceK8sClusterSchema func K8sClusterProperties(ctx context.Context, cluster ionoscloud.KubernetesCluster, client *ionoscloud.APIClient) (map[string]any, error) { - if cluster.Properties == nil { - clusterID := "nil" - if cluster.Id != nil { - clusterID = *cluster.Id - } - return nil, fmt.Errorf("cannot set data, Properties was nil for cluster: %s", clusterID) - } clusterProperties := make(map[string]any) utils.SetPropWithNilCheck(clusterProperties, "name", cluster.Properties.Name) @@ -117,26 +110,26 @@ func K8sClusterProperties(ctx context.Context, cluster ionoscloud.KubernetesClus utils.SetPropWithNilCheck(clusterProperties, "node_subnet", cluster.Properties.NodeSubnet) utils.SetPropWithNilCheck(clusterProperties, "viable_node_pool_versions", cluster.Properties.ViableNodePoolVersions) - if cluster.Properties.MaintenanceWindow != nil && cluster.Properties.MaintenanceWindow.Time != nil && cluster.Properties.MaintenanceWindow.DayOfTheWeek != nil { - clusterProperties["maintenance_window"] = []map[string]any{{"time": *cluster.Properties.MaintenanceWindow.Time, "day_of_the_week": *cluster.Properties.MaintenanceWindow.DayOfTheWeek}} + if cluster.Properties.MaintenanceWindow != nil { + clusterProperties["maintenance_window"] = []map[string]any{{"time": cluster.Properties.MaintenanceWindow.Time, "day_of_the_week": cluster.Properties.MaintenanceWindow.DayOfTheWeek}} } if cluster.Properties.S3Buckets != nil { - s3Buckets := make([]map[string]any, len(*cluster.Properties.S3Buckets)) - for i, s3Bucket := range *cluster.Properties.S3Buckets { + s3Buckets := make([]map[string]any, len(cluster.Properties.S3Buckets)) + for i, s3Bucket := range cluster.Properties.S3Buckets { s3Buckets[i] = map[string]any{"name": s3Bucket.Name} } clusterProperties["s3_buckets"] = s3Buckets } if cluster.Properties.AvailableUpgradeVersions != nil { - availableUpgradeVersions := make([]any, len(*cluster.Properties.AvailableUpgradeVersions)) - for i, availableUpgradeVersion := range *cluster.Properties.AvailableUpgradeVersions { + availableUpgradeVersions := make([]any, len(cluster.Properties.AvailableUpgradeVersions)) + for i, availableUpgradeVersion := range cluster.Properties.AvailableUpgradeVersions { availableUpgradeVersions[i] = availableUpgradeVersion } clusterProperties["available_upgrade_versions"] = availableUpgradeVersions } if cluster.Properties.ApiSubnetAllowList != nil { - apiSubnetAllowList := make([]any, len(*cluster.Properties.ApiSubnetAllowList)) - for i, subnet := range *cluster.Properties.ApiSubnetAllowList { + apiSubnetAllowList := make([]any, len(cluster.Properties.ApiSubnetAllowList)) + for i, subnet := range cluster.Properties.ApiSubnetAllowList { apiSubnetAllowList[i] = subnet } clusterProperties["api_subnet_allow_list"] = apiSubnetAllowList @@ -164,9 +157,9 @@ func K8sClusterProperties(ctx context.Context, cluster ionoscloud.KubernetesClus if err != nil { return nil, fmt.Errorf("an error occurred while fetching the kubernetes cluster node pools for cluster with ID %s: %w", *cluster.Id, err) } - if clusterNodePools.Items != nil && len(*clusterNodePools.Items) > 0 { + if len(clusterNodePools.Items) > 0 { var nodePools []any - for _, nodePool := range *clusterNodePools.Items { + for _, nodePool := range clusterNodePools.Items { nodePools = append(nodePools, *nodePool.Id) } clusterProperties["node_pools"] = nodePools diff --git a/ionoscloud/data_source_k8s_node_pool.go b/ionoscloud/data_source_k8s_node_pool.go index 137d0e57b..16d539d5c 100644 --- a/ionoscloud/data_source_k8s_node_pool.go +++ b/ionoscloud/data_source_k8s_node_pool.go @@ -8,7 +8,8 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" + "github.com/ionos-cloud/sdk-go-bundle/shared" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" ) @@ -209,7 +210,7 @@ func dataSourceK8sReadNodePool(ctx context.Context, d *schema.ResourceData, meta } var nodePool ionoscloud.KubernetesNodePool var err error - var apiResponse *ionoscloud.APIResponse + var apiResponse *shared.APIResponse if idOk { /* search by ID */ nodePool, apiResponse, err = client.KubernetesApi.K8sNodepoolsFindById(ctx, clusterId.(string), id.(string)).Execute() @@ -230,8 +231,8 @@ func dataSourceK8sReadNodePool(ctx context.Context, d *schema.ResourceData, meta if nodePools.Items != nil { var results []ionoscloud.KubernetesNodePool - for _, c := range *nodePools.Items { - if c.Properties != nil && c.Properties.Name != nil && *c.Properties.Name == name.(string) { + for _, c := range nodePools.Items { + if c.Properties.Name == name.(string) { tmpNodePool, apiResponse, err := client.KubernetesApi.K8sNodepoolsFindById(ctx, clusterId.(string), *c.Id).Execute() logApiRequestTime(apiResponse) if err != nil { @@ -263,8 +264,8 @@ func dataSourceK8sReadNodePool(ctx context.Context, d *schema.ResourceData, meta } } - if nodePool.Properties.AvailableUpgradeVersions != nil && len(*nodePool.Properties.AvailableUpgradeVersions) > 0 { - if err := d.Set("available_upgrade_versions", *nodePool.Properties.AvailableUpgradeVersions); err != nil { + if len(nodePool.Properties.AvailableUpgradeVersions) > 0 { + if err := d.Set("available_upgrade_versions", nodePool.Properties.AvailableUpgradeVersions); err != nil { return diag.FromErr(err) } } diff --git a/ionoscloud/data_source_k8s_node_pool_nodes.go b/ionoscloud/data_source_k8s_node_pool_nodes.go index 29e8242f1..0e17c3502 100644 --- a/ionoscloud/data_source_k8s_node_pool_nodes.go +++ b/ionoscloud/data_source_k8s_node_pool_nodes.go @@ -7,8 +7,8 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" mongo "github.com/ionos-cloud/sdk-go-dbaas-mongo" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" ) @@ -81,12 +81,12 @@ func dataSourceK8sReadNodePoolNodes(ctx context.Context, d *schema.ResourceData, if nodesList.Items == nil { return diag.FromErr(fmt.Errorf("no nodes found for nodepool with id %s", nodePoolIdStr)) } - if len(*nodesList.Items) == 0 { + if len(nodesList.Items) == 0 { return diag.FromErr(fmt.Errorf("nodes list is empty for of nodepool with id %s", nodePoolIdStr)) } - if len(*nodesList.Items) > 0 { + if len(nodesList.Items) > 0 { var nodes []interface{} - for _, node := range *nodesList.Items { + for _, node := range nodesList.Items { nodeMap := setK8sNodesDataToMap(node) nodes = append(nodes, nodeMap) } @@ -104,11 +104,9 @@ func setK8sNodesDataToMap(node ionoscloud.KubernetesNode) map[string]interface{} if node.Id != nil { nodeEntry["id"] = mongo.ToValueDefault(node.Id) } - if node.Properties != nil { - nodeEntry["name"] = mongo.ToValueDefault(node.Properties.Name) - nodeEntry["public_ip"] = mongo.ToValueDefault(node.Properties.PublicIP) - nodeEntry["private_ip"] = mongo.ToValueDefault(node.Properties.PrivateIP) - nodeEntry["k8s_version"] = mongo.ToValueDefault(node.Properties.K8sVersion) - } + nodeEntry["name"] = mongo.ToValueDefault(&node.Properties.Name) + nodeEntry["public_ip"] = mongo.ToValueDefault(node.Properties.PublicIP) + nodeEntry["private_ip"] = mongo.ToValueDefault(node.Properties.PrivateIP) + nodeEntry["k8s_version"] = mongo.ToValueDefault(&node.Properties.K8sVersion) return nodeEntry } diff --git a/ionoscloud/data_source_lan.go b/ionoscloud/data_source_lan.go index 285f897fd..8c0a2b40f 100644 --- a/ionoscloud/data_source_lan.go +++ b/ionoscloud/data_source_lan.go @@ -8,7 +8,8 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" + "github.com/ionos-cloud/sdk-go-bundle/shared" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" ) @@ -107,7 +108,7 @@ func dataSourceLanRead(ctx context.Context, d *schema.ResourceData, meta interfa } var lan ionoscloud.Lan var err error - var apiResponse *ionoscloud.APIResponse + var apiResponse *shared.APIResponse if idOk { /* search by ID */ @@ -129,8 +130,8 @@ func dataSourceLanRead(ctx context.Context, d *schema.ResourceData, meta interfa var results []ionoscloud.Lan if lans.Items != nil { - for _, l := range *lans.Items { - if l.Properties != nil && l.Properties.Name != nil && *l.Properties.Name == name.(string) { + for _, l := range lans.Items { + if l.Properties.Name != nil && *l.Properties.Name == name.(string) { /* lan found */ lan, apiResponse, err = client.LANsApi.DatacentersLansFindById(ctx, datacenterId.(string), *l.Id).Execute() logApiRequestTime(apiResponse) diff --git a/ionoscloud/data_source_location.go b/ionoscloud/data_source_location.go index cf8a4b082..6d834f911 100644 --- a/ionoscloud/data_source_location.go +++ b/ionoscloud/data_source_location.go @@ -9,7 +9,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" ) func dataSourceLocation() *schema.Resource { @@ -87,8 +87,8 @@ func dataSourceLocationRead(ctx context.Context, d *schema.ResourceData, meta in var results []ionoscloud.Location if nameOk && locations.Items != nil { - for _, loc := range *locations.Items { - if loc.Properties != nil && loc.Properties.Name != nil && *loc.Properties.Name == name.(string) { + for _, loc := range locations.Items { + if loc.Properties.Name != nil && *loc.Properties.Name == name.(string) { results = append(results, loc) } } @@ -117,45 +117,43 @@ func setLocationData(d *schema.ResourceData, location *ionoscloud.Location) erro d.SetId(*location.Id) } - if location.Properties != nil { - var cpuArchitectures []interface{} - for _, cpuArchitecture := range *location.Properties.CpuArchitecture { - architectureEntry := make(map[string]interface{}) + var cpuArchitectures []interface{} + for _, cpuArchitecture := range location.Properties.CpuArchitecture { + architectureEntry := make(map[string]interface{}) - if cpuArchitecture.CpuFamily != nil { - architectureEntry["cpu_family"] = *cpuArchitecture.CpuFamily - } - - if cpuArchitecture.MaxCores != nil { - architectureEntry["max_cores"] = *cpuArchitecture.MaxCores - } - - if cpuArchitecture.MaxRam != nil { - architectureEntry["max_ram"] = *cpuArchitecture.MaxRam - } + if cpuArchitecture.CpuFamily != nil { + architectureEntry["cpu_family"] = *cpuArchitecture.CpuFamily + } - if cpuArchitecture.Vendor != nil { - architectureEntry["vendor"] = *cpuArchitecture.Vendor - } + if cpuArchitecture.MaxCores != nil { + architectureEntry["max_cores"] = *cpuArchitecture.MaxCores + } - cpuArchitectures = append(cpuArchitectures, architectureEntry) + if cpuArchitecture.MaxRam != nil { + architectureEntry["max_ram"] = *cpuArchitecture.MaxRam } - if len(cpuArchitectures) > 0 { - if err := d.Set("cpu_architecture", cpuArchitectures); err != nil { - return fmt.Errorf("error while setting cpu_architecture property for datacenter %s: %w", d.Id(), err) - } + if cpuArchitecture.Vendor != nil { + architectureEntry["vendor"] = *cpuArchitecture.Vendor } - var imageAliases []string - for _, imageAlias := range *location.Properties.ImageAliases { - imageAliases = append(imageAliases, imageAlias) + cpuArchitectures = append(cpuArchitectures, architectureEntry) + } + + if len(cpuArchitectures) > 0 { + if err := d.Set("cpu_architecture", cpuArchitectures); err != nil { + return fmt.Errorf("error while setting cpu_architecture property for datacenter %s: %w", d.Id(), err) } + } - if len(imageAliases) > 0 { - if err := d.Set("image_aliases", imageAliases); err != nil { - return fmt.Errorf("error while setting image_aliases property for datacenter %s: %w", d.Id(), err) - } + var imageAliases []string + for _, imageAlias := range location.Properties.ImageAliases { + imageAliases = append(imageAliases, imageAlias) + } + + if len(imageAliases) > 0 { + if err := d.Set("image_aliases", imageAliases); err != nil { + return fmt.Errorf("error while setting image_aliases property for datacenter %s: %w", d.Id(), err) } } diff --git a/ionoscloud/data_source_natgateway.go b/ionoscloud/data_source_natgateway.go index eb98e5c3d..0508f7142 100644 --- a/ionoscloud/data_source_natgateway.go +++ b/ionoscloud/data_source_natgateway.go @@ -6,12 +6,13 @@ import ( "fmt" "strings" + "github.com/ionos-cloud/sdk-go-bundle/shared" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" ) func dataSourceNatGateway() *schema.Resource { @@ -89,7 +90,7 @@ func dataSourceNatGatewayRead(ctx context.Context, d *schema.ResourceData, meta } var natGateway ionoscloud.NatGateway var err error - var apiResponse *ionoscloud.APIResponse + var apiResponse *shared.APIResponse if idOk { /* search by ID */ @@ -110,8 +111,8 @@ func dataSourceNatGatewayRead(ctx context.Context, d *schema.ResourceData, meta var results []ionoscloud.NatGateway if natGateways.Items != nil { - for _, ng := range *natGateways.Items { - if ng.Properties != nil && ng.Properties.Name != nil && strings.EqualFold(*ng.Properties.Name, name.(string)) { + for _, ng := range natGateways.Items { + if strings.EqualFold(ng.Properties.Name, name.(string)) { tmpNatGateway, apiResponse, err := client.NATGatewaysApi.DatacentersNatgatewaysFindByNatGatewayId(ctx, datacenterId.(string), *ng.Id).Execute() logApiRequestTime(apiResponse) if err != nil { diff --git a/ionoscloud/data_source_natgateway_rule.go b/ionoscloud/data_source_natgateway_rule.go index 1bd1ff918..3691d6060 100644 --- a/ionoscloud/data_source_natgateway_rule.go +++ b/ionoscloud/data_source_natgateway_rule.go @@ -6,11 +6,12 @@ import ( "fmt" "strings" + "github.com/ionos-cloud/sdk-go-bundle/shared" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" ) func dataSourceNatGatewayRule() *schema.Resource { @@ -119,7 +120,7 @@ func dataSourceNatGatewayRuleRead(ctx context.Context, d *schema.ResourceData, m var natGatewayRule ionoscloud.NatGatewayRule var err error - var apiResponse *ionoscloud.APIResponse + var apiResponse *shared.APIResponse if idOk { /* search by ID */ @@ -140,8 +141,8 @@ func dataSourceNatGatewayRuleRead(ctx context.Context, d *schema.ResourceData, m var results []ionoscloud.NatGatewayRule if natGatewayRules.Items != nil { - for _, ngr := range *natGatewayRules.Items { - if ngr.Properties != nil && ngr.Properties.Name != nil && strings.EqualFold(*ngr.Properties.Name, name.(string)) { + for _, ngr := range natGatewayRules.Items { + if strings.EqualFold(ngr.Properties.Name, name.(string)) { tmpNatGatewayRule, apiResponse, err := client.NATGatewaysApi.DatacentersNatgatewaysRulesFindByNatGatewayRuleId(ctx, datacenterId.(string), natgatewayId.(string), *ngr.Id).Execute() logApiRequestTime(apiResponse) if err != nil { diff --git a/ionoscloud/data_source_networkloadbalancer.go b/ionoscloud/data_source_networkloadbalancer.go index 0bee3f774..bab4bd73b 100644 --- a/ionoscloud/data_source_networkloadbalancer.go +++ b/ionoscloud/data_source_networkloadbalancer.go @@ -8,7 +8,8 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" + "github.com/ionos-cloud/sdk-go-bundle/shared" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" cloudapiflowlog "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/cloudapi/flowlog" @@ -107,7 +108,7 @@ func dataSourceNetworkLoadBalancerRead(ctx context.Context, d *schema.ResourceDa } var networkLoadBalancer ionoscloud.NetworkLoadBalancer var err error - var apiResponse *ionoscloud.APIResponse + var apiResponse *shared.APIResponse if idOk { /* search by ID */ @@ -128,8 +129,8 @@ func dataSourceNetworkLoadBalancerRead(ctx context.Context, d *schema.ResourceDa var results []ionoscloud.NetworkLoadBalancer if networkLoadBalancers.Items != nil { - for _, nlb := range *networkLoadBalancers.Items { - if nlb.Properties != nil && nlb.Properties.Name != nil && strings.EqualFold(*nlb.Properties.Name, name.(string)) { + for _, nlb := range networkLoadBalancers.Items { + if strings.EqualFold(nlb.Properties.Name, name.(string)) { tmpNetworkLoadBalancer, apiResponse, err := client.NetworkLoadBalancersApi.DatacentersNetworkloadbalancersFindByNetworkLoadBalancerId(ctx, dcID, *nlb.Id).Depth(4).Execute() logApiRequestTime(apiResponse) if err != nil { diff --git a/ionoscloud/data_source_networkloadbalancer_forwardingrule.go b/ionoscloud/data_source_networkloadbalancer_forwardingrule.go index f7c443b8d..7f46b26d9 100644 --- a/ionoscloud/data_source_networkloadbalancer_forwardingrule.go +++ b/ionoscloud/data_source_networkloadbalancer_forwardingrule.go @@ -6,12 +6,13 @@ import ( "fmt" "strings" + "github.com/ionos-cloud/sdk-go-bundle/shared" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" ) func dataSourceNetworkLoadBalancerForwardingRule() *schema.Resource { @@ -177,7 +178,7 @@ func dataSourceNetworkLoadBalancerForwardingRuleRead(ctx context.Context, d *sch } var networkLoadBalancerForwardingRule ionoscloud.NetworkLoadBalancerForwardingRule var err error - var apiResponse *ionoscloud.APIResponse + var apiResponse *shared.APIResponse if idOk { /* search by ID */ @@ -198,8 +199,8 @@ func dataSourceNetworkLoadBalancerForwardingRuleRead(ctx context.Context, d *sch var results []ionoscloud.NetworkLoadBalancerForwardingRule if networkLoadBalancerForwardingRules.Items != nil { - for _, nlbfr := range *networkLoadBalancerForwardingRules.Items { - if nlbfr.Properties != nil && nlbfr.Properties.Name != nil && strings.EqualFold(*nlbfr.Properties.Name, name.(string)) { + for _, nlbfr := range networkLoadBalancerForwardingRules.Items { + if strings.EqualFold(nlbfr.Properties.Name, name.(string)) { tmpNetworkLoadBalancerForwardingRule, apiResponse, err := client.NetworkLoadBalancersApi.DatacentersNetworkloadbalancersForwardingrulesFindByForwardingRuleId(ctx, datacenterId.(string), networkloadbalancerId.(string), *nlbfr.Id).Depth(1).Execute() logApiRequestTime(apiResponse) if err != nil { diff --git a/ionoscloud/data_source_nic.go b/ionoscloud/data_source_nic.go index 7620925f7..d73f47e31 100644 --- a/ionoscloud/data_source_nic.go +++ b/ionoscloud/data_source_nic.go @@ -7,7 +7,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/cloudapi/cloudapinic" @@ -137,7 +137,7 @@ func dataSourceNicRead(ctx context.Context, data *schema.ResourceData, meta inte return diag.FromErr(fmt.Errorf("error getting nic with id %s %w", id.(string), err)) } if nameOk { - if foundNic.Properties != nil && *foundNic.Properties.Name != name { + if *foundNic.Properties.Name != name { return diag.FromErr(fmt.Errorf("name of nic (UUID=%s, name=%s) does not match expected name: %s", *foundNic.Id, *foundNic.Properties.Name, name)) } @@ -153,7 +153,7 @@ func dataSourceNicRead(ctx context.Context, data *schema.ResourceData, meta inte if nameOk && nics != nil { for _, tempNic := range nics { - if tempNic.Properties != nil && tempNic.Properties.Name != nil && *tempNic.Properties.Name == name { + if tempNic.Properties.Name != nil && *tempNic.Properties.Name == name { results = append(results, tempNic) } } diff --git a/ionoscloud/data_source_nic_test.go b/ionoscloud/data_source_nic_test.go index 02d189020..53ebd0d1a 100644 --- a/ionoscloud/data_source_nic_test.go +++ b/ionoscloud/data_source_nic_test.go @@ -11,7 +11,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" ) func testGetNicDataSourceSchema() map[string]*schema.Schema { @@ -97,23 +97,26 @@ func Test_dataSourceNicRead(t *testing.T) { testName := "testname" dhcp := true dhcpv6 := false + dhcpv6NulBool := ionoscloud.NullableBool{} + dhcpv6NulBool.Set(&dhcpv6) firewallActive := true firewallType := "Bidirectional" ipv6CidrBlock := "AUTO" + ipv6CidrBlockNulStr := ionoscloud.NullableString{} + ipv6CidrBlockNulStr.Set(&ipv6CidrBlock) nic := ionoscloud.Nic{ Id: &id, Type: nil, Href: nil, Metadata: nil, - Properties: &ionoscloud.NicProperties{ + Properties: ionoscloud.NicProperties{ Name: &testName, Mac: &mac, Ips: nil, Ipv6Ips: nil, Dhcp: &dhcp, - Dhcpv6: &dhcpv6, - Ipv6CidrBlock: &ipv6CidrBlock, - Lan: nil, + Dhcpv6: dhcpv6NulBool, + Ipv6CidrBlock: ipv6CidrBlockNulStr, FirewallActive: &firewallActive, FirewallType: &firewallType, DeviceNumber: nil, @@ -156,11 +159,11 @@ func Test_dataSourceNicRead(t *testing.T) { if *nic.Properties.Dhcp != data.Get("dhcp").(bool) { t.Fatalf("expected '%t', got '%s'", *nic.Properties.Dhcp, data.Get("dhcp")) } - if *nic.Properties.Dhcpv6 != data.Get("dhcpv6").(bool) { - t.Fatalf("expected '%t', got '%s'", *nic.Properties.Dhcpv6, data.Get("dhcpv6")) + if *nic.Properties.Dhcpv6.Get() != data.Get("dhcpv6").(bool) { + t.Fatalf("expected '%t', got '%s'", *nic.Properties.Dhcpv6.Get(), data.Get("dhcpv6")) } - if *nic.Properties.Ipv6CidrBlock != data.Get("ipv6_cidr_block").(string) { - t.Fatalf("expected '%s', got '%s'", *nic.Properties.Ipv6CidrBlock, data.Get("ipv6CidrBlock")) + if *nic.Properties.Ipv6CidrBlock.Get() != data.Get("ipv6_cidr_block").(string) { + t.Fatalf("expected '%s', got '%s'", *nic.Properties.Ipv6CidrBlock.Get(), data.Get("ipv6CidrBlock")) } if *nic.Properties.FirewallActive != data.Get("firewall_active").(bool) { t.Fatalf("expected '%t', got '%s'", *nic.Properties.FirewallActive, data.Get("firewallActive")) diff --git a/ionoscloud/data_source_nsg.go b/ionoscloud/data_source_nsg.go index df9143b95..9bbadea50 100644 --- a/ionoscloud/data_source_nsg.go +++ b/ionoscloud/data_source_nsg.go @@ -12,7 +12,7 @@ import ( "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" ) func dataSourceNSGFirewallRuleSchema() map[string]*schema.Schema { @@ -133,8 +133,8 @@ func dataSourceNSGRead(ctx context.Context, d *schema.ResourceData, meta interfa } var results []ionoscloud.SecurityGroup if securityGroups.Items != nil { - for _, sg := range *securityGroups.Items { - if sg.Properties != nil && sg.Properties.Name != nil && strings.EqualFold(*sg.Properties.Name, name.(string)) { + for _, sg := range securityGroups.Items { + if strings.EqualFold(sg.Properties.Name, name.(string)) { results = append(results, sg) } } @@ -159,28 +159,20 @@ func setNSGDataSource(d *schema.ResourceData, securityGroup *ionoscloud.Security } if securityGroup.Entities != nil { if securityGroup.Entities.Rules != nil && securityGroup.Entities.Rules.Items != nil { - rulesData := make([]map[string]any, 0, len(*securityGroup.Entities.Rules.Items)) - for _, rule := range *securityGroup.Entities.Rules.Items { + rulesData := make([]map[string]any, 0, len(securityGroup.Entities.Rules.Items)) + for _, rule := range securityGroup.Entities.Rules.Items { ruleData := make(map[string]any) - if rule.Id == nil || rule.Properties == nil { + if rule.Id == nil { continue } ruleData["id"] = *rule.Id if rule.Properties.Name != nil { ruleData["name"] = *rule.Properties.Name } - if rule.Properties.SourceMac != nil { - ruleData["source_mac"] = *rule.Properties.SourceMac - } - if rule.Properties.SourceIp != nil { - ruleData["source_ip"] = *rule.Properties.SourceIp - } - if rule.Properties.TargetIp != nil { - ruleData["target_ip"] = *rule.Properties.TargetIp - } - if rule.Properties.Protocol != nil { - ruleData["protocol"] = *rule.Properties.Protocol - } + ruleData["source_mac"] = rule.Properties.SourceMac + ruleData["source_ip"] = rule.Properties.SourceIp + ruleData["target_ip"] = rule.Properties.TargetIp + ruleData["protocol"] = rule.Properties.Protocol if rule.Properties.Type != nil { ruleData["type"] = *rule.Properties.Type } @@ -190,11 +182,11 @@ func setNSGDataSource(d *schema.ResourceData, securityGroup *ionoscloud.Security if rule.Properties.PortRangeEnd != nil { ruleData["port_range_end"] = *rule.Properties.PortRangeEnd } - if rule.Properties.IcmpType != nil { - ruleData["icmp_type"] = strconv.Itoa(int(*rule.Properties.IcmpType)) + if rule.Properties.IcmpType.IsSet() && rule.Properties.IcmpType.Get() != nil { + ruleData["icmp_type"] = strconv.Itoa(int(*rule.Properties.IcmpType.Get())) } - if rule.Properties.IcmpCode != nil { - ruleData["icmp_code"] = strconv.Itoa(int(*rule.Properties.IcmpCode)) + if rule.Properties.IcmpCode.IsSet() && rule.Properties.IcmpType.Get() != nil { + ruleData["icmp_code"] = strconv.Itoa(int(*rule.Properties.IcmpCode.Get())) } rulesData = append(rulesData, ruleData) } diff --git a/ionoscloud/data_source_private_crossconnect.go b/ionoscloud/data_source_private_crossconnect.go index 1a851d81b..269a204c0 100644 --- a/ionoscloud/data_source_private_crossconnect.go +++ b/ionoscloud/data_source_private_crossconnect.go @@ -7,7 +7,8 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" + "github.com/ionos-cloud/sdk-go-bundle/shared" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" ) @@ -89,13 +90,13 @@ func dataSourcePcc() *schema.Resource { } } -func convertPccPeers(peers *[]ionoscloud.Peer) []interface{} { +func convertPccPeers(peers []ionoscloud.Peer) []interface{} { if peers == nil { return make([]interface{}, 0) } - ret := make([]interface{}, len(*peers), len(*peers)) - for i, peer := range *peers { + ret := make([]interface{}, len(peers), len(peers)) + for i, peer := range peers { entry := make(map[string]interface{}) entry["lan_id"] = peer.Id @@ -110,13 +111,13 @@ func convertPccPeers(peers *[]ionoscloud.Peer) []interface{} { return ret } -func convertConnectableDatacenters(dcs *[]ionoscloud.ConnectableDatacenter) []interface{} { +func convertConnectableDatacenters(dcs []ionoscloud.ConnectableDatacenter) []interface{} { if dcs == nil { return make([]interface{}, 0) } - ret := make([]interface{}, len(*dcs), len(*dcs)) - for i, dc := range *dcs { + ret := make([]interface{}, len(dcs), len(dcs)) + for i, dc := range dcs { entry := make(map[string]interface{}) entry["id"] = dc.Id @@ -135,26 +136,24 @@ func setPccDataSource(d *schema.ResourceData, pcc *ionoscloud.PrivateCrossConnec d.SetId(*pcc.Id) } - if pcc.Properties != nil { - if pcc.Properties.Name != nil { - if err := d.Set("name", *pcc.Properties.Name); err != nil { - return err - } + if pcc.Properties.Name != nil { + if err := d.Set("name", *pcc.Properties.Name); err != nil { + return err } - if pcc.Properties.Description != nil { - if err := d.Set("description", *pcc.Properties.Description); err != nil { - return err - } + } + if pcc.Properties.Description != nil { + if err := d.Set("description", *pcc.Properties.Description); err != nil { + return err } - if pcc.Properties.Peers != nil { - if err := d.Set("peers", convertPccPeers(pcc.Properties.Peers)); err != nil { - return err - } + } + if pcc.Properties.Peers != nil { + if err := d.Set("peers", convertPccPeers(pcc.Properties.Peers)); err != nil { + return err } - if pcc.Properties.ConnectableDatacenters != nil && len(*pcc.Properties.ConnectableDatacenters) > 0 { - if err := d.Set("connectable_datacenters", convertConnectableDatacenters(pcc.Properties.ConnectableDatacenters)); err != nil { - return err - } + } + if len(pcc.Properties.ConnectableDatacenters) > 0 { + if err := d.Set("connectable_datacenters", convertConnectableDatacenters(pcc.Properties.ConnectableDatacenters)); err != nil { + return err } } return nil @@ -175,11 +174,11 @@ func dataSourcePccRead(ctx context.Context, d *schema.ResourceData, meta interfa var pcc ionoscloud.PrivateCrossConnect var err error - var apiResponse *ionoscloud.APIResponse + var apiResponse *shared.APIResponse if idOk { /* search by ID */ - pcc, apiResponse, err = client.PrivateCrossConnectsApi.PccsFindById(ctx, id.(string)).Execute() + pcc, apiResponse, err = client.CrossConnectsApi.PccsFindById(ctx, id.(string)).Execute() logApiRequestTime(apiResponse) if err != nil { return diag.FromErr(fmt.Errorf("an error occurred while fetching the pcc with ID %s: %w", id.(string), err)) @@ -188,7 +187,7 @@ func dataSourcePccRead(ctx context.Context, d *schema.ResourceData, meta interfa if nameOk { /* search by name */ var pccs ionoscloud.PrivateCrossConnects - pccs, apiResponse, err := client.PrivateCrossConnectsApi.PccsGet(ctx).Depth(1).Execute() + pccs, apiResponse, err := client.CrossConnectsApi.PccsGet(ctx).Depth(1).Execute() logApiRequestTime(apiResponse) if err != nil { return diag.FromErr(fmt.Errorf("an error occurred while fetching pccs: %w", err)) @@ -197,9 +196,9 @@ func dataSourcePccRead(ctx context.Context, d *schema.ResourceData, meta interfa var results []ionoscloud.PrivateCrossConnect if pccs.Items != nil { - for _, p := range *pccs.Items { - if p.Properties != nil && p.Properties.Name != nil && *p.Properties.Name == name.(string) { - pcc, apiResponse, err = client.PrivateCrossConnectsApi.PccsFindById(ctx, *p.Id).Execute() + for _, p := range pccs.Items { + if p.Properties.Name != nil && *p.Properties.Name == name.(string) { + pcc, apiResponse, err = client.CrossConnectsApi.PccsFindById(ctx, *p.Id).Execute() logApiRequestTime(apiResponse) if err != nil { return diag.FromErr(fmt.Errorf("an error occurred while fetching the pcc with ID %s: %w", *p.Id, err)) diff --git a/ionoscloud/data_source_resource.go b/ionoscloud/data_source_resource.go index 0800b0275..09d8961c1 100644 --- a/ionoscloud/data_source_resource.go +++ b/ionoscloud/data_source_resource.go @@ -6,7 +6,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" ) @@ -64,7 +64,7 @@ func dataSourceResourceRead(ctx context.Context, d *schema.ResourceData, meta in if err != nil { return diag.FromErr(fmt.Errorf("an error occurred while fetching resources by type %w", err)) } - results = *items.Items + results = items.Items if len(results) > 0 && results[0].Type != nil { err = d.Set("resource_type", results[0].Type) if err != nil { @@ -79,7 +79,7 @@ func dataSourceResourceRead(ctx context.Context, d *schema.ResourceData, meta in if err != nil { return diag.FromErr(fmt.Errorf("an error occurred while fetching resources %w", err)) } - results = *items.Items + results = items.Items } if len(results) == 0 { diff --git a/ionoscloud/data_source_server.go b/ionoscloud/data_source_server.go index 13c8b716d..0f135e564 100644 --- a/ionoscloud/data_source_server.go +++ b/ionoscloud/data_source_server.go @@ -8,7 +8,8 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" + "github.com/ionos-cloud/sdk-go-bundle/shared" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/cloudapi/nsg" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" @@ -240,74 +241,72 @@ func setServerData(d *schema.ResourceData, server *ionoscloud.Server, token *ion } } - if server.Properties != nil { - if server.Properties.TemplateUuid != nil { - if err := d.Set("template_uuid", *server.Properties.TemplateUuid); err != nil { - return err - } + if server.Properties.TemplateUuid != nil { + if err := d.Set("template_uuid", *server.Properties.TemplateUuid); err != nil { + return err } + } - if server.Properties.Name != nil { - if err := d.Set("name", *server.Properties.Name); err != nil { - return err - } + if server.Properties.Name != nil { + if err := d.Set("name", *server.Properties.Name); err != nil { + return err } - if server.Properties.Hostname != nil { - if err := d.Set("hostname", *server.Properties.Hostname); err != nil { - return err - } + } + if server.Properties.Hostname != nil { + if err := d.Set("hostname", *server.Properties.Hostname); err != nil { + return err } - if server.Properties.Cores != nil { - if err := d.Set("cores", *server.Properties.Cores); err != nil { - return err - } + } + if server.Properties.Cores != nil { + if err := d.Set("cores", *server.Properties.Cores); err != nil { + return err } + } - if server.Properties.Ram != nil { - if err := d.Set("ram", *server.Properties.Ram); err != nil { - return err - } + if server.Properties.Ram != nil { + if err := d.Set("ram", *server.Properties.Ram); err != nil { + return err } + } - if server.Properties.Type != nil { - if err := d.Set("type", *server.Properties.Type); err != nil { - return err - } + if server.Properties.Type != nil { + if err := d.Set("type", *server.Properties.Type); err != nil { + return err } + } - if server.Properties.AvailabilityZone != nil { - if err := d.Set("availability_zone", *server.Properties.AvailabilityZone); err != nil { - return err - } + if server.Properties.AvailabilityZone != nil { + if err := d.Set("availability_zone", *server.Properties.AvailabilityZone); err != nil { + return err } + } - if server.Properties.VmState != nil { - if err := d.Set("vm_state", *server.Properties.VmState); err != nil { - return err - } + if server.Properties.VmState != nil { + if err := d.Set("vm_state", *server.Properties.VmState); err != nil { + return err } + } - if server.Properties.CpuFamily != nil { - if err := d.Set("cpu_family", *server.Properties.CpuFamily); err != nil { - return err - } + if server.Properties.CpuFamily != nil { + if err := d.Set("cpu_family", *server.Properties.CpuFamily); err != nil { + return err } - if server.Properties.BootCdrom != nil && server.Properties.BootCdrom.Id != nil { - if err := d.Set("boot_cdrom", *server.Properties.BootCdrom.Id); err != nil { - return err - } + } + if server.Properties.BootCdrom != nil { + if err := d.Set("boot_cdrom", server.Properties.BootCdrom.Id); err != nil { + return err } + } - if server.Properties.BootVolume != nil && server.Properties.BootVolume.Id != nil { - if err := d.Set("boot_volume", *server.Properties.BootVolume.Id); err != nil { - return err - } + if server.Properties.BootVolume != nil { + if err := d.Set("boot_volume", server.Properties.BootVolume.Id); err != nil { + return err } - if server.Entities != nil && server.Entities.Volumes != nil && server.Entities.Volumes.Items != nil && len(*server.Entities.Volumes.Items) > 0 && - (*server.Entities.Volumes.Items)[0].Properties.Image != nil { - if err := d.Set("boot_image", *(*server.Entities.Volumes.Items)[0].Properties.Image); err != nil { - return err - } + } + if server.Entities != nil && server.Entities.Volumes != nil && len(server.Entities.Volumes.Items) > 0 && + (server.Entities.Volumes.Items)[0].Properties.Image != nil { + if err := d.Set("boot_image", *(server.Entities.Volumes.Items)[0].Properties.Image); err != nil { + return err } } @@ -315,36 +314,36 @@ func setServerData(d *schema.ResourceData, server *ionoscloud.Server, token *ion return nil } - if server.Entities.Cdroms != nil && server.Entities.Cdroms.Items != nil && len(*server.Entities.Cdroms.Items) > 0 { - cdroms := setServerCDRoms(server.Entities.Cdroms.Items) + if server.Entities.Cdroms != nil && len(server.Entities.Cdroms.Items) > 0 { + cdroms := setServerCDRoms(&server.Entities.Cdroms.Items) if err := d.Set("cdroms", cdroms); err != nil { return err } } var volumes []interface{} - if server.Entities.Volumes != nil && server.Entities.Volumes.Items != nil && len(*server.Entities.Volumes.Items) > 0 { - for _, volume := range *server.Entities.Volumes.Items { + if server.Entities.Volumes != nil && len(server.Entities.Volumes.Items) > 0 { + for _, volume := range server.Entities.Volumes.Items { entry := make(map[string]interface{}) - entry["id"] = ionoscloud.ToValueDefault(volume.Id) - entry["name"] = ionoscloud.ToValueDefault(volume.Properties.Name) - entry["type"] = ionoscloud.ToValueDefault(volume.Properties.Type) - entry["size"] = float32OrDefault(volume.Properties.Size, 0) - entry["availability_zone"] = ionoscloud.ToValueDefault(volume.Properties.AvailabilityZone) - entry["image_name"] = ionoscloud.ToValueDefault(volume.Properties.Image) - entry["image_password"] = ionoscloud.ToValueDefault(volume.Properties.ImagePassword) + entry["id"] = shared.ToValueDefault(volume.Id) + entry["name"] = shared.ToValueDefault(volume.Properties.Name) + entry["type"] = shared.ToValueDefault(volume.Properties.Type) + entry["size"] = float32OrDefault(&volume.Properties.Size, 0) + entry["availability_zone"] = shared.ToValueDefault(volume.Properties.AvailabilityZone) + entry["image_name"] = shared.ToValueDefault(volume.Properties.Image) + entry["image_password"] = shared.ToValueDefault(volume.Properties.ImagePassword) - if volume.Properties.SshKeys != nil && len(*volume.Properties.SshKeys) > 0 { + if volume.Properties.SshKeys != nil && len(volume.Properties.SshKeys) > 0 { var sshKeys []interface{} - for _, sshKey := range *volume.Properties.SshKeys { + for _, sshKey := range volume.Properties.SshKeys { sshKeys = append(sshKeys, sshKey) } entry["ssh_keys"] = sshKeys } - entry["bus"] = ionoscloud.ToValueDefault(volume.Properties.Bus) - entry["licence_type"] = ionoscloud.ToValueDefault(volume.Properties.LicenceType) + entry["bus"] = shared.ToValueDefault(volume.Properties.Bus) + entry["licence_type"] = shared.ToValueDefault(volume.Properties.LicenceType) entry["cpu_hot_plug"] = boolOrDefault(volume.Properties.CpuHotPlug, true) entry["ram_hot_plug"] = boolOrDefault(volume.Properties.RamHotPlug, true) entry["nic_hot_plug"] = boolOrDefault(volume.Properties.NicHotPlug, true) @@ -353,9 +352,9 @@ func setServerData(d *schema.ResourceData, server *ionoscloud.Server, token *ion entry["disc_virtio_hot_unplug"] = boolOrDefault(volume.Properties.DiscVirtioHotUnplug, true) entry["device_number"] = int64OrDefault(volume.Properties.DeviceNumber, 0) entry["pci_slot"] = int32OrDefault(volume.Properties.PciSlot, 0) - entry["backup_unit_id"] = ionoscloud.ToValueDefault(volume.Properties.BackupunitId) - entry["user_data"] = ionoscloud.ToValueDefault(volume.Properties.UserData) - entry["boot_server"] = ionoscloud.ToValueDefault(volume.Properties.BootServer) + entry["backup_unit_id"] = shared.ToValueDefault(volume.Properties.BackupunitId) + entry["user_data"] = shared.ToValueDefault(volume.Properties.UserData) + entry["boot_server"] = shared.ToValueDefault(volume.Properties.BootServer) volumes = append(volumes, entry) } @@ -366,17 +365,17 @@ func setServerData(d *schema.ResourceData, server *ionoscloud.Server, token *ion } var nics []interface{} - if server.Entities.Nics != nil && server.Entities.Nics.Items != nil && len(*server.Entities.Nics.Items) > 0 { - for _, nic := range *server.Entities.Nics.Items { + if server.Entities.Nics != nil && len(server.Entities.Nics.Items) > 0 { + for _, nic := range server.Entities.Nics.Items { entry := make(map[string]interface{}) - entry["id"] = ionoscloud.ToValueDefault(nic.Id) - entry["name"] = ionoscloud.ToValueDefault(nic.Properties.Name) - entry["mac"] = ionoscloud.ToValueDefault(nic.Properties.Mac) + entry["id"] = shared.ToValueDefault(nic.Id) + entry["name"] = shared.ToValueDefault(nic.Properties.Name) + entry["mac"] = shared.ToValueDefault(nic.Properties.Mac) if nic.Properties.Ips != nil { var ips []interface{} - for _, ip := range *nic.Properties.Ips { + for _, ip := range nic.Properties.Ips { ips = append(ips, ip) } entry["ips"] = ips @@ -384,39 +383,37 @@ func setServerData(d *schema.ResourceData, server *ionoscloud.Server, token *ion if nic.Properties.Ipv6Ips != nil { var ipv6Ips []interface{} - for _, ip := range *nic.Properties.Ipv6Ips { + for _, ip := range nic.Properties.Ipv6Ips { ipv6Ips = append(ipv6Ips, ip) } entry["ipv6_ips"] = ipv6Ips } - entry["ipv6_cidr_block"] = ionoscloud.ToValueDefault(nic.Properties.Ipv6CidrBlock) - entry["dhcpv6"] = boolOrDefault(nic.Properties.Dhcpv6, false) + entry["ipv6_cidr_block"] = shared.ToValueDefault(&nic.Properties.Ipv6CidrBlock) + entry["dhcpv6"] = boolOrDefault(nic.Properties.Dhcpv6.Get(), false) entry["dhcp"] = boolOrDefault(nic.Properties.Dhcp, false) - entry["lan"] = int32OrDefault(nic.Properties.Lan, 0) + entry["lan"] = int32OrDefault(&nic.Properties.Lan, 0) entry["firewall_active"] = boolOrDefault(nic.Properties.FirewallActive, false) - entry["firewall_type"] = ionoscloud.ToValueDefault(nic.Properties.FirewallType) + entry["firewall_type"] = shared.ToValueDefault(nic.Properties.FirewallType) entry["device_number"] = int32OrDefault(nic.Properties.DeviceNumber, 0) entry["pci_slot"] = int32OrDefault(nic.Properties.PciSlot, 0) if nic.Entities != nil && nic.Entities.Firewallrules != nil && nic.Entities.Firewallrules.Items != nil { var firewallRules []interface{} - for _, rule := range *nic.Entities.Firewallrules.Items { + for _, rule := range nic.Entities.Firewallrules.Items { ruleEntry := make(map[string]interface{}) - ruleEntry["id"] = ionoscloud.ToValueDefault(rule.Id) - if rule.Properties != nil { - ruleEntry["name"] = ionoscloud.ToValueDefault(rule.Properties.Name) - ruleEntry["protocol"] = ionoscloud.ToValueDefault(rule.Properties.Protocol) - ruleEntry["source_mac"] = ionoscloud.ToValueDefault(rule.Properties.SourceMac) - ruleEntry["source_ip"] = ionoscloud.ToValueDefault(rule.Properties.SourceIp) - ruleEntry["target_ip"] = ionoscloud.ToValueDefault(rule.Properties.TargetIp) - ruleEntry["icmp_code"] = int32OrDefault(rule.Properties.IcmpCode, 0) - ruleEntry["icmp_type"] = int32OrDefault(rule.Properties.IcmpType, 0) - ruleEntry["port_range_start"] = int32OrDefault(rule.Properties.PortRangeStart, 0) - ruleEntry["port_range_end"] = int32OrDefault(rule.Properties.PortRangeEnd, 0) - ruleEntry["type"] = ionoscloud.ToValueDefault(rule.Properties.Type) - } + ruleEntry["id"] = shared.ToValueDefault(rule.Id) + ruleEntry["name"] = shared.ToValueDefault(rule.Properties.Name) + ruleEntry["protocol"] = shared.ToValueDefault(&rule.Properties.Protocol) + ruleEntry["source_mac"] = shared.ToValueDefault(&rule.Properties.SourceMac) + ruleEntry["source_ip"] = shared.ToValueDefault(&rule.Properties.SourceIp) + ruleEntry["target_ip"] = shared.ToValueDefault(&rule.Properties.TargetIp) + ruleEntry["icmp_code"] = int32OrDefault(rule.Properties.IcmpCode.Get(), 0) + ruleEntry["icmp_type"] = int32OrDefault(rule.Properties.IcmpType.Get(), 0) + ruleEntry["port_range_start"] = int32OrDefault(rule.Properties.PortRangeStart, 0) + ruleEntry["port_range_end"] = int32OrDefault(rule.Properties.PortRangeEnd, 0) + ruleEntry["type"] = shared.ToValueDefault(rule.Properties.Type) firewallRules = append(firewallRules, ruleEntry) } entry["firewall_rules"] = firewallRules @@ -424,7 +421,7 @@ func setServerData(d *schema.ResourceData, server *ionoscloud.Server, token *ion ids := make([]string, 0) if nic.Entities != nil && nic.Entities.Securitygroups != nil && nic.Entities.Securitygroups.Items != nil { - for _, group := range *nic.Entities.Securitygroups.Items { + for _, group := range nic.Entities.Securitygroups.Items { if group.Id != nil { id := *group.Id ids = append(ids, id) @@ -442,7 +439,7 @@ func setServerData(d *schema.ResourceData, server *ionoscloud.Server, token *ion } if server.Entities != nil && server.Entities.Securitygroups != nil && server.Entities.Securitygroups.Items != nil { - if err := nsg.SetNSGInResourceData(d, server.Entities.Securitygroups.Items); err != nil { + if err := nsg.SetNSGInResourceData(d, &server.Entities.Securitygroups.Items); err != nil { return err } } @@ -475,7 +472,7 @@ func dataSourceServerRead(ctx context.Context, d *schema.ResourceData, meta inte } var server ionoscloud.Server var err error - var apiResponse *ionoscloud.APIResponse + var apiResponse *shared.APIResponse if idOk { /* search by ID */ @@ -495,8 +492,8 @@ func dataSourceServerRead(ctx context.Context, d *schema.ResourceData, meta inte var results []ionoscloud.Server if servers.Items != nil { - for _, s := range *servers.Items { - if s.Properties != nil && s.Properties.Name != nil && *s.Properties.Name == name.(string) { + for _, s := range servers.Items { + if s.Properties.Name != nil && *s.Properties.Name == name.(string) { /* server found */ server, apiResponse, err = client.ServersApi.DatacentersServersFindById(ctx, datacenterId.(string), *s.Id).Depth(4).Execute() logApiRequestTime(apiResponse) diff --git a/ionoscloud/data_source_servers.go b/ionoscloud/data_source_servers.go index fa96b4776..0aaebd729 100644 --- a/ionoscloud/data_source_servers.go +++ b/ionoscloud/data_source_servers.go @@ -10,8 +10,9 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "github.com/iancoleman/strcase" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" + "github.com/ionos-cloud/sdk-go-bundle/shared" mongo "github.com/ionos-cloud/sdk-go-dbaas-mongo" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/cloudapi/cloudapinic" @@ -250,7 +251,7 @@ func dataSourceServersRead(ctx context.Context, d *schema.ResourceData, meta int } } var err error - var apiResponse *ionoscloud.APIResponse + var apiResponse *shared.APIResponse /* search by whatever filter is set above */ servers, apiResponse, err := req.Execute() @@ -264,16 +265,16 @@ func dataSourceServersRead(ctx context.Context, d *schema.ResourceData, meta int if d.Id() == "" { d.SetId(datacenterId.(string)) } - for _, server := range *servers.Items { + for _, server := range servers.Items { serverEntry = SetServerProperties(server) utils.SetPropWithNilCheck(serverEntry, "id", server.Id) // todo: Add token? if server.Entities != nil { if server.Entities.Nics != nil && server.Entities.Nics.Items != nil { nicItems := server.Entities.Nics.Items - if nicItems != nil && len(*nicItems) > 0 { + if len(nicItems) > 0 { var nics []interface{} - for _, nic := range *server.Entities.Nics.Items { + for _, nic := range server.Entities.Nics.Items { nicMap := cloudapinic.SetNetworkProperties(nic) fw := setFirewallRules(nic) nicMap["firewall_rules"] = fw @@ -286,14 +287,14 @@ func dataSourceServersRead(ctx context.Context, d *schema.ResourceData, meta int } } if server.Entities.Volumes != nil && server.Entities.Volumes.Items != nil { - volumes := setVolumePropertiesToSlice(*server.Entities.Volumes.Items) + volumes := setVolumePropertiesToSlice(server.Entities.Volumes.Items) if volumes != nil && len(volumes) > 0 { serverEntry["volumes"] = volumes } } if server.Entities.Cdroms != nil { - if server.Entities.Cdroms.Items != nil && len(*server.Entities.Cdroms.Items) > 0 { - cdroms := setServerCDRoms(server.Entities.Cdroms.Items) + if server.Entities.Cdroms.Items != nil && len(server.Entities.Cdroms.Items) > 0 { + cdroms := setServerCDRoms(&server.Entities.Cdroms.Items) if cdroms != nil && len(cdroms) > 0 { serverEntry["cdroms"] = cdroms } @@ -340,7 +341,7 @@ func setVolumePropertiesToSlice(volumesList []ionoscloud.Volume) []interface{} { func setFirewallRules(nic ionoscloud.Nic) []interface{} { var firewallRules []interface{} if nic.Entities != nil && nic.Entities.Firewallrules != nil && nic.Entities.Firewallrules.Items != nil { - for _, rule := range *nic.Entities.Firewallrules.Items { + for _, rule := range nic.Entities.Firewallrules.Items { ruleEntry := setFirewallRuleProperties(rule) firewallRules = append(firewallRules, ruleEntry) } @@ -351,44 +352,40 @@ func setFirewallRules(nic ionoscloud.Nic) []interface{} { func setFirewallRuleProperties(rule ionoscloud.FirewallRule) map[string]interface{} { ruleEntry := make(map[string]interface{}) ruleEntry["id"] = mongo.ToValueDefault(rule.Id) - if rule.Properties != nil { - ruleEntry["name"] = mongo.ToValueDefault(rule.Properties.Name) - ruleEntry["protocol"] = mongo.ToValueDefault(rule.Properties.Protocol) - ruleEntry["source_mac"] = mongo.ToValueDefault(rule.Properties.SourceMac) - ruleEntry["source_ip"] = mongo.ToValueDefault(rule.Properties.SourceIp) - ruleEntry["target_ip"] = mongo.ToValueDefault(rule.Properties.TargetIp) - ruleEntry["icmp_code"] = int32OrDefault(rule.Properties.IcmpCode, 0) - ruleEntry["icmp_type"] = int32OrDefault(rule.Properties.IcmpType, 0) - ruleEntry["port_range_start"] = int32OrDefault(rule.Properties.PortRangeStart, 0) - ruleEntry["port_range_end"] = int32OrDefault(rule.Properties.PortRangeEnd, 0) - ruleEntry["type"] = mongo.ToValueDefault(rule.Properties.Type) - } + ruleEntry["name"] = mongo.ToValueDefault(rule.Properties.Name) + ruleEntry["protocol"] = mongo.ToValueDefault(&rule.Properties.Protocol) + ruleEntry["source_mac"] = mongo.ToValueDefault(&rule.Properties.SourceMac) + ruleEntry["source_ip"] = mongo.ToValueDefault(&rule.Properties.SourceIp) + ruleEntry["target_ip"] = mongo.ToValueDefault(&rule.Properties.TargetIp) + ruleEntry["icmp_code"] = int32OrDefault(rule.Properties.IcmpCode.Get(), 0) + ruleEntry["icmp_type"] = int32OrDefault(rule.Properties.IcmpType.Get(), 0) + ruleEntry["port_range_start"] = int32OrDefault(rule.Properties.PortRangeStart, 0) + ruleEntry["port_range_end"] = int32OrDefault(rule.Properties.PortRangeEnd, 0) + ruleEntry["type"] = mongo.ToValueDefault(rule.Properties.Type) return ruleEntry } func SetServerProperties(server ionoscloud.Server) map[string]interface{} { serverMap := map[string]interface{}{} - if server.Properties != nil { - utils.SetPropWithNilCheck(serverMap, "template_uuid", server.Properties.TemplateUuid) - utils.SetPropWithNilCheck(serverMap, "name", server.Properties.Name) - utils.SetPropWithNilCheck(serverMap, "hostname", server.Properties.Hostname) - utils.SetPropWithNilCheck(serverMap, "cores", server.Properties.Cores) - utils.SetPropWithNilCheck(serverMap, "ram", server.Properties.Ram) - utils.SetPropWithNilCheck(serverMap, "availability_zone", server.Properties.AvailabilityZone) - utils.SetPropWithNilCheck(serverMap, "cpu_family", server.Properties.CpuFamily) - utils.SetPropWithNilCheck(serverMap, "type", server.Properties.Type) - if server.Properties.BootCdrom != nil && server.Properties.BootCdrom.Id != nil { - utils.SetPropWithNilCheck(serverMap, "boot_cdrom", *server.Properties.BootCdrom.Id) - } + utils.SetPropWithNilCheck(serverMap, "template_uuid", server.Properties.TemplateUuid) + utils.SetPropWithNilCheck(serverMap, "name", server.Properties.Name) + utils.SetPropWithNilCheck(serverMap, "hostname", server.Properties.Hostname) + utils.SetPropWithNilCheck(serverMap, "cores", server.Properties.Cores) + utils.SetPropWithNilCheck(serverMap, "ram", server.Properties.Ram) + utils.SetPropWithNilCheck(serverMap, "availability_zone", server.Properties.AvailabilityZone) + utils.SetPropWithNilCheck(serverMap, "cpu_family", server.Properties.CpuFamily) + utils.SetPropWithNilCheck(serverMap, "type", server.Properties.Type) + if server.Properties.BootCdrom != nil { + utils.SetPropWithNilCheck(serverMap, "boot_cdrom", server.Properties.BootCdrom.Id) + } - if server.Properties.BootVolume != nil && server.Properties.BootVolume.Id != nil { - utils.SetPropWithNilCheck(serverMap, "boot_volume", *server.Properties.BootVolume.Id) + if server.Properties.BootVolume != nil { + utils.SetPropWithNilCheck(serverMap, "boot_volume", server.Properties.BootVolume.Id) - } - if server.Entities != nil && server.Entities.Volumes != nil && server.Entities.Volumes.Items != nil && len(*server.Entities.Volumes.Items) > 0 && - (*server.Entities.Volumes.Items)[0].Properties.Image != nil { - utils.SetPropWithNilCheck(serverMap, "boot_image", (*server.Entities.Volumes.Items)[0].Properties.Image) - } + } + if server.Entities != nil && server.Entities.Volumes != nil && server.Entities.Volumes.Items != nil && len(server.Entities.Volumes.Items) > 0 && + (server.Entities.Volumes.Items)[0].Properties.Image != nil { + utils.SetPropWithNilCheck(serverMap, "boot_image", (server.Entities.Volumes.Items)[0].Properties.Image) } return serverMap } @@ -413,13 +410,13 @@ func setServerCDRoms(images *[]ionoscloud.Image) []interface{} { entry["disc_virtio_hot_unplug"] = boolOrDefault(image.Properties.DiscVirtioHotUnplug, true) entry["disc_scsi_hot_plug"] = boolOrDefault(image.Properties.DiscScsiHotPlug, true) entry["disc_scsi_hot_unplug"] = boolOrDefault(image.Properties.DiscScsiHotUnplug, true) - entry["licence_type"] = mongo.ToValueDefault(image.Properties.LicenceType) + entry["licence_type"] = mongo.ToValueDefault(&image.Properties.LicenceType) entry["image_type"] = mongo.ToValueDefault(image.Properties.ImageType) entry["public"] = boolOrDefault(image.Properties.Public, false) if image.Properties.ImageAliases != nil { var imageAliases []interface{} - for _, imageAlias := range *image.Properties.ImageAliases { + for _, imageAlias := range image.Properties.ImageAliases { imageAliases = append(imageAliases, imageAlias) } entry["image_aliases"] = imageAliases diff --git a/ionoscloud/data_source_share.go b/ionoscloud/data_source_share.go index c22c17aa2..c6ba62fa8 100644 --- a/ionoscloud/data_source_share.go +++ b/ionoscloud/data_source_share.go @@ -53,9 +53,6 @@ func dataSourceShareRead(ctx context.Context, d *schema.ResourceData, meta inter } return diag.FromErr(fmt.Errorf("an error occurred while fetching a share with group_id %s resource_id %s %w", groupID, resourceID, err)) } - if rsp.Properties == nil { - return diag.FromErr(fmt.Errorf("no properties found in the response")) - } d.SetId(*rsp.Id) if err := d.Set("edit_privilege", *rsp.Properties.EditPrivilege); err != nil { return diag.FromErr(utils.GenerateSetError("share", "edit_privilege", err)) diff --git a/ionoscloud/data_source_snapshot.go b/ionoscloud/data_source_snapshot.go index 6196f6839..44156cdd7 100644 --- a/ionoscloud/data_source_snapshot.go +++ b/ionoscloud/data_source_snapshot.go @@ -7,7 +7,8 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" + "github.com/ionos-cloud/sdk-go-bundle/shared" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" ) @@ -116,7 +117,7 @@ func dataSourceSnapshotRead(ctx context.Context, d *schema.ResourceData, meta in var snapshot ionoscloud.Snapshot var err error - var apiResponse *ionoscloud.APIResponse + var apiResponse *shared.APIResponse if idOk { /* search by ID */ @@ -138,8 +139,8 @@ func dataSourceSnapshotRead(ctx context.Context, d *schema.ResourceData, meta in } if snapshots.Items != nil { - for _, snp := range *snapshots.Items { - if snp.Properties != nil && snp.Properties.Name != nil && *snp.Properties.Name == name.(string) { + for _, snp := range snapshots.Items { + if snp.Properties.Name != nil && *snp.Properties.Name == name.(string) { results = append(results, snp) } } @@ -159,7 +160,7 @@ func dataSourceSnapshotRead(ctx context.Context, d *schema.ResourceData, meta in if sizeOk { var sizeResults []ionoscloud.Snapshot for _, snp := range results { - if snp.Properties != nil && snp.Properties.Size != nil && *snp.Properties.Size == float32(size.(int)) { + if snp.Properties.Size != nil && *snp.Properties.Size == float32(size.(int)) { sizeResults = append(sizeResults, snp) } diff --git a/ionoscloud/data_source_target_group.go b/ionoscloud/data_source_target_group.go index 127e924a0..7ef9f24d2 100644 --- a/ionoscloud/data_source_target_group.go +++ b/ionoscloud/data_source_target_group.go @@ -7,12 +7,13 @@ import ( "log" "strings" + "github.com/ionos-cloud/sdk-go-bundle/shared" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/utils/constant" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" ) func dataSourceTargetGroup() *schema.Resource { @@ -172,7 +173,7 @@ func dataSourceTargetGroupRead(ctx context.Context, d *schema.ResourceData, meta } var targetGroup ionoscloud.TargetGroup var err error - var apiResponse *ionoscloud.APIResponse + var apiResponse *shared.APIResponse if idOk { /* search by ID */ @@ -199,7 +200,7 @@ func dataSourceTargetGroupRead(ctx context.Context, d *schema.ResourceData, meta return diag.FromErr(fmt.Errorf("an error occurred while fetching target groups: %w", err)) } - results = *targetGroups.Items + results = targetGroups.Items } else { targetGroups, apiResponse, err := client.TargetGroupsApi.TargetgroupsGet(ctx).Depth(1).Limit(constant.TargetGroupLimit).Execute() logApiRequestTime(apiResponse) @@ -209,8 +210,8 @@ func dataSourceTargetGroupRead(ctx context.Context, d *schema.ResourceData, meta } if targetGroups.Items != nil { - for _, t := range *targetGroups.Items { - if t.Properties.Name != nil && strings.EqualFold(*t.Properties.Name, name) { + for _, t := range targetGroups.Items { + if strings.EqualFold(t.Properties.Name, name) { tmpTargetGroup, apiResponse, err := client.TargetGroupsApi.TargetgroupsFindByTargetGroupId(ctx, *t.Id).Execute() logApiRequestTime(apiResponse) if err != nil { diff --git a/ionoscloud/data_source_template.go b/ionoscloud/data_source_template.go index f49ed54d2..ac5f6dfc2 100644 --- a/ionoscloud/data_source_template.go +++ b/ionoscloud/data_source_template.go @@ -9,7 +9,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" ) func dataSourceTemplate() *schema.Resource { @@ -64,13 +64,13 @@ func dataSourceTemplateRead(ctx context.Context, d *schema.ResourceData, meta in var results []ionoscloud.Template if nameOk && templates.Items != nil { - for _, tmp := range *templates.Items { - if strings.Contains(strings.ToLower(*tmp.Properties.Name), strings.ToLower(name.(string))) { + for _, tmp := range templates.Items { + if strings.Contains(strings.ToLower(tmp.Properties.Name), strings.ToLower(name.(string))) { results = append(results, tmp) } } } else if templates.Items != nil { - results = *templates.Items + results = templates.Items } if coresOk { @@ -78,7 +78,7 @@ func dataSourceTemplateRead(ctx context.Context, d *schema.ResourceData, meta in if results != nil { var coresResults []ionoscloud.Template for _, tmp := range results { - if tmp.Properties.Cores != nil && *tmp.Properties.Cores == cores { + if tmp.Properties.Cores == cores { coresResults = append(coresResults, tmp) } } @@ -91,7 +91,7 @@ func dataSourceTemplateRead(ctx context.Context, d *schema.ResourceData, meta in if results != nil { var ramResults []ionoscloud.Template for _, tmp := range results { - if tmp.Properties.Ram != nil && *tmp.Properties.Ram == ram { + if tmp.Properties.Ram == ram { ramResults = append(ramResults, tmp) } } @@ -104,7 +104,7 @@ func dataSourceTemplateRead(ctx context.Context, d *schema.ResourceData, meta in if results != nil { var storageSizeResults []ionoscloud.Template for _, tmp := range results { - if tmp.Properties != nil && tmp.Properties.StorageSize != nil && *tmp.Properties.StorageSize == storageSize { + if tmp.Properties.StorageSize == storageSize { storageSizeResults = append(storageSizeResults, tmp) } } @@ -132,30 +132,19 @@ func dataSourceTemplateRead(ctx context.Context, d *schema.ResourceData, meta in func setTemplateData(d *schema.ResourceData, template *ionoscloud.Template) error { d.SetId(*template.Id) - if template.Properties != nil { - if template.Properties.Name != nil { - err := d.Set("name", *template.Properties.Name) - if err != nil { - return fmt.Errorf("error while setting name property for image %s: %w", d.Id(), err) - } - } - - if template.Properties.Cores != nil { - if err := d.Set("cores", *template.Properties.Cores); err != nil { - return err - } - } - if template.Properties.Ram != nil { - if err := d.Set("ram", *template.Properties.Ram); err != nil { - return err - } - } - if template.Properties.StorageSize != nil { - if err := d.Set("storage_size", *template.Properties.StorageSize); err != nil { - return err - } - } + err := d.Set("name", template.Properties.Name) + if err != nil { + return fmt.Errorf("error while setting name property for image %s: %w", d.Id(), err) + } + if err := d.Set("cores", template.Properties.Cores); err != nil { + return err + } + if err := d.Set("ram", template.Properties.Ram); err != nil { + return err + } + if err := d.Set("storage_size", template.Properties.StorageSize); err != nil { + return err } return nil diff --git a/ionoscloud/data_source_user.go b/ionoscloud/data_source_user.go index 8c843f6c5..5e504ad8f 100644 --- a/ionoscloud/data_source_user.go +++ b/ionoscloud/data_source_user.go @@ -6,12 +6,13 @@ import ( "fmt" "log" + "github.com/ionos-cloud/sdk-go-bundle/shared" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" ) func dataSourceUser() *schema.Resource { @@ -102,7 +103,7 @@ func dataSourceUserRead(ctx context.Context, d *schema.ResourceData, meta interf } var user ionoscloud.User var err error - var apiResponse *ionoscloud.APIResponse + var apiResponse *shared.APIResponse if idOk { /* search by ID */ @@ -120,12 +121,12 @@ func dataSourceUserRead(ctx context.Context, d *schema.ResourceData, meta interf diags := diag.FromErr(fmt.Errorf("an error occurred while fetching users: %w", err)) return diags } - if users.Items == nil || len(*users.Items) == 0 { + if len(users.Items) == 0 { return diag.FromErr(fmt.Errorf("no user found with the specified criteria: email = %s", email)) - } else if len(*users.Items) > 1 { + } else if len(users.Items) > 1 { return diag.FromErr(fmt.Errorf("multiple users found with the specified criteria: email = %s", email)) } - user = (*users.Items)[0] + user = (users.Items)[0] } if err = setUsersForGroup(ctx, d, &user, *client); err != nil { return diag.FromErr(err) @@ -150,9 +151,9 @@ func setUsersForGroup(ctx context.Context, d *schema.ResourceData, user *ionoscl } groupEntries := make([]interface{}, 0) - if groups.Items != nil && len(*groups.Items) > 0 { - groupEntries = make([]interface{}, len(*groups.Items)) - for groupIndex, group := range *groups.Items { + if len(groups.Items) > 0 { + groupEntries = make([]interface{}, len(groups.Items)) + for groupIndex, group := range groups.Items { groupEntry := make(map[string]interface{}) if group.Id != nil { diff --git a/ionoscloud/data_source_volume.go b/ionoscloud/data_source_volume.go index c520c3aa2..a64265957 100644 --- a/ionoscloud/data_source_volume.go +++ b/ionoscloud/data_source_volume.go @@ -7,7 +7,8 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" + "github.com/ionos-cloud/sdk-go-bundle/shared" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" ) @@ -129,7 +130,7 @@ func dataSourceVolumeRead(ctx context.Context, d *schema.ResourceData, meta inte } var volume ionoscloud.Volume var err error - var apiResponse *ionoscloud.APIResponse + var apiResponse *shared.APIResponse if idOk { /* search by ID */ @@ -153,8 +154,8 @@ func dataSourceVolumeRead(ctx context.Context, d *schema.ResourceData, meta inte var results []ionoscloud.Volume if volumes.Items != nil { - for _, v := range *volumes.Items { - if v.Properties != nil && v.Properties.Name != nil && *v.Properties.Name == name.(string) { + for _, v := range volumes.Items { + if v.Properties.Name != nil && *v.Properties.Name == name.(string) { /* volume found */ volume, apiResponse, err = client.VolumesApi.DatacentersVolumesFindById(ctx, datacenterId.(string), *v.Id).Execute() logApiRequestTime(apiResponse) diff --git a/ionoscloud/import_certificate_manager_certificate_test.go b/ionoscloud/import_certificate_manager_certificate_test.go index c0347567b..2e7de029f 100644 --- a/ionoscloud/import_certificate_manager_certificate_test.go +++ b/ionoscloud/import_certificate_manager_certificate_test.go @@ -1,4 +1,4 @@ -//go:build compute || all || cert +//go:build all || cert package ionoscloud diff --git a/ionoscloud/import_certificate_manager_provider_test.go b/ionoscloud/import_certificate_manager_provider_test.go index 7aa3d74ff..5425ff434 100644 --- a/ionoscloud/import_certificate_manager_provider_test.go +++ b/ionoscloud/import_certificate_manager_provider_test.go @@ -1,4 +1,4 @@ -//go:build compute || all || cert +//go:build all || cert package ionoscloud diff --git a/ionoscloud/labels_service.go b/ionoscloud/labels_service.go index 8a18aaad1..5456b41af 100644 --- a/ionoscloud/labels_service.go +++ b/ionoscloud/labels_service.go @@ -9,7 +9,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" ) var labelResource = &schema.Resource{ @@ -71,7 +71,7 @@ func (ls *LabelsService) datacentersServersLabelsCreate(datacenterId, serverId s labelKey := label["key"].(string) labelValue := label["value"].(string) labelResource := ionoscloud.LabelResource{ - Properties: &ionoscloud.LabelResourceProperties{Key: &labelKey, Value: &labelValue}, + Properties: ionoscloud.LabelResourceProperties{Key: &labelKey, Value: &labelValue}, } _, apiResponse, err := ls.client.LabelsApi.DatacentersServersLabelsPost(ls.ctx, datacenterId, serverId).Label(labelResource).Execute() apiResponse.LogInfo() @@ -110,10 +110,10 @@ func processLabelsData(labelsData ionoscloud.LabelResources, isDataSource bool) if labelsData.Items == nil { return nil, errors.New("expected a list of labels from the API but received nil instead") } - labels := make([]Label, 0, len(*labelsData.Items)) - for _, labelData := range *labelsData.Items { + labels := make([]Label, 0, len(labelsData.Items)) + for _, labelData := range labelsData.Items { entry := make(Label) - if labelData.Properties == nil || labelData.Properties.Key == nil || labelData.Properties.Value == nil { + if labelData.Properties.Key == nil || labelData.Properties.Value == nil { return nil, errors.New("expected valid label properties from the API but received nil instead") } entry["key"] = *labelData.Properties.Key diff --git a/ionoscloud/provider.go b/ionoscloud/provider.go index 0c9394315..b16dd0023 100644 --- a/ionoscloud/provider.go +++ b/ionoscloud/provider.go @@ -14,7 +14,8 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/meta" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" + "github.com/ionos-cloud/sdk-go-bundle/shared" nfsService "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/nfs" @@ -55,25 +56,25 @@ func Provider() *schema.Provider { "username": { Type: schema.TypeString, Optional: true, - DefaultFunc: schema.EnvDefaultFunc(ionoscloud.IonosUsernameEnvVar, nil), + DefaultFunc: schema.EnvDefaultFunc(shared.IonosUsernameEnvVar, nil), Description: "IonosCloud username for API operations. If token is provided, token is preferred", }, "password": { Type: schema.TypeString, Optional: true, - DefaultFunc: schema.EnvDefaultFunc(ionoscloud.IonosPasswordEnvVar, nil), + DefaultFunc: schema.EnvDefaultFunc(shared.IonosPasswordEnvVar, nil), Description: "IonosCloud password for API operations. If token is provided, token is preferred", }, "token": { Type: schema.TypeString, Optional: true, - DefaultFunc: schema.EnvDefaultFunc(ionoscloud.IonosTokenEnvVar, nil), + DefaultFunc: schema.EnvDefaultFunc(shared.IonosTokenEnvVar, nil), Description: "IonosCloud bearer token for API operations.", }, "endpoint": { Type: schema.TypeString, Optional: true, - DefaultFunc: schema.EnvDefaultFunc(ionoscloud.IonosApiUrlEnvVar, ""), + DefaultFunc: schema.EnvDefaultFunc(shared.IonosApiUrlEnvVar, ""), Description: "IonosCloud REST API URL. Usually not necessary to be set, SDKs know internally how to route requests to the API.", }, "retries": { @@ -300,7 +301,8 @@ func providerConfigure(d *schema.ResourceData, terraformVersion string) (interfa if contractNumber, contractOk := d.GetOk("contract_number"); contractOk { // will inject x-contract-number to sdks - if err := os.Setenv(ionoscloud.IonosContractNumber, contractNumber.(string)); err != nil { + // TODO - Use constant here + if err := os.Setenv("IONOS_CONTRACT_NUMBER", contractNumber.(string)); err != nil { return nil, diag.FromErr(err) } } @@ -368,18 +370,15 @@ func NewClientByType(clientOpts ClientOptions, clientType clientType) interface{ switch clientType { case ionosClient: { - newConfig := ionoscloud.NewConfiguration(clientOpts.Username, clientOpts.Password, clientOpts.Token, clientOpts.Url) + newConfig := shared.NewConfiguration(clientOpts.Username, clientOpts.Password, clientOpts.Token, clientOpts.Url) newConfig.UserAgent = fmt.Sprintf( "terraform-provider/%s_ionos-cloud-sdk-go/%s_hashicorp-terraform/%s_terraform-plugin-sdk/%s_os/%s_arch/%s", Version, ionoscloud.Version, clientOpts.TerraformVersion, meta.SDKVersionString(), runtime.GOOS, runtime.GOARCH, //nolint:staticcheck ) - if os.Getenv(constant.IonosDebug) != "" { - newConfig.Debug = true - } newConfig.MaxRetries = constant.MaxRetries newConfig.WaitTime = constant.MaxWaitTime - newConfig.HTTPClient = &http.Client{Transport: utils.CreateTransport(clientOpts.Insecure)} client := ionoscloud.NewAPIClient(newConfig) + client.GetConfig().HTTPClient = &http.Client{Transport: utils.CreateTransport(clientOpts.Insecure)} return client } case cdnClient: diff --git a/ionoscloud/provider_test.go b/ionoscloud/provider_test.go index 2d10c0ba4..19db53a5b 100644 --- a/ionoscloud/provider_test.go +++ b/ionoscloud/provider_test.go @@ -2,6 +2,7 @@ package ionoscloud import ( "context" + "github.com/ionos-cloud/sdk-go-bundle/shared" "os" "testing" @@ -17,8 +18,6 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" "github.com/hashicorp/terraform-plugin-testing/helper/resource" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -121,12 +120,12 @@ func testAccProtoV6ProviderFactoriesInternal(t *testing.T, v **schema.Provider) } func testAccPreCheck(t *testing.T) { - pbUsername := os.Getenv(ionoscloud.IonosUsernameEnvVar) - pbPassword := os.Getenv(ionoscloud.IonosPasswordEnvVar) - pbToken := os.Getenv(ionoscloud.IonosTokenEnvVar) + pbUsername := os.Getenv(shared.IonosUsernameEnvVar) + pbPassword := os.Getenv(shared.IonosPasswordEnvVar) + pbToken := os.Getenv(shared.IonosTokenEnvVar) if pbToken == "" { if pbUsername == "" || pbPassword == "" { - t.Fatalf("%s/%s or %s must be set for acceptance tests", ionoscloud.IonosUsernameEnvVar, ionoscloud.IonosPasswordEnvVar, ionoscloud.IonosTokenEnvVar) + t.Fatalf("%s/%s or %s must be set for acceptance tests", shared.IonosUsernameEnvVar, shared.IonosPasswordEnvVar, shared.IonosTokenEnvVar) } } diff --git a/ionoscloud/resource_application_loadbalancer.go b/ionoscloud/resource_application_loadbalancer.go index ea8cdd185..025d20c0f 100644 --- a/ionoscloud/resource_application_loadbalancer.go +++ b/ionoscloud/resource_application_loadbalancer.go @@ -9,7 +9,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/cloudapi" @@ -95,12 +95,12 @@ func resourceApplicationLoadBalancerCreate(ctx context.Context, d *schema.Resour client := meta.(services.SdkBundle).CloudApiClient applicationLoadBalancer := ionoscloud.ApplicationLoadBalancer{ - Properties: &ionoscloud.ApplicationLoadBalancerProperties{}, + Properties: ionoscloud.ApplicationLoadBalancerProperties{}, } if name, nameOk := d.GetOk("name"); nameOk { name := name.(string) - applicationLoadBalancer.Properties.Name = &name + applicationLoadBalancer.Properties.Name = name } else { diags := diag.FromErr(fmt.Errorf("name must be provided for application loadbalancer")) return diags @@ -108,7 +108,7 @@ func resourceApplicationLoadBalancerCreate(ctx context.Context, d *schema.Resour if listenerLan, listenerLanOk := d.GetOk("listener_lan"); listenerLanOk { listener := int32(listenerLan.(int)) - applicationLoadBalancer.Properties.ListenerLan = &listener + applicationLoadBalancer.Properties.ListenerLan = listener } else { diags := diag.FromErr(fmt.Errorf("listener_lan must be provided for application loadbalancer")) return diags @@ -132,14 +132,14 @@ func resourceApplicationLoadBalancerCreate(ctx context.Context, d *schema.Resour ips = append(ips, value.(string)) } if len(ips) > 0 { - applicationLoadBalancer.Properties.Ips = &ips + applicationLoadBalancer.Properties.Ips = ips } } } if targetLan, targetLanOk := d.GetOk("target_lan"); targetLanOk { targetLan := int32(targetLan.(int)) - applicationLoadBalancer.Properties.TargetLan = &targetLan + applicationLoadBalancer.Properties.TargetLan = targetLan } else { diags := diag.FromErr(fmt.Errorf("target_lan must be provided for application loadbalancer")) return diags @@ -153,7 +153,7 @@ func resourceApplicationLoadBalancerCreate(ctx context.Context, d *schema.Resour privateIps = append(privateIps, value.(string)) } if len(privateIps) > 0 { - applicationLoadBalancer.Properties.LbPrivateIps = &privateIps + applicationLoadBalancer.Properties.LbPrivateIps = privateIps } } } @@ -243,7 +243,7 @@ func resourceApplicationLoadBalancerUpdate(ctx context.Context, d *schema.Resour client := meta.(services.SdkBundle).CloudApiClient request := ionoscloud.ApplicationLoadBalancer{ - Properties: &ionoscloud.ApplicationLoadBalancerProperties{}, + Properties: ionoscloud.ApplicationLoadBalancerProperties{}, } dcId := d.Get("datacenter_id").(string) @@ -251,13 +251,13 @@ func resourceApplicationLoadBalancerUpdate(ctx context.Context, d *schema.Resour if d.HasChange("name") { _, v := d.GetChange("name") vStr := v.(string) - request.Properties.Name = &vStr + request.Properties.Name = vStr } if d.HasChange("listener_lan") { _, v := d.GetChange("listener_lan") vInt := int32(v.(int)) - request.Properties.ListenerLan = &vInt + request.Properties.ListenerLan = vInt } if d.HasChange("ips") { @@ -269,7 +269,7 @@ func resourceApplicationLoadBalancerUpdate(ctx context.Context, d *schema.Resour ips = append(ips, value.(string)) } } - request.Properties.Ips = &ips + request.Properties.Ips = ips } if d.HasChange("central_logging") { @@ -287,7 +287,7 @@ func resourceApplicationLoadBalancerUpdate(ctx context.Context, d *schema.Resour if d.HasChange("target_lan") { _, v := d.GetChange("target_lan") vInt := int32(v.(int)) - request.Properties.TargetLan = &vInt + request.Properties.TargetLan = vInt } if d.HasChange("lb_private_ips") { @@ -300,7 +300,7 @@ func resourceApplicationLoadBalancerUpdate(ctx context.Context, d *schema.Resour privateIps = append(privateIps, value.(string)) } } - request.Properties.LbPrivateIps = &privateIps + request.Properties.LbPrivateIps = privateIps } if d.HasChange("flowlog") { @@ -331,7 +331,7 @@ func resourceApplicationLoadBalancerUpdate(ctx context.Context, d *schema.Resour } } } - _, apiResponse, err := client.ApplicationLoadBalancersApi.DatacentersApplicationloadbalancersPatch(ctx, dcId, d.Id()).ApplicationLoadBalancerProperties(*request.Properties).Execute() + _, apiResponse, err := client.ApplicationLoadBalancersApi.DatacentersApplicationloadbalancersPatch(ctx, dcId, d.Id()).ApplicationLoadBalancerProperties(request.Properties).Execute() logApiRequestTime(apiResponse) if err != nil { @@ -416,54 +416,46 @@ func setApplicationLoadBalancerData(d *schema.ResourceData, applicationLoadBalan d.SetId(*applicationLoadBalancer.Id) } - if applicationLoadBalancer.Properties != nil { - if applicationLoadBalancer.Properties.Name != nil { - err := d.Set("name", *applicationLoadBalancer.Properties.Name) - if err != nil { - return fmt.Errorf("error while setting name property for application loadbalancer %s: %w", d.Id(), err) - } - } + err := d.Set("name", applicationLoadBalancer.Properties.Name) + if err != nil { + return fmt.Errorf("error while setting name property for application loadbalancer %s: %w", d.Id(), err) + } - if applicationLoadBalancer.Properties.ListenerLan != nil { - err := d.Set("listener_lan", *applicationLoadBalancer.Properties.ListenerLan) - if err != nil { - return fmt.Errorf("error while setting listener_lan property for application loadbalancer %s: %w", d.Id(), err) - } - } + err = d.Set("listener_lan", applicationLoadBalancer.Properties.ListenerLan) + if err != nil { + return fmt.Errorf("error while setting listener_lan property for application loadbalancer %s: %w", d.Id(), err) + } - if applicationLoadBalancer.Properties.Ips != nil { - err := d.Set("ips", *applicationLoadBalancer.Properties.Ips) - if err != nil { - return fmt.Errorf("error while setting ips property for application loadbalancer %s: %w", d.Id(), err) - } + if applicationLoadBalancer.Properties.Ips != nil { + err := d.Set("ips", applicationLoadBalancer.Properties.Ips) + if err != nil { + return fmt.Errorf("error while setting ips property for application loadbalancer %s: %w", d.Id(), err) } + } - if applicationLoadBalancer.Properties.TargetLan != nil { - err := d.Set("target_lan", *applicationLoadBalancer.Properties.TargetLan) - if err != nil { - return fmt.Errorf("error while setting target_lan property for application loadbalancer %s: %w", d.Id(), err) - } - } + err = d.Set("target_lan", applicationLoadBalancer.Properties.TargetLan) + if err != nil { + return fmt.Errorf("error while setting target_lan property for application loadbalancer %s: %w", d.Id(), err) + } - if applicationLoadBalancer.Properties.LbPrivateIps != nil { - err := d.Set("lb_private_ips", *applicationLoadBalancer.Properties.LbPrivateIps) - if err != nil { - return fmt.Errorf("error while setting lb_private_ips property for application loadbalancer %s: %w", d.Id(), err) - } + if applicationLoadBalancer.Properties.LbPrivateIps != nil { + err := d.Set("lb_private_ips", applicationLoadBalancer.Properties.LbPrivateIps) + if err != nil { + return fmt.Errorf("error while setting lb_private_ips property for application loadbalancer %s: %w", d.Id(), err) } + } - if applicationLoadBalancer.Properties.CentralLogging != nil { - err := d.Set("central_logging", *applicationLoadBalancer.Properties.CentralLogging) - if err != nil { - return fmt.Errorf("error while setting central_logging property for network load balancer %s: %w", d.Id(), err) - } + if applicationLoadBalancer.Properties.CentralLogging != nil { + err := d.Set("central_logging", *applicationLoadBalancer.Properties.CentralLogging) + if err != nil { + return fmt.Errorf("error while setting central_logging property for network load balancer %s: %w", d.Id(), err) } + } - if applicationLoadBalancer.Properties.LoggingFormat != nil { - err := d.Set("logging_format", *applicationLoadBalancer.Properties.LoggingFormat) - if err != nil { - return fmt.Errorf("error while setting logging_format property for network load balancer %s: %w", d.Id(), err) - } + if applicationLoadBalancer.Properties.LoggingFormat != nil { + err := d.Set("logging_format", *applicationLoadBalancer.Properties.LoggingFormat) + if err != nil { + return fmt.Errorf("error while setting logging_format property for network load balancer %s: %w", d.Id(), err) } } diff --git a/ionoscloud/resource_application_loadbalancer_forwardingrule.go b/ionoscloud/resource_application_loadbalancer_forwardingrule.go index cba20a2fb..23d6a74d4 100644 --- a/ionoscloud/resource_application_loadbalancer_forwardingrule.go +++ b/ionoscloud/resource_application_loadbalancer_forwardingrule.go @@ -9,7 +9,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/cloudapi" @@ -180,27 +180,27 @@ func resourceApplicationLoadBalancerForwardingRuleCreate(ctx context.Context, d client := meta.(services.SdkBundle).CloudApiClient applicationLoadBalancerForwardingRule := ionoscloud.ApplicationLoadBalancerForwardingRule{ - Properties: &ionoscloud.ApplicationLoadBalancerForwardingRuleProperties{}, + Properties: ionoscloud.ApplicationLoadBalancerForwardingRuleProperties{}, } if name, nameOk := d.GetOk("name"); nameOk { name := name.(string) - applicationLoadBalancerForwardingRule.Properties.Name = &name + applicationLoadBalancerForwardingRule.Properties.Name = name } if protocol, protocolOk := d.GetOk("protocol"); protocolOk { protocol := protocol.(string) - applicationLoadBalancerForwardingRule.Properties.Protocol = &protocol + applicationLoadBalancerForwardingRule.Properties.Protocol = protocol } if listenerIp, listenerIpOk := d.GetOk("listener_ip"); listenerIpOk { listenerIp := listenerIp.(string) - applicationLoadBalancerForwardingRule.Properties.ListenerIp = &listenerIp + applicationLoadBalancerForwardingRule.Properties.ListenerIp = listenerIp } if listenerPort, listenerPortOk := d.GetOk("listener_port"); listenerPortOk { listenerPort := int32(listenerPort.(int)) - applicationLoadBalancerForwardingRule.Properties.ListenerPort = &listenerPort + applicationLoadBalancerForwardingRule.Properties.ListenerPort = listenerPort } if clientTimeout, clientTimeoutOk := d.GetOk("client_timeout"); clientTimeoutOk { @@ -216,14 +216,14 @@ func resourceApplicationLoadBalancerForwardingRuleCreate(ctx context.Context, d serverCertificates = append(serverCertificates, value.(string)) } if len(serverCertificates) > 0 { - applicationLoadBalancerForwardingRule.Properties.ServerCertificates = &serverCertificates + applicationLoadBalancerForwardingRule.Properties.ServerCertificates = serverCertificates } } } if _, httpRulesOk := d.GetOk("http_rules"); httpRulesOk { if httpRules, err := getAlbHttpRulesData(d); err == nil { - applicationLoadBalancerForwardingRule.Properties.HttpRules = httpRules + applicationLoadBalancerForwardingRule.Properties.HttpRules = *httpRules } else { return diag.FromErr(err) } @@ -283,7 +283,7 @@ func resourceApplicationLoadBalancerForwardingRuleUpdate(ctx context.Context, d client := meta.(services.SdkBundle).CloudApiClient request := ionoscloud.ApplicationLoadBalancerForwardingRule{ - Properties: &ionoscloud.ApplicationLoadBalancerForwardingRuleProperties{}, + Properties: ionoscloud.ApplicationLoadBalancerForwardingRuleProperties{}, } dcId := d.Get("datacenter_id").(string) @@ -292,25 +292,25 @@ func resourceApplicationLoadBalancerForwardingRuleUpdate(ctx context.Context, d if d.HasChange("name") { _, v := d.GetChange("name") vStr := v.(string) - request.Properties.Name = &vStr + request.Properties.Name = vStr } if d.HasChange("protocol") { _, v := d.GetChange("protocol") vStr := v.(string) - request.Properties.Protocol = &vStr + request.Properties.Protocol = vStr } if d.HasChange("listener_ip") { _, v := d.GetChange("listener_ip") vStr := v.(string) - request.Properties.ListenerIp = &vStr + request.Properties.ListenerIp = vStr } if d.HasChange("listener_port") { _, v := d.GetChange("listener_port") vStr := int32(v.(int)) - request.Properties.ListenerPort = &vStr + request.Properties.ListenerPort = vStr } if d.HasChange("client_timeout") { @@ -328,18 +328,18 @@ func resourceApplicationLoadBalancerForwardingRuleUpdate(ctx context.Context, d serverCertificates = append(serverCertificates, value.(string)) } } - request.Properties.ServerCertificates = &serverCertificates + request.Properties.ServerCertificates = serverCertificates } if d.HasChange("http_rules") { if httpRules, err := getAlbHttpRulesData(d); err == nil { - request.Properties.HttpRules = httpRules + request.Properties.HttpRules = *httpRules } else { return diag.FromErr(err) } } - _, apiResponse, err := client.ApplicationLoadBalancersApi.DatacentersApplicationloadbalancersForwardingrulesPatch(ctx, dcId, albId, d.Id()).ApplicationLoadBalancerForwardingRuleProperties(*request.Properties).Execute() + _, apiResponse, err := client.ApplicationLoadBalancersApi.DatacentersApplicationloadbalancersForwardingrulesPatch(ctx, dcId, albId, d.Id()).ApplicationLoadBalancerForwardingRuleProperties(request.Properties).Execute() logApiRequestTime(apiResponse) if err != nil { @@ -421,128 +421,110 @@ func setApplicationLoadBalancerForwardingRuleData(d *schema.ResourceData, applic d.SetId(*applicationLoadBalancerForwardingRule.Id) } - if applicationLoadBalancerForwardingRule.Properties != nil { - if applicationLoadBalancerForwardingRule.Properties.Name != nil { - err := d.Set("name", *applicationLoadBalancerForwardingRule.Properties.Name) - if err != nil { - return fmt.Errorf("error while setting name property for application load balancer forwarding rule %s: %w", d.Id(), err) - } - } + err := d.Set("name", applicationLoadBalancerForwardingRule.Properties.Name) + if err != nil { + return fmt.Errorf("error while setting name property for application load balancer forwarding rule %s: %w", d.Id(), err) + } - if applicationLoadBalancerForwardingRule.Properties.Protocol != nil { - err := d.Set("protocol", *applicationLoadBalancerForwardingRule.Properties.Protocol) - if err != nil { - return fmt.Errorf("error while setting protocol property for application load balancer forwarding rule %s: %w", d.Id(), err) - } - } + err = d.Set("protocol", applicationLoadBalancerForwardingRule.Properties.Protocol) + if err != nil { + return fmt.Errorf("error while setting protocol property for application load balancer forwarding rule %s: %w", d.Id(), err) + } - if applicationLoadBalancerForwardingRule.Properties.ListenerIp != nil { - err := d.Set("listener_ip", *applicationLoadBalancerForwardingRule.Properties.ListenerIp) - if err != nil { - return fmt.Errorf("error while setting listener_ip property for application load balancer forwarding rule %s: %w", d.Id(), err) - } - } + err = d.Set("listener_ip", applicationLoadBalancerForwardingRule.Properties.ListenerIp) + if err != nil { + return fmt.Errorf("error while setting listener_ip property for application load balancer forwarding rule %s: %w", d.Id(), err) + } - if applicationLoadBalancerForwardingRule.Properties.ListenerPort != nil { - err := d.Set("listener_port", *applicationLoadBalancerForwardingRule.Properties.ListenerPort) - if err != nil { - return fmt.Errorf("error while setting listener_port property for application load balancer forwarding rule %s: %w", d.Id(), err) - } - } + err = d.Set("listener_port", applicationLoadBalancerForwardingRule.Properties.ListenerPort) + if err != nil { + return fmt.Errorf("error while setting listener_port property for application load balancer forwarding rule %s: %w", d.Id(), err) + } - if applicationLoadBalancerForwardingRule.Properties.ClientTimeout != nil { - err := d.Set("client_timeout", *applicationLoadBalancerForwardingRule.Properties.ClientTimeout) - if err != nil { - return fmt.Errorf("error while setting client_timeout property for application load balancer forwarding rule %s: %w", d.Id(), err) - } + if applicationLoadBalancerForwardingRule.Properties.ClientTimeout != nil { + err := d.Set("client_timeout", *applicationLoadBalancerForwardingRule.Properties.ClientTimeout) + if err != nil { + return fmt.Errorf("error while setting client_timeout property for application load balancer forwarding rule %s: %w", d.Id(), err) } + } - if applicationLoadBalancerForwardingRule.Properties.ServerCertificates != nil { - err := d.Set("server_certificates", *applicationLoadBalancerForwardingRule.Properties.ServerCertificates) - if err != nil { - return fmt.Errorf("error while setting server_certificates property for application load balancer forwarding rule %s: %w", d.Id(), err) - } + if applicationLoadBalancerForwardingRule.Properties.ServerCertificates != nil { + err := d.Set("server_certificates", applicationLoadBalancerForwardingRule.Properties.ServerCertificates) + if err != nil { + return fmt.Errorf("error while setting server_certificates property for application load balancer forwarding rule %s: %w", d.Id(), err) } + } - httpRules := make([]interface{}, 0) - if applicationLoadBalancerForwardingRule.Properties.HttpRules != nil && len(*applicationLoadBalancerForwardingRule.Properties.HttpRules) > 0 { - httpRules = make([]interface{}, 0) - for _, rule := range *applicationLoadBalancerForwardingRule.Properties.HttpRules { - ruleEntry := make(map[string]interface{}) - - if rule.Name != nil { - ruleEntry["name"] = *rule.Name - } - - if rule.Type != nil { - ruleEntry["type"] = *rule.Type - } + httpRules := make([]interface{}, 0) + if len(applicationLoadBalancerForwardingRule.Properties.HttpRules) > 0 { + httpRules = make([]interface{}, 0) + for _, rule := range applicationLoadBalancerForwardingRule.Properties.HttpRules { + ruleEntry := make(map[string]interface{}) - if rule.TargetGroup != nil { - ruleEntry["target_group"] = *rule.TargetGroup - } + ruleEntry["name"] = rule.Name + ruleEntry["type"] = rule.Type - if rule.DropQuery != nil { - ruleEntry["drop_query"] = *rule.DropQuery - } + if rule.TargetGroup != nil { + ruleEntry["target_group"] = *rule.TargetGroup + } - if rule.Location != nil { - ruleEntry["location"] = *rule.Location - } + if rule.DropQuery != nil { + ruleEntry["drop_query"] = *rule.DropQuery + } - if rule.StatusCode != nil { - ruleEntry["status_code"] = *rule.StatusCode - } + if rule.Location != nil { + ruleEntry["location"] = *rule.Location + } - if rule.ResponseMessage != nil { - ruleEntry["response_message"] = *rule.ResponseMessage - } + if rule.StatusCode != nil { + ruleEntry["status_code"] = *rule.StatusCode + } - if rule.ContentType != nil { - ruleEntry["content_type"] = *rule.ContentType - } + if rule.ResponseMessage != nil { + ruleEntry["response_message"] = *rule.ResponseMessage + } - if rule.Conditions != nil { - conditions := make([]interface{}, 0) - for _, condition := range *rule.Conditions { - conditionEntry := make(map[string]interface{}) + if rule.ContentType != nil { + ruleEntry["content_type"] = *rule.ContentType + } - if condition.Type != nil { - conditionEntry["type"] = *condition.Type - } + if rule.Conditions != nil { + conditions := make([]interface{}, 0) + for _, condition := range rule.Conditions { + conditionEntry := make(map[string]interface{}) - if condition.Condition != nil { - conditionEntry["condition"] = *condition.Condition - } + conditionEntry["type"] = condition.Type - if condition.Negate != nil { - conditionEntry["negate"] = *condition.Negate - } + conditionEntry["condition"] = condition.Condition - if condition.Key != nil { - conditionEntry["key"] = *condition.Key - } + if condition.Negate != nil { + conditionEntry["negate"] = *condition.Negate + } - if condition.Value != nil { - conditionEntry["value"] = *condition.Value - } + if condition.Key != nil { + conditionEntry["key"] = *condition.Key + } - conditions = append(conditions, conditionEntry) + if condition.Value != nil { + conditionEntry["value"] = *condition.Value } - ruleEntry["conditions"] = conditions + conditions = append(conditions, conditionEntry) } - httpRules = append(httpRules, ruleEntry) + ruleEntry["conditions"] = conditions } + + httpRules = append(httpRules, ruleEntry) } + } - if len(httpRules) > 0 { - if err := d.Set("http_rules", httpRules); err != nil { - return fmt.Errorf("error while setting http_rules property for application load balancer forwarding rule %s: %w", d.Id(), err) - } + if len(httpRules) > 0 { + if err := d.Set("http_rules", httpRules); err != nil { + return fmt.Errorf("error while setting http_rules property for application load balancer forwarding rule %s: %w", d.Id(), err) } } + return nil } @@ -557,12 +539,12 @@ func getAlbHttpRulesData(d *schema.ResourceData) (*[]ionoscloud.ApplicationLoadB if name, nameOk := d.GetOk(fmt.Sprintf("http_rules.%d.name", httpRuleIndex)); nameOk { name := name.(string) - httpRule.Name = &name + httpRule.Name = name } if typeVal, typeOk := d.GetOk(fmt.Sprintf("http_rules.%d.type", httpRuleIndex)); typeOk { typeVal := typeVal.(string) - httpRule.Type = &typeVal + httpRule.Type = typeVal } if targetGroup, targetGroupOk := d.GetOk(fmt.Sprintf("http_rules.%d.target_group", httpRuleIndex)); targetGroupOk { @@ -605,11 +587,11 @@ func getAlbHttpRulesData(d *schema.ResourceData) (*[]ionoscloud.ApplicationLoadB condition := ionoscloud.ApplicationLoadBalancerHttpRuleCondition{} typeVal := d.Get(fmt.Sprintf("http_rules.%d.conditions.%d.type", httpRuleIndex, conditionIndex)).(string) - condition.Type = &typeVal + condition.Type = typeVal if conditionVal, conditionOk := d.GetOk(fmt.Sprintf("http_rules.%d.conditions.%d.condition", httpRuleIndex, conditionIndex)); conditionOk { conditionVal := conditionVal.(string) - condition.Condition = &conditionVal + condition.Condition = conditionVal } else if !strings.EqualFold(typeVal, "SOURCE_IP") { return nil, fmt.Errorf("condition must be provided for application loadbalancer forwarding rule http rule condition") } @@ -632,7 +614,7 @@ func getAlbHttpRulesData(d *schema.ResourceData) (*[]ionoscloud.ApplicationLoadB conditions = append(conditions, condition) } - httpRule.Conditions = &conditions + httpRule.Conditions = conditions } } diff --git a/ionoscloud/resource_application_loadbalancer_forwardingrule_test.go b/ionoscloud/resource_application_loadbalancer_forwardingrule_test.go index 38d1f6c3b..74b2af16f 100644 --- a/ionoscloud/resource_application_loadbalancer_forwardingrule_test.go +++ b/ionoscloud/resource_application_loadbalancer_forwardingrule_test.go @@ -8,7 +8,7 @@ import ( "regexp" "testing" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/utils/constant" diff --git a/ionoscloud/resource_application_loadbalancer_test.go b/ionoscloud/resource_application_loadbalancer_test.go index 0a4060397..a0bad13e6 100644 --- a/ionoscloud/resource_application_loadbalancer_test.go +++ b/ionoscloud/resource_application_loadbalancer_test.go @@ -8,7 +8,7 @@ import ( "regexp" "testing" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/utils" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/utils/constant" diff --git a/ionoscloud/resource_backup_unit.go b/ionoscloud/resource_backup_unit.go index a2c663694..0a5035cf3 100644 --- a/ionoscloud/resource_backup_unit.go +++ b/ionoscloud/resource_backup_unit.go @@ -8,12 +8,13 @@ import ( "strings" "time" + "github.com/ionos-cloud/sdk-go-bundle/shared" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/utils/constant" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/utils" @@ -68,14 +69,14 @@ func resourceBackupUnitCreate(ctx context.Context, d *schema.ResourceData, meta backupUnitEmail := d.Get("email").(string) backupUnit := ionoscloud.BackupUnit{ - Properties: &ionoscloud.BackupUnitProperties{ - Name: &backupUnitName, + Properties: ionoscloud.BackupUnitProperties{ + Name: backupUnitName, Password: &backupUnitPassword, Email: &backupUnitEmail, }, } - createdBackupUnit, apiResponse, err := client.BackupUnitsApi.BackupunitsPost(ctx).BackupUnit(backupUnit).Execute() + createdBackupUnit, apiResponse, err := client.BackupServiceApi.BackupunitsPost(ctx).BackupUnit(backupUnit).Execute() logApiRequestTime(apiResponse) if err != nil { @@ -133,7 +134,7 @@ func resourceBackupUnitUpdate(ctx context.Context, d *schema.ResourceData, meta client := meta.(services.SdkBundle).CloudApiClient request := ionoscloud.BackupUnit{} - request.Properties = &ionoscloud.BackupUnitProperties{} + request.Properties = ionoscloud.BackupUnitProperties{} log.Printf("[INFO] Attempting update backup unit %s", d.Id()) oldEmail, newEmail := d.GetChange("email") @@ -158,7 +159,7 @@ func resourceBackupUnitUpdate(ctx context.Context, d *schema.ResourceData, meta } } - _, apiResponse, err := client.BackupUnitsApi.BackupunitsPut(ctx, d.Id()).BackupUnit(request).Execute() + _, apiResponse, err := client.BackupServiceApi.BackupunitsPut(ctx, d.Id()).BackupUnit(request).Execute() logApiRequestTime(apiResponse) if err != nil { @@ -208,7 +209,7 @@ func waitForUnitToBeReady(ctx context.Context, d *schema.ResourceData, client *i func resourceBackupUnitDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { client := meta.(services.SdkBundle).CloudApiClient - apiResponse, err := client.BackupUnitsApi.BackupunitsDelete(ctx, d.Id()).Execute() + apiResponse, err := client.BackupServiceApi.BackupunitsDelete(ctx, d.Id()).Execute() logApiRequestTime(apiResponse) if err != nil { @@ -309,41 +310,33 @@ func setBackupUnitData(d *schema.ResourceData, backupUnit *ionoscloud.BackupUnit d.SetId(*backupUnit.Id) } - if backupUnit.Properties != nil { + epErr := d.Set("name", backupUnit.Properties.Name) + if epErr != nil { + return fmt.Errorf("error while setting name property for backup unit %s: %w", d.Id(), epErr) + } - if backupUnit.Properties.Name != nil { - epErr := d.Set("name", *backupUnit.Properties.Name) - if epErr != nil { - return fmt.Errorf("error while setting name property for backup unit %s: %w", d.Id(), epErr) - } + if backupUnit.Properties.Email != nil { + epErr := d.Set("email", *backupUnit.Properties.Email) + if epErr != nil { + return fmt.Errorf("error while setting email property for backup unit %s: %w", d.Id(), epErr) } + } - if backupUnit.Properties.Email != nil { - epErr := d.Set("email", *backupUnit.Properties.Email) - if epErr != nil { - return fmt.Errorf("error while setting email property for backup unit %s: %w", d.Id(), epErr) - } + if len(contractResources.Items) > 0 && + (contractResources.Items)[0].Properties.ContractNumber != nil { + err := d.Set("login", fmt.Sprintf("%s-%d", backupUnit.Properties.Name, *(contractResources.Items)[0].Properties.ContractNumber)) + if err != nil { + return fmt.Errorf("error while setting login property for backup unit %s: %w", d.Id(), err) } + } else { + if len(contractResources.Items) == 0 { + return fmt.Errorf("no contracts found for user") + } + + props := (contractResources.Items)[0].Properties - if backupUnit.Properties.Name != nil && contractResources.Items != nil && len(*contractResources.Items) > 0 && - (*contractResources.Items)[0].Properties.ContractNumber != nil { - err := d.Set("login", fmt.Sprintf("%s-%d", *backupUnit.Properties.Name, *(*contractResources.Items)[0].Properties.ContractNumber)) - if err != nil { - return fmt.Errorf("error while setting login property for backup unit %s: %w", d.Id(), err) - } - } else { - if contractResources.Items == nil || len(*contractResources.Items) == 0 { - return fmt.Errorf("no contracts found for user") - } - - props := (*contractResources.Items)[0].Properties - if props == nil { - return fmt.Errorf("could not get first contract properties") - } - - if props.ContractNumber == nil { - return fmt.Errorf("contract number not set") - } + if props.ContractNumber == nil { + return fmt.Errorf("contract number not set") } } return nil @@ -352,8 +345,8 @@ func setBackupUnitData(d *schema.ResourceData, backupUnit *ionoscloud.BackupUnit // BackupUnitFindByID simulates a FindByID function by filtering backup units from BackupunitsGet using the given ID. // This is done because of a temporary bug in the API with the regular FindByID function. // This is a temporary fix, this function should be replaced after the API bug is fixed. -func BackupUnitFindByID(ctx context.Context, backupUnitID string, client *ionoscloud.APIClient) (ionoscloud.BackupUnit, *ionoscloud.APIResponse, error) { - backupUnits, apiResponse, err := client.BackupUnitsApi.BackupunitsGet(ctx).Depth(2).Execute() +func BackupUnitFindByID(ctx context.Context, backupUnitID string, client *ionoscloud.APIClient) (ionoscloud.BackupUnit, *shared.APIResponse, error) { + backupUnits, apiResponse, err := client.BackupServiceApi.BackupunitsGet(ctx).Depth(2).Execute() var backupUnit ionoscloud.BackupUnit logApiRequestTime(apiResponse) if err != nil { @@ -362,7 +355,7 @@ func BackupUnitFindByID(ctx context.Context, backupUnitID string, client *ionosc if backupUnits.Items == nil { return backupUnit, apiResponse, fmt.Errorf("expected a list of backup units in the response but received 'nil' instead") } - for _, backupUnit := range *backupUnits.Items { + for _, backupUnit := range backupUnits.Items { if backupUnit.Id == nil { return backupUnit, apiResponse, fmt.Errorf("expected a backup unit with a valid ID but received 'nil' instead") } diff --git a/ionoscloud/resource_backup_unit_test.go b/ionoscloud/resource_backup_unit_test.go index 6c7759866..460f1a290 100644 --- a/ionoscloud/resource_backup_unit_test.go +++ b/ionoscloud/resource_backup_unit_test.go @@ -8,7 +8,7 @@ import ( "regexp" "testing" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/utils/constant" diff --git a/ionoscloud/resource_cube_server.go b/ionoscloud/resource_cube_server.go index 391f34048..8884771d4 100644 --- a/ionoscloud/resource_cube_server.go +++ b/ionoscloud/resource_cube_server.go @@ -10,7 +10,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/cloudapi" @@ -399,7 +399,7 @@ func resourceCubeServerCreate(ctx context.Context, d *schema.ResourceData, meta client := meta.(services.SdkBundle).CloudApiClient server := ionoscloud.Server{ - Properties: &ionoscloud.ServerProperties{}, + Properties: ionoscloud.ServerProperties{}, } var image, imageAlias string @@ -430,7 +430,7 @@ func resourceCubeServerCreate(ctx context.Context, d *schema.ResourceData, meta if _, ok := d.GetOk("boot_cdrom"); ok { resId := d.Get("boot_cdrom").(string) server.Properties.BootCdrom = &ionoscloud.ResourceReference{ - Id: &resId, + Id: resId, } } @@ -482,20 +482,20 @@ func resourceCubeServerCreate(ctx context.Context, d *schema.ResourceData, meta } server.Entities = &ionoscloud.ServerEntities{ Volumes: &ionoscloud.AttachedVolumes{ - Items: &[]ionoscloud.Volume{ + Items: []ionoscloud.Volume{ { - Properties: volume, + Properties: *volume, }, }, }, } var primaryNic *ionoscloud.Nic - if server.Entities.Nics != nil && server.Entities.Nics.Items != nil && len(*server.Entities.Nics.Items) > 0 { - primaryNic = &(*server.Entities.Nics.Items)[0] + if server.Entities.Nics != nil && len(server.Entities.Nics.Items) > 0 { + primaryNic = &(server.Entities.Nics.Items)[0] } // Nic Arguments nic := ionoscloud.Nic{ - Properties: &ionoscloud.NicProperties{}, + Properties: ionoscloud.NicProperties{}, } if _, ok := d.GetOk("nic"); ok { nic, err = cloudapinic.GetNicFromSchemaCreate(d, "nic.0.") @@ -506,16 +506,16 @@ func resourceCubeServerCreate(ctx context.Context, d *schema.ResourceData, meta } server.Entities.Nics = &ionoscloud.Nics{ - Items: &[]ionoscloud.Nic{ + Items: []ionoscloud.Nic{ nic, }, } - primaryNic = &(*server.Entities.Nics.Items)[0] + primaryNic = &(server.Entities.Nics.Items)[0] log.Printf("[DEBUG] dhcp nic after %t", *nic.Properties.Dhcp) log.Printf("[DEBUG] primaryNic dhcp %t", *primaryNic.Properties.Dhcp) firewall := ionoscloud.FirewallRule{ - Properties: &ionoscloud.FirewallruleProperties{}, + Properties: ionoscloud.FirewallruleProperties{}, } if _, ok := d.GetOk("nic.0.firewall"); ok { var diags diag.Diagnostics @@ -523,18 +523,18 @@ func resourceCubeServerCreate(ctx context.Context, d *schema.ResourceData, meta if diags != nil { return diags } - (*server.Entities.Nics.Items)[0].Entities = &ionoscloud.NicEntities{ + (server.Entities.Nics.Items)[0].Entities = &ionoscloud.NicEntities{ Firewallrules: &ionoscloud.FirewallRules{ - Items: &[]ionoscloud.FirewallRule{ + Items: []ionoscloud.FirewallRule{ firewall, }, }, } } - if primaryNic != nil && primaryNic.Properties != nil && primaryNic.Properties.Ips != nil { - if len(*primaryNic.Properties.Ips) == 0 { - *primaryNic.Properties.Ips = nil + if primaryNic != nil && primaryNic.Properties.Ips != nil { + if len(primaryNic.Properties.Ips) == 0 { + primaryNic.Properties.Ips = nil } } @@ -572,7 +572,7 @@ func resourceCubeServerCreate(ctx context.Context, d *schema.ResourceData, meta } firewallRules, apiResponse, err := client.FirewallRulesApi.DatacentersServersNicsFirewallrulesGet(ctx, d.Get("datacenter_id").(string), - *createdServer.Id, *(*createdServer.Entities.Nics.Items)[0].Id).Execute() + *createdServer.Id, *(createdServer.Entities.Nics.Items)[0].Id).Execute() logApiRequestTime(apiResponse) if err != nil { diags := diag.FromErr(fmt.Errorf("an error occurred while fetching firewall rules: %w", err)) @@ -580,16 +580,16 @@ func resourceCubeServerCreate(ctx context.Context, d *schema.ResourceData, meta } if firewallRules.Items != nil { - if len(*firewallRules.Items) > 0 { - if err := d.Set("firewallrule_id", *(*firewallRules.Items)[0].Id); err != nil { + if len(firewallRules.Items) > 0 { + if err := d.Set("firewallrule_id", *(firewallRules.Items)[0].Id); err != nil { diags := diag.FromErr(err) return diags } } } - if (*createdServer.Entities.Nics.Items)[0].Id != nil { - primaryNicID := *(*createdServer.Entities.Nics.Items)[0].Id + if (createdServer.Entities.Nics.Items)[0].Id != nil { + primaryNicID := *(createdServer.Entities.Nics.Items)[0].Id err := d.Set("primary_nic", primaryNicID) if err != nil { diags := diag.FromErr(fmt.Errorf("error while setting primary nic %s: %w", d.Id(), err)) @@ -604,24 +604,23 @@ func resourceCubeServerCreate(ctx context.Context, d *schema.ResourceData, meta } } - if (*createdServer.Entities.Nics.Items)[0].Properties.Ips != nil && - len(*(*createdServer.Entities.Nics.Items)[0].Properties.Ips) > 0 && + if (createdServer.Entities.Nics.Items)[0].Properties.Ips != nil && + len((createdServer.Entities.Nics.Items)[0].Properties.Ips) > 0 && createdServer.Entities.Volumes.Items != nil && - len(*createdServer.Entities.Volumes.Items) > 0 && - (*createdServer.Entities.Volumes.Items)[0].Properties != nil && - (*createdServer.Entities.Volumes.Items)[0].Properties.ImagePassword != nil { + len(createdServer.Entities.Volumes.Items) > 0 && + (createdServer.Entities.Volumes.Items)[0].Properties.ImagePassword != nil { d.SetConnInfo(map[string]string{ "type": "ssh", - "host": (*(*createdServer.Entities.Nics.Items)[0].Properties.Ips)[0], - "password": *(*createdServer.Entities.Volumes.Items)[0].Properties.ImagePassword, + "host": ((createdServer.Entities.Nics.Items)[0].Properties.Ips)[0], + "password": *(createdServer.Entities.Volumes.Items)[0].Properties.ImagePassword, }) } // Set inline volumes if createdServer.Entities.Volumes != nil && createdServer.Entities.Volumes.Items != nil { var inlineVolumeIds []string - for _, volume := range *createdServer.Entities.Volumes.Items { + for _, volume := range createdServer.Entities.Volumes.Items { inlineVolumeIds = append(inlineVolumeIds, *volume.Id) } @@ -662,40 +661,38 @@ func resourceCubeServerRead(ctx context.Context, d *schema.ResourceData, meta in diags := diag.FromErr(fmt.Errorf("error occurred while fetching a server ID %s %w", d.Id(), err)) return diags } - if server.Properties != nil { - if server.Properties.TemplateUuid != nil { - if err := d.Set("template_uuid", *server.Properties.TemplateUuid); err != nil { - diags := diag.FromErr(err) - return diags - } + if server.Properties.TemplateUuid != nil { + if err := d.Set("template_uuid", *server.Properties.TemplateUuid); err != nil { + diags := diag.FromErr(err) + return diags } + } - if server.Properties.Name != nil { - if err := d.Set("name", *server.Properties.Name); err != nil { - diags := diag.FromErr(err) - return diags - } + if server.Properties.Name != nil { + if err := d.Set("name", *server.Properties.Name); err != nil { + diags := diag.FromErr(err) + return diags } + } - if server.Properties.Hostname != nil { - if err := d.Set("hostname", *server.Properties.Hostname); err != nil { - diags := diag.FromErr(err) - return diags - } + if server.Properties.Hostname != nil { + if err := d.Set("hostname", *server.Properties.Hostname); err != nil { + diags := diag.FromErr(err) + return diags } + } - if server.Properties.AvailabilityZone != nil { - if err := d.Set("availability_zone", *server.Properties.AvailabilityZone); err != nil { - diags := diag.FromErr(err) - return diags - } + if server.Properties.AvailabilityZone != nil { + if err := d.Set("availability_zone", *server.Properties.AvailabilityZone); err != nil { + diags := diag.FromErr(err) + return diags } + } - if server.Properties.VmState != nil { - if err := d.Set("vm_state", *server.Properties.VmState); err != nil { - diags := diag.FromErr(err) - return diags - } + if server.Properties.VmState != nil { + if err := d.Set("vm_state", *server.Properties.VmState); err != nil { + diags := diag.FromErr(err) + return diags } } @@ -712,14 +709,14 @@ func resourceCubeServerRead(ctx context.Context, d *schema.ResourceData, meta in } if server.Entities != nil && server.Entities.Securitygroups != nil && server.Entities.Securitygroups.Items != nil { - if err := nsg.SetNSGInResourceData(d, server.Entities.Securitygroups.Items); err != nil { + if err := nsg.SetNSGInResourceData(d, &server.Entities.Securitygroups.Items); err != nil { return diag.FromErr(err) } } - if server.Entities != nil && server.Entities.Volumes != nil && server.Entities.Volumes.Items != nil && len(*server.Entities.Volumes.Items) > 0 && - (*server.Entities.Volumes.Items)[0].Properties.Image != nil { - if err := d.Set("boot_image", *(*server.Entities.Volumes.Items)[0].Properties.Image); err != nil { + if server.Entities != nil && server.Entities.Volumes != nil && server.Entities.Volumes.Items != nil && len(server.Entities.Volumes.Items) > 0 && + (server.Entities.Volumes.Items)[0].Properties.Image != nil { + if err := d.Set("boot_image", *(server.Entities.Volumes.Items)[0].Properties.Image); err != nil { diags := diag.FromErr(err) return diags } @@ -738,8 +735,8 @@ func resourceCubeServerRead(ctx context.Context, d *schema.ResourceData, meta in return diags } - if len(*nic.Properties.Ips) > 0 { - if err := d.Set("primary_ip", (*nic.Properties.Ips)[0]); err != nil { + if len(nic.Properties.Ips) > 0 { + if err := d.Set("primary_ip", (nic.Properties.Ips)[0]); err != nil { diags := diag.FromErr(err) return diags } @@ -747,8 +744,8 @@ func resourceCubeServerRead(ctx context.Context, d *schema.ResourceData, meta in network := cloudapinic.SetNetworkProperties(*nic) - if nic.Properties.Ips != nil && len(*nic.Properties.Ips) > 0 { - network["ips"] = *nic.Properties.Ips + if nic.Properties.Ips != nil && len(nic.Properties.Ips) > 0 { + network["ips"] = nic.Properties.Ips } if firewallId, ok := d.GetOk("firewallrule_id"); ok { @@ -796,7 +793,7 @@ func resourceCubeServerRead(ctx context.Context, d *schema.ResourceData, meta in } if server.Properties.BootCdrom != nil { - if err := d.Set("boot_cdrom", *server.Properties.BootCdrom.Id); err != nil { + if err := d.Set("boot_cdrom", server.Properties.BootCdrom.Id); err != nil { diags := diag.FromErr(err) return diags } @@ -924,7 +921,7 @@ func resourceCubeServerUpdate(ctx context.Context, d *schema.ResourceData, meta if d.HasChange("nic") { nic := &ionoscloud.Nic{} nicStr := d.Get("primary_nic").(string) - for _, n := range *server.Entities.Nics.Items { + for _, n := range server.Entities.Nics.Items { if *n.Id == nicStr { nic = &n break @@ -933,7 +930,7 @@ func resourceCubeServerUpdate(ctx context.Context, d *schema.ResourceData, meta lan := int32(d.Get("nic.0.lan").(int)) properties := ionoscloud.NicProperties{ - Lan: &lan, + Lan: lan, } if v, ok := d.GetOk("nic.0.name"); ok { @@ -950,14 +947,16 @@ func resourceCubeServerUpdate(ctx context.Context, d *schema.ResourceData, meta ips = append(ips, ip) } if ips != nil && len(ips) > 0 { - properties.Ips = &ips + properties.Ips = ips } } } if v, ok := d.GetOk("nic.0.ipv6_cidr_block"); ok { ipv6Block := v.(string) - properties.Ipv6CidrBlock = &ipv6Block + ipv6BlockNulStr := ionoscloud.NullableString{} + ipv6BlockNulStr.Set(&ipv6Block) + properties.Ipv6CidrBlock = ipv6BlockNulStr } if v, ok := d.GetOk("nic.0.ipv6_ips"); ok { @@ -968,14 +967,16 @@ func resourceCubeServerUpdate(ctx context.Context, d *schema.ResourceData, meta return diags } if len(ipv6Ips) > 0 { - properties.Ipv6Ips = &ipv6Ips + properties.Ipv6Ips = ipv6Ips } } if d.HasChange("nic.0.dhcpv6") { if dhcpv6, ok := d.GetOkExists("nic.0.dhcpv6"); ok { dhcpv6 := dhcpv6.(bool) - properties.Dhcpv6 = &dhcpv6 + dhcpv6NulBool := ionoscloud.NullableBool{} + dhcpv6NulBool.Set(&dhcpv6) + properties.Dhcpv6 = dhcpv6NulBool } else { properties.SetDhcpv6Nil() } @@ -1020,7 +1021,7 @@ func resourceCubeServerUpdate(ctx context.Context, d *schema.ResourceData, meta firewall, apiResponse, err = client.FirewallRulesApi.DatacentersServersNicsFirewallrulesPost(ctx, dcId, *server.Id, *nic.Id).Firewallrule(firewall).Execute() } else { - firewall, apiResponse, err = client.FirewallRulesApi.DatacentersServersNicsFirewallrulesPatch(ctx, dcId, *server.Id, *nic.Id, firewallId).Firewallrule(*firewall.Properties).Execute() + firewall, apiResponse, err = client.FirewallRulesApi.DatacentersServersNicsFirewallrulesPatch(ctx, dcId, *server.Id, *nic.Id, firewallId).Firewallrule(firewall.Properties).Execute() } logApiRequestTime(apiResponse) @@ -1042,7 +1043,7 @@ func resourceCubeServerUpdate(ctx context.Context, d *schema.ResourceData, meta nic.Entities = &ionoscloud.NicEntities{ Firewallrules: &ionoscloud.FirewallRules{ - Items: &[]ionoscloud.FirewallRule{ + Items: []ionoscloud.FirewallRule{ firewall, }, }, @@ -1088,23 +1089,21 @@ func resourceCubeServerUpdate(ctx context.Context, d *schema.ResourceData, meta func SetCubeVolumeProperties(volume ionoscloud.Volume) map[string]interface{} { volumeMap := map[string]interface{}{} - if volume.Properties != nil { - utils.SetPropWithNilCheck(volumeMap, "name", volume.Properties.Name) - utils.SetPropWithNilCheck(volumeMap, "disk_type", volume.Properties.Type) - utils.SetPropWithNilCheck(volumeMap, "licence_type", volume.Properties.LicenceType) - utils.SetPropWithNilCheck(volumeMap, "bus", volume.Properties.Bus) - utils.SetPropWithNilCheck(volumeMap, "availability_zone", volume.Properties.AvailabilityZone) - utils.SetPropWithNilCheck(volumeMap, "cpu_hot_plug", volume.Properties.CpuHotPlug) - utils.SetPropWithNilCheck(volumeMap, "ram_hot_plug", volume.Properties.RamHotPlug) - utils.SetPropWithNilCheck(volumeMap, "nic_hot_plug", volume.Properties.NicHotPlug) - utils.SetPropWithNilCheck(volumeMap, "nic_hot_unplug", volume.Properties.NicHotUnplug) - utils.SetPropWithNilCheck(volumeMap, "disc_virtio_hot_plug", volume.Properties.DiscVirtioHotPlug) - utils.SetPropWithNilCheck(volumeMap, "disc_virtio_hot_unplug", volume.Properties.DiscVirtioHotUnplug) - utils.SetPropWithNilCheck(volumeMap, "device_number", volume.Properties.DeviceNumber) - utils.SetPropWithNilCheck(volumeMap, "user_data", volume.Properties.UserData) - utils.SetPropWithNilCheck(volumeMap, "backup_unit_id", volume.Properties.BackupunitId) - utils.SetPropWithNilCheck(volumeMap, "boot_server", volume.Properties.BootServer) - } + utils.SetPropWithNilCheck(volumeMap, "name", volume.Properties.Name) + utils.SetPropWithNilCheck(volumeMap, "disk_type", volume.Properties.Type) + utils.SetPropWithNilCheck(volumeMap, "licence_type", volume.Properties.LicenceType) + utils.SetPropWithNilCheck(volumeMap, "bus", volume.Properties.Bus) + utils.SetPropWithNilCheck(volumeMap, "availability_zone", volume.Properties.AvailabilityZone) + utils.SetPropWithNilCheck(volumeMap, "cpu_hot_plug", volume.Properties.CpuHotPlug) + utils.SetPropWithNilCheck(volumeMap, "ram_hot_plug", volume.Properties.RamHotPlug) + utils.SetPropWithNilCheck(volumeMap, "nic_hot_plug", volume.Properties.NicHotPlug) + utils.SetPropWithNilCheck(volumeMap, "nic_hot_unplug", volume.Properties.NicHotUnplug) + utils.SetPropWithNilCheck(volumeMap, "disc_virtio_hot_plug", volume.Properties.DiscVirtioHotPlug) + utils.SetPropWithNilCheck(volumeMap, "disc_virtio_hot_unplug", volume.Properties.DiscVirtioHotUnplug) + utils.SetPropWithNilCheck(volumeMap, "device_number", volume.Properties.DeviceNumber) + utils.SetPropWithNilCheck(volumeMap, "user_data", volume.Properties.UserData) + utils.SetPropWithNilCheck(volumeMap, "backup_unit_id", volume.Properties.BackupunitId) + utils.SetPropWithNilCheck(volumeMap, "boot_server", volume.Properties.BootServer) return volumeMap } @@ -1153,18 +1152,18 @@ func resourceCubeServerImport(ctx context.Context, d *schema.ResourceData, meta d.SetId(*server.Id) - firstNicItem := (*server.Entities.Nics.Items)[0] - if server.Entities != nil && server.Entities.Nics != nil && firstNicItem.Properties != nil && + firstNicItem := (server.Entities.Nics.Items)[0] + if server.Entities != nil && server.Entities.Nics != nil && firstNicItem.Properties.Ips != nil && - len(*firstNicItem.Properties.Ips) > 0 { - log.Printf("[DEBUG] set primary_ip to %s", (*firstNicItem.Properties.Ips)[0]) - if err := d.Set("primary_ip", (*firstNicItem.Properties.Ips)[0]); err != nil { + len(firstNicItem.Properties.Ips) > 0 { + log.Printf("[DEBUG] set primary_ip to %s", (firstNicItem.Properties.Ips)[0]) + if err := d.Set("primary_ip", (firstNicItem.Properties.Ips)[0]); err != nil { return nil, fmt.Errorf("error while setting primary ip %s: %w", d.Id(), err) } } if server.Entities != nil && server.Entities.Securitygroups != nil && server.Entities.Securitygroups.Items != nil { - if err := nsg.SetNSGInResourceData(d, server.Entities.Securitygroups.Items); err != nil { + if err := nsg.SetNSGInResourceData(d, &server.Entities.Securitygroups.Items); err != nil { return nil, err } } @@ -1172,40 +1171,38 @@ func resourceCubeServerImport(ctx context.Context, d *schema.ResourceData, meta if err := d.Set("datacenter_id", datacenterId); err != nil { return nil, err } - if server.Properties != nil { - if server.Properties.Name != nil { - if err := d.Set("name", *server.Properties.Name); err != nil { - return nil, fmt.Errorf("error setting name %w", err) - } + if server.Properties.Name != nil { + if err := d.Set("name", *server.Properties.Name); err != nil { + return nil, fmt.Errorf("error setting name %w", err) } - if server.Properties.Hostname != nil { - if err := d.Set("hostname", *server.Properties.Hostname); err != nil { - return nil, fmt.Errorf("error setting hostname %w", err) - } + } + if server.Properties.Hostname != nil { + if err := d.Set("hostname", *server.Properties.Hostname); err != nil { + return nil, fmt.Errorf("error setting hostname %w", err) } - if server.Properties.Name != nil { - if err := d.Set("template_uuid", *server.Properties.TemplateUuid); err != nil { - return nil, fmt.Errorf("error setting template uuid %w", err) - } + } + if server.Properties.Name != nil { + if err := d.Set("template_uuid", *server.Properties.TemplateUuid); err != nil { + return nil, fmt.Errorf("error setting template uuid %w", err) } + } - if server.Properties.AvailabilityZone != nil { - if err := d.Set("availability_zone", *server.Properties.AvailabilityZone); err != nil { - return nil, fmt.Errorf("error setting availability_zone %w", err) - } + if server.Properties.AvailabilityZone != nil { + if err := d.Set("availability_zone", *server.Properties.AvailabilityZone); err != nil { + return nil, fmt.Errorf("error setting availability_zone %w", err) } } if server.Entities != nil && server.Entities.Volumes != nil && - len(*server.Entities.Volumes.Items) > 0 && - (*server.Entities.Volumes.Items)[0].Properties.Image != nil { - if err := d.Set("boot_image", *(*server.Entities.Volumes.Items)[0].Properties.Image); err != nil { + len(server.Entities.Volumes.Items) > 0 && + (server.Entities.Volumes.Items)[0].Properties.Image != nil { + if err := d.Set("boot_image", *(server.Entities.Volumes.Items)[0].Properties.Image); err != nil { return nil, fmt.Errorf("error setting boot_image %w", err) } } - if server.Entities != nil && server.Entities.Nics != nil && len(*server.Entities.Nics.Items) > 0 && (*server.Entities.Nics.Items)[0].Id != nil { - primaryNic := *(*server.Entities.Nics.Items)[0].Id + if server.Entities != nil && len(server.Entities.Nics.Items) > 0 && (server.Entities.Nics.Items)[0].Id != nil { + primaryNic := *(server.Entities.Nics.Items)[0].Id if err := d.Set("primary_nic", primaryNic); err != nil { return nil, fmt.Errorf("error setting primary_nic %w", err) } @@ -1216,8 +1213,8 @@ func resourceCubeServerImport(ctx context.Context, d *schema.ResourceData, meta return nil, err } - if len(*nic.Properties.Ips) > 0 { - if err := d.Set("primary_ip", (*nic.Properties.Ips)[0]); err != nil { + if len(nic.Properties.Ips) > 0 { + if err := d.Set("primary_ip", (nic.Properties.Ips)[0]); err != nil { return nil, fmt.Errorf("error setting primary_ip %w", err) } } @@ -1231,8 +1228,8 @@ func resourceCubeServerImport(ctx context.Context, d *schema.ResourceData, meta } if firewallRules.Items != nil { - if len(*firewallRules.Items) > 0 { - if err := d.Set("firewallrule_id", *(*firewallRules.Items)[0].Id); err != nil { + if len(firewallRules.Items) > 0 { + if err := d.Set("firewallrule_id", *(firewallRules.Items)[0].Id); err != nil { return nil, fmt.Errorf("error setting firewallrule_id %w", err) } } @@ -1256,23 +1253,19 @@ func resourceCubeServerImport(ctx context.Context, d *schema.ResourceData, meta } } - if server.Properties != nil && server.Properties.BootVolume != nil { - if server.Properties.BootVolume.Id != nil { - if err := d.Set("boot_volume", *server.Properties.BootVolume.Id); err != nil { - return nil, fmt.Errorf("error setting boot_volume %w", err) - } + if server.Properties.BootVolume != nil { + if err := d.Set("boot_volume", server.Properties.BootVolume.Id); err != nil { + return nil, fmt.Errorf("error setting boot_volume %w", err) } - volumeObj, apiResponse, err := client.ServersApi.DatacentersServersVolumesFindById(ctx, datacenterId, serverId, *server.Properties.BootVolume.Id).Execute() + volumeObj, apiResponse, err := client.ServersApi.DatacentersServersVolumesFindById(ctx, datacenterId, serverId, server.Properties.BootVolume.Id).Execute() logApiRequestTime(apiResponse) if err == nil { volumeItem := map[string]interface{}{} - if volumeObj.Properties != nil { - utils.SetPropWithNilCheck(volumeItem, "name", volumeObj.Properties.Name) - utils.SetPropWithNilCheck(volumeItem, "disk_type", volumeObj.Properties.Type) - utils.SetPropWithNilCheck(volumeItem, "licence_type", volumeObj.Properties.LicenceType) - utils.SetPropWithNilCheck(volumeItem, "bus", volumeObj.Properties.Bus) - utils.SetPropWithNilCheck(volumeItem, "availability_zone", volumeObj.Properties.AvailabilityZone) - } + utils.SetPropWithNilCheck(volumeItem, "name", volumeObj.Properties.Name) + utils.SetPropWithNilCheck(volumeItem, "disk_type", volumeObj.Properties.Type) + utils.SetPropWithNilCheck(volumeItem, "licence_type", volumeObj.Properties.LicenceType) + utils.SetPropWithNilCheck(volumeItem, "bus", volumeObj.Properties.Bus) + utils.SetPropWithNilCheck(volumeItem, "availability_zone", volumeObj.Properties.AvailabilityZone) volumesList := []map[string]interface{}{volumeItem} if err := d.Set("volume", volumesList); err != nil { diff --git a/ionoscloud/resource_cube_server_test.go b/ionoscloud/resource_cube_server_test.go index f9fdb3938..97ad369cd 100644 --- a/ionoscloud/resource_cube_server_test.go +++ b/ionoscloud/resource_cube_server_test.go @@ -9,7 +9,7 @@ import ( "regexp" "testing" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/utils" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/utils/constant" diff --git a/ionoscloud/resource_datacenter.go b/ionoscloud/resource_datacenter.go index d1434bc9d..c0bd14d54 100644 --- a/ionoscloud/resource_datacenter.go +++ b/ionoscloud/resource_datacenter.go @@ -12,7 +12,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" ) func resourceDatacenter() *schema.Resource { @@ -99,9 +99,9 @@ func resourceDatacenterCreate(ctx context.Context, d *schema.ResourceData, meta datacenterLocation := d.Get("location").(string) datacenter := ionoscloud.DatacenterPost{ - Properties: &ionoscloud.DatacenterPropertiesPost{ + Properties: ionoscloud.DatacenterPropertiesPost{ Name: &datacenterName, - Location: &datacenterLocation, + Location: datacenterLocation, }, } if attr, ok := d.GetOk("description"); ok { @@ -252,87 +252,82 @@ func setDatacenterData(d *schema.ResourceData, datacenter *ionoscloud.Datacenter d.SetId(*datacenter.Id) } - if datacenter.Properties != nil { - if datacenter.Properties.Location != nil { - err := d.Set("location", *datacenter.Properties.Location) - if err != nil { - return fmt.Errorf("error while setting location property for datacenter %s: %w", d.Id(), err) - } - } + err := d.Set("location", datacenter.Properties.Location) + if err != nil { + return fmt.Errorf("error while setting location property for datacenter %s: %w", d.Id(), err) + } - if datacenter.Properties.Description != nil { - err := d.Set("description", *datacenter.Properties.Description) - if err != nil { - return fmt.Errorf("error while setting description property for datacenter %s: %w", d.Id(), err) - } + if datacenter.Properties.Description != nil { + err := d.Set("description", *datacenter.Properties.Description) + if err != nil { + return fmt.Errorf("error while setting description property for datacenter %s: %w", d.Id(), err) } + } - if datacenter.Properties.Name != nil { - err := d.Set("name", *datacenter.Properties.Name) - if err != nil { - return fmt.Errorf("error while setting name property for datacenter %s: %w", d.Id(), err) - } + if datacenter.Properties.Name != nil { + err := d.Set("name", *datacenter.Properties.Name) + if err != nil { + return fmt.Errorf("error while setting name property for datacenter %s: %w", d.Id(), err) } + } - if datacenter.Properties.Version != nil { - err := d.Set("version", *datacenter.Properties.Version) - if err != nil { - return fmt.Errorf("error while setting version property for datacenter %s: %w", d.Id(), err) - } + if datacenter.Properties.Version != nil { + err := d.Set("version", *datacenter.Properties.Version) + if err != nil { + return fmt.Errorf("error while setting version property for datacenter %s: %w", d.Id(), err) } + } - if datacenter.Properties.Features != nil && len(*datacenter.Properties.Features) > 0 { - err := d.Set("features", *datacenter.Properties.Features) - if err != nil { - return fmt.Errorf("error while setting features property for datacenter %s: %w", d.Id(), err) - } + if len(datacenter.Properties.Features) > 0 { + err := d.Set("features", datacenter.Properties.Features) + if err != nil { + return fmt.Errorf("error while setting features property for datacenter %s: %w", d.Id(), err) } + } - if datacenter.Properties.SecAuthProtection != nil { - err := d.Set("sec_auth_protection", *datacenter.Properties.SecAuthProtection) - if err != nil { - return fmt.Errorf("error while setting sec_auth_protection property for datacenter %s: %w", d.Id(), err) - } + if datacenter.Properties.SecAuthProtection != nil { + err := d.Set("sec_auth_protection", *datacenter.Properties.SecAuthProtection) + if err != nil { + return fmt.Errorf("error while setting sec_auth_protection property for datacenter %s: %w", d.Id(), err) } + } - if datacenter.Properties.CpuArchitecture != nil && len(*datacenter.Properties.CpuArchitecture) > 0 { - var cpuArchitectures []interface{} - for _, cpuArchitecture := range *datacenter.Properties.CpuArchitecture { - architectureEntry := make(map[string]interface{}) + if len(datacenter.Properties.CpuArchitecture) > 0 { + var cpuArchitectures []interface{} + for _, cpuArchitecture := range datacenter.Properties.CpuArchitecture { + architectureEntry := make(map[string]interface{}) - if cpuArchitecture.CpuFamily != nil { - architectureEntry["cpu_family"] = *cpuArchitecture.CpuFamily - } + if cpuArchitecture.CpuFamily != nil { + architectureEntry["cpu_family"] = *cpuArchitecture.CpuFamily + } - if cpuArchitecture.MaxCores != nil { - architectureEntry["max_cores"] = *cpuArchitecture.MaxCores - } + if cpuArchitecture.MaxCores != nil { + architectureEntry["max_cores"] = *cpuArchitecture.MaxCores + } - if cpuArchitecture.MaxRam != nil { - architectureEntry["max_ram"] = *cpuArchitecture.MaxRam - } + if cpuArchitecture.MaxRam != nil { + architectureEntry["max_ram"] = *cpuArchitecture.MaxRam + } - if cpuArchitecture.Vendor != nil { - architectureEntry["vendor"] = *cpuArchitecture.Vendor - } + if cpuArchitecture.Vendor != nil { + architectureEntry["vendor"] = *cpuArchitecture.Vendor + } - cpuArchitectures = append(cpuArchitectures, architectureEntry) + cpuArchitectures = append(cpuArchitectures, architectureEntry) - if len(cpuArchitectures) > 0 { - if err := d.Set("cpu_architecture", cpuArchitectures); err != nil { - return fmt.Errorf("error while setting cpu_architecture property for datacenter %s: %w", d.Id(), err) - } + if len(cpuArchitectures) > 0 { + if err := d.Set("cpu_architecture", cpuArchitectures); err != nil { + return fmt.Errorf("error while setting cpu_architecture property for datacenter %s: %w", d.Id(), err) } } } + } - if datacenter.Properties.Ipv6CidrBlock != nil { - err := d.Set("ipv6_cidr_block", *datacenter.Properties.Ipv6CidrBlock) - if err != nil { - return fmt.Errorf("error while setting ipv6_cidr_block property for datacenter %s: %w", d.Id(), err) - } - } - + if datacenter.Properties.Ipv6CidrBlock.IsSet() && datacenter.Properties.Ipv6CidrBlock.Get() != nil { + err = d.Set("ipv6_cidr_block", *datacenter.Properties.Ipv6CidrBlock.Get()) + } + if err != nil { + return fmt.Errorf("error while setting ipv6_cidr_block property for datacenter %s: %w", d.Id(), err) } return nil diff --git a/ionoscloud/resource_datacenter_nsg_selection.go b/ionoscloud/resource_datacenter_nsg_selection.go index bbaf1697b..ae8383fb6 100644 --- a/ionoscloud/resource_datacenter_nsg_selection.go +++ b/ionoscloud/resource_datacenter_nsg_selection.go @@ -8,7 +8,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/cloudapi/nsg" diff --git a/ionoscloud/resource_datacenter_test.go b/ionoscloud/resource_datacenter_test.go index abd780805..f8bc2853f 100644 --- a/ionoscloud/resource_datacenter_test.go +++ b/ionoscloud/resource_datacenter_test.go @@ -11,7 +11,7 @@ import ( "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/utils/constant" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" "github.com/hashicorp/terraform-plugin-testing/helper/resource" "github.com/hashicorp/terraform-plugin-testing/terraform" diff --git a/ionoscloud/resource_firewall.go b/ionoscloud/resource_firewall.go index 55f690ce1..efe3c2e82 100644 --- a/ionoscloud/resource_firewall.go +++ b/ionoscloud/resource_firewall.go @@ -15,7 +15,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" ) func resourceFirewall() *schema.Resource { @@ -161,7 +161,7 @@ func resourceFirewallUpdate(ctx context.Context, d *schema.ResourceData, meta in if diags != nil { return diags } - _, apiResponse, err := client.FirewallRulesApi.DatacentersServersNicsFirewallrulesPatch(ctx, d.Get("datacenter_id").(string), d.Get("server_id").(string), d.Get("nic_id").(string), d.Id()).Firewallrule(*firewall.Properties).Execute() + _, apiResponse, err := client.FirewallRulesApi.DatacentersServersNicsFirewallrulesPatch(ctx, d.Get("datacenter_id").(string), d.Get("server_id").(string), d.Get("nic_id").(string), d.Id()).Firewallrule(firewall.Properties).Execute() logApiRequestTime(apiResponse) if err != nil { @@ -245,13 +245,13 @@ func resourceFirewallImport(ctx context.Context, d *schema.ResourceData, meta in func getFirewallData(d *schema.ResourceData, path string, update bool) (ionoscloud.FirewallRule, diag.Diagnostics) { firewall := ionoscloud.FirewallRule{ - Properties: &ionoscloud.FirewallruleProperties{}, + Properties: ionoscloud.FirewallruleProperties{}, } if !update { if v, ok := d.GetOk(path + "protocol"); ok { vStr := v.(string) - firewall.Properties.Protocol = &vStr + firewall.Properties.Protocol = vStr } } @@ -262,17 +262,23 @@ func getFirewallData(d *schema.ResourceData, path string, update bool) (ionosclo if v, ok := d.GetOk(path + "source_mac"); ok { val := v.(string) - firewall.Properties.SourceMac = &val + valNulStr := ionoscloud.NullableString{} + valNulStr.Set(&val) + firewall.Properties.SourceMac = valNulStr } if v, ok := d.GetOk(path + "source_ip"); ok { val := v.(string) - firewall.Properties.SourceIp = &val + valNulStr := ionoscloud.NullableString{} + valNulStr.Set(&val) + firewall.Properties.SourceIp = valNulStr } if v, ok := d.GetOk(path + "target_ip"); ok { val := v.(string) - firewall.Properties.TargetIp = &val + valNulStr := ionoscloud.NullableString{} + valNulStr.Set(&val) + firewall.Properties.TargetIp = valNulStr } if v, ok := d.GetOk(path + "port_range_start"); ok { @@ -291,7 +297,9 @@ func getFirewallData(d *schema.ResourceData, path string, update bool) (ionosclo return firewall, diag.FromErr(fmt.Errorf("could not parse icmpTpye %s: %w", v.(string), err)) } tempIcmpType := int32(intIcmpType) - firewall.Properties.IcmpType = &tempIcmpType + tempIcmpTypeNulInt := ionoscloud.NullableInt32{} + tempIcmpTypeNulInt.Set(&tempIcmpType) + firewall.Properties.IcmpType = tempIcmpTypeNulInt } if v, ok := d.GetOk(path + "icmp_code"); ok { @@ -300,7 +308,9 @@ func getFirewallData(d *schema.ResourceData, path string, update bool) (ionosclo return firewall, diag.FromErr(fmt.Errorf("could not parse icmpCode %s: %w", v.(string), err)) } tempIcmpCode := int32(intIcmpCode) - firewall.Properties.IcmpCode = &tempIcmpCode + tempIcmpCodeNulInt := ionoscloud.NullableInt32{} + tempIcmpCodeNulInt.Set(&tempIcmpCode) + firewall.Properties.IcmpCode = tempIcmpCodeNulInt } if v, ok := d.GetOk(path + "type"); ok { @@ -317,76 +327,71 @@ func setFirewallData(d *schema.ResourceData, firewall *ionoscloud.FirewallRule) d.SetId(*firewall.Id) } - if firewall.Properties != nil { - - if firewall.Properties.Protocol != nil { - err := d.Set("protocol", *firewall.Properties.Protocol) - if err != nil { - return fmt.Errorf("error while setting protocol property for firewall %s: %w", d.Id(), err) - } - } + err := d.Set("protocol", firewall.Properties.Protocol) + if err != nil { + return fmt.Errorf("error while setting protocol property for firewall %s: %w", d.Id(), err) + } - if firewall.Properties.Name != nil { - err := d.Set("name", *firewall.Properties.Name) - if err != nil { - return fmt.Errorf("error while setting name property for firewall %s: %w", d.Id(), err) - } + if firewall.Properties.Name != nil { + err := d.Set("name", *firewall.Properties.Name) + if err != nil { + return fmt.Errorf("error while setting name property for firewall %s: %w", d.Id(), err) } + } - if firewall.Properties.SourceMac != nil { - err := d.Set("source_mac", *firewall.Properties.SourceMac) - if err != nil { - return fmt.Errorf("error while setting source_mac property for firewall %s: %w", d.Id(), err) - } + if firewall.Properties.SourceMac.IsSet() && firewall.Properties.SourceMac.Get() != nil { + err := d.Set("source_mac", *firewall.Properties.SourceMac.Get()) + if err != nil { + return fmt.Errorf("error while setting source_mac property for firewall %s: %w", d.Id(), err) } + } - if firewall.Properties.SourceIp != nil { - err := d.Set("source_ip", *firewall.Properties.SourceIp) - if err != nil { - return fmt.Errorf("error while setting source_ip property for firewall %s: %w", d.Id(), err) - } + if firewall.Properties.SourceIp.IsSet() && firewall.Properties.SourceIp.Get() != nil { + err := d.Set("source_ip", *firewall.Properties.SourceIp.Get()) + if err != nil { + return fmt.Errorf("error while setting source_ip property for firewall %s: %w", d.Id(), err) } + } - if firewall.Properties.TargetIp != nil { - err := d.Set("target_ip", *firewall.Properties.TargetIp) - if err != nil { - return fmt.Errorf("error while setting target_ip property for firewall %s: %w", d.Id(), err) - } + if firewall.Properties.TargetIp.IsSet() && firewall.Properties.TargetIp.Get() != nil { + err := d.Set("target_ip", *firewall.Properties.TargetIp.Get()) + if err != nil { + return fmt.Errorf("error while setting target_ip property for firewall %s: %w", d.Id(), err) } + } - if firewall.Properties.PortRangeStart != nil { - err := d.Set("port_range_start", *firewall.Properties.PortRangeStart) - if err != nil { - return fmt.Errorf("error while setting port_range_start property for firewall %s: %w", d.Id(), err) - } + if firewall.Properties.PortRangeStart != nil { + err := d.Set("port_range_start", *firewall.Properties.PortRangeStart) + if err != nil { + return fmt.Errorf("error while setting port_range_start property for firewall %s: %w", d.Id(), err) } + } - if firewall.Properties.PortRangeEnd != nil { - err := d.Set("port_range_end", *firewall.Properties.PortRangeEnd) - if err != nil { - return fmt.Errorf("error while setting port_range_end property for firewall %s: %w", d.Id(), err) - } + if firewall.Properties.PortRangeEnd != nil { + err := d.Set("port_range_end", *firewall.Properties.PortRangeEnd) + if err != nil { + return fmt.Errorf("error while setting port_range_end property for firewall %s: %w", d.Id(), err) } + } - if firewall.Properties.IcmpType != nil { - err := d.Set("icmp_type", strconv.Itoa(int(*firewall.Properties.IcmpType))) - if err != nil { - return fmt.Errorf("error while setting icmp_type property for firewall %s: %w", d.Id(), err) - } + if firewall.Properties.IcmpType.IsSet() && firewall.Properties.IcmpType.Get() != nil { + err := d.Set("icmp_type", strconv.Itoa(int(*firewall.Properties.IcmpType.Get()))) + if err != nil { + return fmt.Errorf("error while setting icmp_type property for firewall %s: %w", d.Id(), err) } + } - if firewall.Properties.IcmpCode != nil { - err := d.Set("icmp_code", strconv.Itoa(int(*firewall.Properties.IcmpCode))) - if err != nil { - return fmt.Errorf("error while setting icmp_code property for firewall %s: %w", d.Id(), err) - } + if firewall.Properties.IcmpCode.IsSet() && firewall.Properties.IcmpCode.Get() != nil { + err := d.Set("icmp_code", strconv.Itoa(int(*firewall.Properties.IcmpCode.Get()))) + if err != nil { + return fmt.Errorf("error while setting icmp_code property for firewall %s: %w", d.Id(), err) } + } - if firewall.Properties.Type != nil { - err := d.Set("type", *firewall.Properties.Type) - if err != nil { - return fmt.Errorf("error while setting type property for firewall %s: %w", d.Id(), err) - } + if firewall.Properties.Type != nil { + err := d.Set("type", *firewall.Properties.Type) + if err != nil { + return fmt.Errorf("error while setting type property for firewall %s: %w", d.Id(), err) } } return nil diff --git a/ionoscloud/resource_firewall_test.go b/ionoscloud/resource_firewall_test.go index e0adfd6b2..e91ee74f5 100644 --- a/ionoscloud/resource_firewall_test.go +++ b/ionoscloud/resource_firewall_test.go @@ -8,7 +8,7 @@ import ( "regexp" "testing" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/utils/constant" diff --git a/ionoscloud/resource_group.go b/ionoscloud/resource_group.go index c49aca6be..f994e23bb 100644 --- a/ionoscloud/resource_group.go +++ b/ionoscloud/resource_group.go @@ -8,7 +8,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/cloudapi" @@ -184,7 +184,7 @@ func resourceGroupCreate(ctx context.Context, d *schema.ResourceData, meta inter client := meta.(services.SdkBundle).CloudApiClient request := ionoscloud.Group{ - Properties: &ionoscloud.GroupProperties{}, + Properties: ionoscloud.GroupProperties{}, } groupName := d.Get("name").(string) @@ -193,7 +193,7 @@ func resourceGroupCreate(ctx context.Context, d *schema.ResourceData, meta inter } tempCreateDataCenter := d.Get("create_datacenter").(bool) - request.Properties.CreateDataCenter = &tempCreateDataCenter + request.Properties.CreateDatacenter = &tempCreateDataCenter tempCreateSnapshot := d.Get("create_snapshot").(bool) request.Properties.CreateSnapshot = &tempCreateSnapshot tempReserveIp := d.Get("reserve_ip").(bool) @@ -301,8 +301,8 @@ func resourceGroupUpdate(ctx context.Context, d *schema.ResourceData, meta inter tempManageDBaaS := d.Get("manage_dbaas").(bool) groupReq := ionoscloud.Group{ - Properties: &ionoscloud.GroupProperties{ - CreateDataCenter: &tempCreateDataCenter, + Properties: ionoscloud.GroupProperties{ + CreateDatacenter: &tempCreateDataCenter, CreateSnapshot: &tempCreateSnapshot, ReserveIp: &tempReserveIp, AccessActivityLog: &tempAccessActivityLog, @@ -435,149 +435,145 @@ func setGroupData(ctx context.Context, client *ionoscloud.APIClient, d *schema.R d.SetId(*group.Id) } - if group.Properties != nil { - if group.Properties.Name != nil { - err := d.Set("name", *group.Properties.Name) - if err != nil { - return fmt.Errorf("error while setting name property for group %s: %w", d.Id(), err) - } - } - - if group.Properties.CreateDataCenter != nil { - err := d.Set("create_datacenter", *group.Properties.CreateDataCenter) - if err != nil { - return fmt.Errorf("error while setting create_datacenter property for group %s: %w", d.Id(), err) - } + if group.Properties.Name != nil { + err := d.Set("name", *group.Properties.Name) + if err != nil { + return fmt.Errorf("error while setting name property for group %s: %w", d.Id(), err) } + } - if group.Properties.CreateSnapshot != nil { - err := d.Set("create_snapshot", *group.Properties.CreateSnapshot) - if err != nil { - return fmt.Errorf("error while setting create_snapshot property for group %s: %w", d.Id(), err) - } + if group.Properties.CreateDatacenter != nil { + err := d.Set("create_datacenter", *group.Properties.CreateDatacenter) + if err != nil { + return fmt.Errorf("error while setting create_datacenter property for group %s: %w", d.Id(), err) } + } - if group.Properties.ReserveIp != nil { - err := d.Set("reserve_ip", *group.Properties.ReserveIp) - if err != nil { - return fmt.Errorf("error while setting reserve_ip property for group %s: %w", d.Id(), err) - } + if group.Properties.CreateSnapshot != nil { + err := d.Set("create_snapshot", *group.Properties.CreateSnapshot) + if err != nil { + return fmt.Errorf("error while setting create_snapshot property for group %s: %w", d.Id(), err) } + } - if group.Properties.AccessActivityLog != nil { - err := d.Set("access_activity_log", *group.Properties.AccessActivityLog) - if err != nil { - return fmt.Errorf("error while setting access_activity_log property for group %s: %w", d.Id(), err) - } + if group.Properties.ReserveIp != nil { + err := d.Set("reserve_ip", *group.Properties.ReserveIp) + if err != nil { + return fmt.Errorf("error while setting reserve_ip property for group %s: %w", d.Id(), err) } + } - if group.Properties.CreatePcc != nil { - err := d.Set("create_pcc", *group.Properties.CreatePcc) - if err != nil { - return fmt.Errorf("error while setting create_pcc property for group %s: %w", d.Id(), err) - } + if group.Properties.AccessActivityLog != nil { + err := d.Set("access_activity_log", *group.Properties.AccessActivityLog) + if err != nil { + return fmt.Errorf("error while setting access_activity_log property for group %s: %w", d.Id(), err) } + } - if group.Properties.S3Privilege != nil { - err := d.Set("s3_privilege", *group.Properties.S3Privilege) - if err != nil { - return fmt.Errorf("error while setting s3_privilege property for group %s: %w", d.Id(), err) - } + if group.Properties.CreatePcc != nil { + err := d.Set("create_pcc", *group.Properties.CreatePcc) + if err != nil { + return fmt.Errorf("error while setting create_pcc property for group %s: %w", d.Id(), err) } + } - if group.Properties.CreateBackupUnit != nil { - err := d.Set("create_backup_unit", *group.Properties.CreateBackupUnit) - if err != nil { - return fmt.Errorf("error while setting create_backup_unit property for group %s: %w", d.Id(), err) - } + if group.Properties.S3Privilege != nil { + err := d.Set("s3_privilege", *group.Properties.S3Privilege) + if err != nil { + return fmt.Errorf("error while setting s3_privilege property for group %s: %w", d.Id(), err) } + } - if group.Properties.CreateInternetAccess != nil { - err := d.Set("create_internet_access", *group.Properties.CreateInternetAccess) - if err != nil { - return fmt.Errorf("error while setting create_internet_access property for group %s: %w", d.Id(), err) - } + if group.Properties.CreateBackupUnit != nil { + err := d.Set("create_backup_unit", *group.Properties.CreateBackupUnit) + if err != nil { + return fmt.Errorf("error while setting create_backup_unit property for group %s: %w", d.Id(), err) } + } - if group.Properties.CreateK8sCluster != nil { - err := d.Set("create_k8s_cluster", *group.Properties.CreateK8sCluster) - if err != nil { - return fmt.Errorf("error while setting create_k8s_cluster property for group %s: %w", d.Id(), err) - } + if group.Properties.CreateInternetAccess != nil { + err := d.Set("create_internet_access", *group.Properties.CreateInternetAccess) + if err != nil { + return fmt.Errorf("error while setting create_internet_access property for group %s: %w", d.Id(), err) } + } - if group.Properties.CreateFlowLog != nil { - err := d.Set("create_flow_log", *group.Properties.CreateFlowLog) - if err != nil { - return fmt.Errorf("error while setting create_flow_log property for group %s: %w", d.Id(), err) - } + if group.Properties.CreateK8sCluster != nil { + err := d.Set("create_k8s_cluster", *group.Properties.CreateK8sCluster) + if err != nil { + return fmt.Errorf("error while setting create_k8s_cluster property for group %s: %w", d.Id(), err) } + } - if group.Properties.AccessAndManageMonitoring != nil { - err := d.Set("access_and_manage_monitoring", *group.Properties.AccessAndManageMonitoring) - if err != nil { - return fmt.Errorf("error while setting access_and_manage_monitoring property for group %s: %w", d.Id(), err) - } + if group.Properties.CreateFlowLog != nil { + err := d.Set("create_flow_log", *group.Properties.CreateFlowLog) + if err != nil { + return fmt.Errorf("error while setting create_flow_log property for group %s: %w", d.Id(), err) } + } - if group.Properties.AccessAndManageCertificates != nil { - err := d.Set("access_and_manage_certificates", *group.Properties.AccessAndManageCertificates) - if err != nil { - return fmt.Errorf("error while setting access_and_manage_certificates property for group %s: %w", d.Id(), err) - } + if group.Properties.AccessAndManageMonitoring != nil { + err := d.Set("access_and_manage_monitoring", *group.Properties.AccessAndManageMonitoring) + if err != nil { + return fmt.Errorf("error while setting access_and_manage_monitoring property for group %s: %w", d.Id(), err) } + } - if group.Properties.ManageDBaaS != nil { - err := d.Set("manage_dbaas", *group.Properties.ManageDBaaS) - if err != nil { - return fmt.Errorf("error while setting manage_dbaas property for group %s: %w", d.Id(), err) - } + if group.Properties.AccessAndManageCertificates != nil { + err := d.Set("access_and_manage_certificates", *group.Properties.AccessAndManageCertificates) + if err != nil { + return fmt.Errorf("error while setting access_and_manage_certificates property for group %s: %w", d.Id(), err) } + } - users, apiResponse, err := client.UserManagementApi.UmGroupsUsersGet(ctx, d.Id()).Depth(1).Execute() - logApiRequestTime(apiResponse) + if group.Properties.ManageDBaaS != nil { + err := d.Set("manage_dbaas", *group.Properties.ManageDBaaS) if err != nil { - return fmt.Errorf("an error occurred while UmGroupsUsersGet %s %w", d.Id(), err) + return fmt.Errorf("error while setting manage_dbaas property for group %s: %w", d.Id(), err) } + } - usersEntries := make([]interface{}, 0) - if users.Items != nil && len(*users.Items) > 0 { - usersEntries = make([]interface{}, len(*users.Items)) - for userIndex, user := range *users.Items { - userEntry := make(map[string]interface{}) + users, apiResponse, err := client.UserManagementApi.UmGroupsUsersGet(ctx, d.Id()).Depth(1).Execute() + logApiRequestTime(apiResponse) + if err != nil { + return fmt.Errorf("an error occurred while UmGroupsUsersGet %s %w", d.Id(), err) + } - if user.Id != nil { - userEntry["id"] = *user.Id - } + usersEntries := make([]interface{}, 0) + if len(users.Items) > 0 { + usersEntries = make([]interface{}, len(users.Items)) + for userIndex, user := range users.Items { + userEntry := make(map[string]interface{}) + + if user.Id != nil { + userEntry["id"] = *user.Id + } - if user.Properties != nil { - if user.Properties.Firstname != nil { - userEntry["first_name"] = *user.Properties.Firstname - } + if user.Properties.Firstname != nil { + userEntry["first_name"] = *user.Properties.Firstname + } - if user.Properties.Lastname != nil { - userEntry["last_name"] = *user.Properties.Lastname - } + if user.Properties.Lastname != nil { + userEntry["last_name"] = *user.Properties.Lastname + } - if user.Properties.Email != nil { - userEntry["email"] = *user.Properties.Email - } + if user.Properties.Email != nil { + userEntry["email"] = *user.Properties.Email + } - if user.Properties.Administrator != nil { - userEntry["administrator"] = *user.Properties.Administrator - } + if user.Properties.Administrator != nil { + userEntry["administrator"] = *user.Properties.Administrator + } - if user.Properties.ForceSecAuth != nil { - userEntry["force_sec_auth"] = *user.Properties.ForceSecAuth - } - } - usersEntries[userIndex] = userEntry + if user.Properties.ForceSecAuth != nil { + userEntry["force_sec_auth"] = *user.Properties.ForceSecAuth } + usersEntries[userIndex] = userEntry + } - if len(usersEntries) > 0 { - if err := d.Set("users", usersEntries); err != nil { - return err - } + if len(usersEntries) > 0 { + if err := d.Set("users", usersEntries); err != nil { + return err } } } @@ -588,7 +584,7 @@ func setGroupData(ctx context.Context, client *ionoscloud.APIClient, d *schema.R func addUserToGroup(userId, groupId string, ctx context.Context, d *schema.ResourceData, meta interface{}) error { client := meta.(services.SdkBundle).CloudApiClient userToAdd := ionoscloud.UserGroupPost{ - Id: &userId, + Id: userId, } _, apiResponse, err := client.UserManagementApi.UmGroupsUsersPost(ctx, groupId).User(userToAdd).Execute() diff --git a/ionoscloud/resource_group_test.go b/ionoscloud/resource_group_test.go index 0fc520a13..1690c3ac7 100644 --- a/ionoscloud/resource_group_test.go +++ b/ionoscloud/resource_group_test.go @@ -8,7 +8,7 @@ import ( "regexp" "testing" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/utils" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/utils/constant" diff --git a/ionoscloud/resource_ipblock.go b/ionoscloud/resource_ipblock.go index 62d8cf1bb..daf28bb32 100644 --- a/ionoscloud/resource_ipblock.go +++ b/ionoscloud/resource_ipblock.go @@ -14,7 +14,7 @@ import ( "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/utils" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" ) func resourceIPBlock() *schema.Resource { @@ -105,9 +105,9 @@ func resourceIPBlockCreate(ctx context.Context, d *schema.ResourceData, meta int location := d.Get("location").(string) name := d.Get("name").(string) ipblock := ionoscloud.IpBlock{ - Properties: &ionoscloud.IpBlockProperties{ - Size: &sizeConverted, - Location: &location, + Properties: ionoscloud.IpBlockProperties{ + Size: sizeConverted, + Location: location, Name: &name, }, } @@ -146,7 +146,7 @@ func resourceIPBlockRead(ctx context.Context, d *schema.ResourceData, meta inter return diags } - log.Printf("[INFO] IPS: %s", strings.Join(*ipBlock.Properties.Ips, ",")) + log.Printf("[INFO] IPS: %s", strings.Join(ipBlock.Properties.Ips, ",")) if err := IpBlockSetData(d, &ipBlock); err != nil { return diag.FromErr(err) @@ -232,22 +232,18 @@ func IpBlockSetData(d *schema.ResourceData, ipBlock *ionoscloud.IpBlock) error { d.SetId(*ipBlock.Id) } - if ipBlock.Properties.Ips != nil && len(*ipBlock.Properties.Ips) > 0 { - if err := d.Set("ips", *ipBlock.Properties.Ips); err != nil { + if len(ipBlock.Properties.Ips) > 0 { + if err := d.Set("ips", ipBlock.Properties.Ips); err != nil { return err } } - if ipBlock.Properties.Location != nil { - if err := d.Set("location", *ipBlock.Properties.Location); err != nil { - return err - } + if err := d.Set("location", ipBlock.Properties.Location); err != nil { + return err } - if ipBlock.Properties.Size != nil { - if err := d.Set("size", *ipBlock.Properties.Size); err != nil { - return err - } + if err := d.Set("size", ipBlock.Properties.Size); err != nil { + return err } if ipBlock.Properties.Name != nil { @@ -256,9 +252,9 @@ func IpBlockSetData(d *schema.ResourceData, ipBlock *ionoscloud.IpBlock) error { } } - if ipBlock.Properties.IpConsumers != nil && len(*ipBlock.Properties.IpConsumers) > 0 { + if len(ipBlock.Properties.IpConsumers) > 0 { var ipConsumers []interface{} - for _, ipConsumer := range *ipBlock.Properties.IpConsumers { + for _, ipConsumer := range ipBlock.Properties.IpConsumers { ipConsumerEntry := make(map[string]interface{}) utils.SetPropWithNilCheck(ipConsumerEntry, "ip", ipConsumer.Ip) utils.SetPropWithNilCheck(ipConsumerEntry, "mac", ipConsumer.Mac) diff --git a/ionoscloud/resource_ipblock_test.go b/ionoscloud/resource_ipblock_test.go index 782eeb647..40405630f 100644 --- a/ionoscloud/resource_ipblock_test.go +++ b/ionoscloud/resource_ipblock_test.go @@ -8,7 +8,7 @@ import ( "regexp" "testing" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/utils/constant" diff --git a/ionoscloud/resource_ipfailover.go b/ionoscloud/resource_ipfailover.go index ba1bd4eee..4c3f5d85d 100644 --- a/ionoscloud/resource_ipfailover.go +++ b/ionoscloud/resource_ipfailover.go @@ -19,7 +19,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" ) func resourceLanIPFailover() *schema.Resource { @@ -77,18 +77,18 @@ func resourceLanIPFailoverCreate(ctx context.Context, d *schema.ResourceData, me } return diag.FromErr(err) } - if lan.Properties == nil || lan.Properties.IpFailover == nil { + if lan.Properties.IpFailover == nil { return diag.FromErr(fmt.Errorf("expected a LAN response containing IP failover groups but received 'nil' instead")) } // Add the new IP failover group to the list - *lan.Properties.IpFailover = append(*lan.Properties.IpFailover, ionoscloud.IPFailover{ + lan.Properties.IpFailover = append(lan.Properties.IpFailover, ionoscloud.IPFailover{ Ip: &ip, NicUuid: &nicUuid, }) // Modify the LAN using the new list - lan, apiResponse, err = client.LANsApi.DatacentersLansPatch(ctx, dcId, lanId).Lan(*lan.Properties).Execute() + lan, apiResponse, err = client.LANsApi.DatacentersLansPatch(ctx, dcId, lanId).Lan(lan.Properties).Execute() apiResponse.LogInfo() if err != nil { return diag.FromErr(fmt.Errorf("an error occurred while patching a lans IP failover group, LAN ID: %s, error: %w", lanId, err)) @@ -118,7 +118,7 @@ func resourceLanIPFailoverRead(ctx context.Context, d *schema.ResourceData, meta } return diag.FromErr(err) } - if lan.Properties == nil || lan.Properties.IpFailover == nil { + if lan.Properties.IpFailover == nil { return diag.FromErr(fmt.Errorf("expected a LAN response containing IP failover groups but received 'nil' instead")) } @@ -126,8 +126,8 @@ func resourceLanIPFailoverRead(ctx context.Context, d *schema.ResourceData, meta // an identifier) and then set the data accordingly. ipFailoverGroups := lan.Properties.IpFailover ipFailoverGroupFound := false - if lan.Properties != nil && ipFailoverGroups != nil && len(*ipFailoverGroups) > 0 { - for _, ipFailoverGroup := range *ipFailoverGroups { + if len(ipFailoverGroups) > 0 { + for _, ipFailoverGroup := range ipFailoverGroups { if *ipFailoverGroup.Ip == ip { if err := d.Set("nicuuid", *ipFailoverGroup.NicUuid); err != nil { return diag.FromErr(utils.GenerateSetError(constant.ResourceIpFailover, "nicuuid", err)) @@ -167,23 +167,23 @@ func resourceLanIPFailoverUpdate(ctx context.Context, d *schema.ResourceData, me } return diag.FromErr(err) } - if lan.Properties == nil || lan.Properties.IpFailover == nil { + if lan.Properties.IpFailover == nil { return diag.FromErr(fmt.Errorf("expected a LAN response containing IP failover groups but received 'nil' instead")) } // Add the new IP failover group to the list - *lan.Properties.IpFailover = append(*lan.Properties.IpFailover, ionoscloud.IPFailover{ + lan.Properties.IpFailover = append(lan.Properties.IpFailover, ionoscloud.IPFailover{ Ip: &ip, NicUuid: &newNicUuid, }) // Remove the old IP failover group from the list - *lan.Properties.IpFailover = slice.DeleteFrom(*lan.Properties.IpFailover, ionoscloud.IPFailover{ + lan.Properties.IpFailover = slice.DeleteFrom(lan.Properties.IpFailover, ionoscloud.IPFailover{ Ip: &ip, NicUuid: &oldNicUuid, }) - _, apiResponse, err = client.LANsApi.DatacentersLansPatch(ctx, dcId, lanId).Lan(*lan.Properties).Execute() + _, apiResponse, err = client.LANsApi.DatacentersLansPatch(ctx, dcId, lanId).Lan(lan.Properties).Execute() apiResponse.LogInfo() if err != nil { diags := diag.FromErr(fmt.Errorf("an error occurred while patching the lan with ID: %s, error: %w", lanId, err)) @@ -212,17 +212,17 @@ func resourceLanIPFailoverDelete(ctx context.Context, d *schema.ResourceData, me } return diag.FromErr(err) } - if lan.Properties == nil || lan.Properties.IpFailover == nil { + if lan.Properties.IpFailover == nil { return diag.FromErr(fmt.Errorf("expected a LAN response containing IP failover groups but received 'nil' instead")) } // Remove the failover group from the list - *lan.Properties.IpFailover = slice.DeleteFrom(*lan.Properties.IpFailover, ionoscloud.IPFailover{ + lan.Properties.IpFailover = slice.DeleteFrom(lan.Properties.IpFailover, ionoscloud.IPFailover{ Ip: &ip, NicUuid: &nicUuid, }) - _, apiResponse, err = client.LANsApi.DatacentersLansPatch(ctx, dcId, lanId).Lan(*lan.Properties).Execute() + _, apiResponse, err = client.LANsApi.DatacentersLansPatch(ctx, dcId, lanId).Lan(lan.Properties).Execute() apiResponse.LogInfo() if err != nil { diags := diag.FromErr(fmt.Errorf("an error occurred while removing an IP failover group with IP: %s for the LAN with ID: %s, datacenter ID: %s, error: %w", ip, lanId, dcId, err)) @@ -262,8 +262,8 @@ func resourceIpFailoverImporter(ctx context.Context, d *schema.ResourceData, met log.Printf("[INFO] lan found: %+v", lan) ipFailoverGroups := lan.Properties.IpFailover - if lan.Properties != nil && ipFailoverGroups != nil && len(*ipFailoverGroups) > 0 { - for _, ipFailoverGroup := range *ipFailoverGroups { + if len(ipFailoverGroups) > 0 { + for _, ipFailoverGroup := range ipFailoverGroups { // Search for the appropriate IP Failover Group using the provided IP if *ipFailoverGroup.Ip == ip { // Set all the information only if the IP Failover Group exists diff --git a/ionoscloud/resource_ipfailover_test.go b/ionoscloud/resource_ipfailover_test.go index 40bc24816..d5012e65f 100644 --- a/ionoscloud/resource_ipfailover_test.go +++ b/ionoscloud/resource_ipfailover_test.go @@ -102,7 +102,7 @@ func testAccCheckLanIPFailoverGroupExists(n string) resource.TestCheckFunc { if lan.Properties.IpFailover == nil { return fmt.Errorf("LAN with ID: %s has no IP failover groups", lanId) } - for _, failoverGroup := range *lan.Properties.IpFailover { + for _, failoverGroup := range lan.Properties.IpFailover { if *failoverGroup.Ip == ip { return nil } @@ -137,7 +137,7 @@ func testAccCheckLanIPFailoverDestroyCheck(s *terraform.State) error { } else { found := false if lan.Properties.IpFailover != nil { - for _, failoverGroup := range *lan.Properties.IpFailover { + for _, failoverGroup := range lan.Properties.IpFailover { if *failoverGroup.Ip == ip { found = true break diff --git a/ionoscloud/resource_k8s_cluster.go b/ionoscloud/resource_k8s_cluster.go index feeb70176..de9bf649c 100644 --- a/ionoscloud/resource_k8s_cluster.go +++ b/ionoscloud/resource_k8s_cluster.go @@ -14,7 +14,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" ) func resourcek8sCluster() *schema.Resource { @@ -165,8 +165,8 @@ func resourcek8sClusterCreate(ctx context.Context, d *schema.ResourceData, meta clusterName := d.Get("name").(string) cluster := ionoscloud.KubernetesClusterForPost{ - Properties: &ionoscloud.KubernetesClusterPropertiesForPost{ - Name: &clusterName, + Properties: ionoscloud.KubernetesClusterPropertiesForPost{ + Name: clusterName, }, } @@ -183,12 +183,12 @@ func resourcek8sClusterCreate(ctx context.Context, d *schema.ResourceData, meta if mtVal, mtOk := d.GetOk("maintenance_window.0.time"); mtOk { log.Printf("[INFO] Setting Maintenance Window Time to : %s", mtVal.(string)) mtVal := mtVal.(string) - cluster.Properties.MaintenanceWindow.Time = &mtVal + cluster.Properties.MaintenanceWindow.Time = mtVal } if mdVal, mdOk := d.GetOk("maintenance_window.0.day_of_the_week"); mdOk { mdVal := mdVal.(string) - cluster.Properties.MaintenanceWindow.DayOfTheWeek = &mdVal + cluster.Properties.MaintenanceWindow.DayOfTheWeek = mdVal } if publicVal, publicOk := d.GetOkExists("public"); publicOk { @@ -220,7 +220,7 @@ func resourcek8sClusterCreate(ctx context.Context, d *schema.ResourceData, meta apiSubnets = append(apiSubnets, valueS) } if len(apiSubnets) > 0 { - cluster.Properties.ApiSubnetAllowList = &apiSubnets + cluster.Properties.ApiSubnetAllowList = apiSubnets } } } @@ -234,7 +234,7 @@ func resourcek8sClusterCreate(ctx context.Context, d *schema.ResourceData, meta addBucket := false if name, nameOk := d.GetOk(fmt.Sprintf("s3_buckets.%d.name", index)); nameOk { name := name.(string) - s3Bucket.Name = &name + s3Bucket.Name = name addBucket = true } else { diags := diag.FromErr(fmt.Errorf("name must be provided for Object Storage bucket")) @@ -245,7 +245,7 @@ func resourcek8sClusterCreate(ctx context.Context, d *schema.ResourceData, meta } } if len(s3Buckets) > 0 { - cluster.Properties.S3Buckets = &s3Buckets + cluster.Properties.S3Buckets = s3Buckets } } } @@ -322,15 +322,15 @@ func resourcek8sClusterUpdate(ctx context.Context, d *schema.ResourceData, meta request := ionoscloud.KubernetesClusterForPut{} clusterName := d.Get("name").(string) - request.Properties = &ionoscloud.KubernetesClusterPropertiesForPut{ - Name: &clusterName, + request.Properties = ionoscloud.KubernetesClusterPropertiesForPut{ + Name: clusterName, } if d.HasChange("name") { oldName, newName := d.GetChange("name") log.Printf("[INFO] k8s cluster name changed from %+v to %+v", oldName, newName) newNameStr := newName.(string) - request.Properties.Name = &newNameStr + request.Properties.Name = newNameStr } log.Printf("[INFO] Attempting update cluster Id %s", d.Id()) @@ -354,8 +354,8 @@ func resourcek8sClusterUpdate(ctx context.Context, d *schema.ResourceData, meta dayofTheWeek := d.Get("maintenance_window.0.day_of_the_week").(string) winTime := d.Get("maintenance_window.0.time").(string) maintenanceWindow := &ionoscloud.KubernetesMaintenanceWindow{ - DayOfTheWeek: &dayofTheWeek, - Time: &winTime, + DayOfTheWeek: dayofTheWeek, + Time: winTime, } if d.HasChange("maintenance_window.0.day_of_the_week") { @@ -364,7 +364,7 @@ func resourcek8sClusterUpdate(ctx context.Context, d *schema.ResourceData, meta log.Printf("[INFO] k8s maintenance window DOW changed from %+v to %+v", oldMd, newMd) updateMaintenanceWindow = true newMd := newMd.(string) - maintenanceWindow.DayOfTheWeek = &newMd + maintenanceWindow.DayOfTheWeek = newMd } } @@ -375,7 +375,7 @@ func resourcek8sClusterUpdate(ctx context.Context, d *schema.ResourceData, meta log.Printf("[INFO] k8s maintenance window time changed from %+v to %+v", oldMt, newMt) updateMaintenanceWindow = true newMt := newMt.(string) - maintenanceWindow.Time = &newMt + maintenanceWindow.Time = newMt } } @@ -395,7 +395,7 @@ func resourcek8sClusterUpdate(ctx context.Context, d *schema.ResourceData, meta apiSubnets = append(apiSubnets, valueS) } } - request.Properties.ApiSubnetAllowList = &apiSubnets + request.Properties.ApiSubnetAllowList = apiSubnets } if d.HasChange("s3_buckets") { @@ -408,7 +408,7 @@ func resourcek8sClusterUpdate(ctx context.Context, d *schema.ResourceData, meta addBucket := false if name, nameOk := d.GetOk(fmt.Sprintf("s3_buckets.%d.name", index)); nameOk { name := name.(string) - s3Bucket.Name = &name + s3Bucket.Name = name addBucket = true } if addBucket { @@ -416,7 +416,7 @@ func resourcek8sClusterUpdate(ctx context.Context, d *schema.ResourceData, meta } } } - request.Properties.S3Buckets = &s3Buckets + request.Properties.S3Buckets = s3Buckets } _, apiResponse, err := client.KubernetesApi.K8sPut(ctx, d.Id()).KubernetesCluster(request).Execute() @@ -535,92 +535,87 @@ func setK8sClusterData(d *schema.ResourceData, cluster *ionoscloud.KubernetesClu d.SetId(*cluster.Id) } - if cluster.Properties != nil { - if cluster.Properties.Name != nil { - if err := d.Set("name", *cluster.Properties.Name); err != nil { - return err - } + if err := d.Set("name", cluster.Properties.Name); err != nil { + return err + } + + if cluster.Properties.K8sVersion != nil { + if err := d.Set("k8s_version", *cluster.Properties.K8sVersion); err != nil { + return err } - if cluster.Properties.K8sVersion != nil { - if err := d.Set("k8s_version", *cluster.Properties.K8sVersion); err != nil { - return err - } + } + if cluster.Properties.MaintenanceWindow != nil { + if err := d.Set("maintenance_window", []map[string]string{ + { + "time": cluster.Properties.MaintenanceWindow.Time, + "day_of_the_week": cluster.Properties.MaintenanceWindow.DayOfTheWeek, + }, + }); err != nil { + return err } + } - if cluster.Properties.MaintenanceWindow != nil && cluster.Properties.MaintenanceWindow.Time != nil && cluster.Properties.MaintenanceWindow.DayOfTheWeek != nil { - if err := d.Set("maintenance_window", []map[string]string{ - { - "time": *cluster.Properties.MaintenanceWindow.Time, - "day_of_the_week": *cluster.Properties.MaintenanceWindow.DayOfTheWeek, - }, - }); err != nil { - return err - } + if len(cluster.Properties.ViableNodePoolVersions) > 0 { + var viableNodePoolVersions []interface{} + for _, viableNodePoolVersion := range cluster.Properties.ViableNodePoolVersions { + viableNodePoolVersions = append(viableNodePoolVersions, viableNodePoolVersion) } - - if cluster.Properties.ViableNodePoolVersions != nil && len(*cluster.Properties.ViableNodePoolVersions) > 0 { - var viableNodePoolVersions []interface{} - for _, viableNodePoolVersion := range *cluster.Properties.ViableNodePoolVersions { - viableNodePoolVersions = append(viableNodePoolVersions, viableNodePoolVersion) - } - if err := d.Set("viable_node_pool_versions", viableNodePoolVersions); err != nil { - return err - } + if err := d.Set("viable_node_pool_versions", viableNodePoolVersions); err != nil { + return err } + } - if cluster.Properties.Public != nil { - if err := d.Set("public", *cluster.Properties.Public); err != nil { - return utils.GenerateSetError(constant.K8sClusterResource, "public", err) - } + if cluster.Properties.Public != nil { + if err := d.Set("public", *cluster.Properties.Public); err != nil { + return utils.GenerateSetError(constant.K8sClusterResource, "public", err) } + } - if cluster.Properties.Location != nil { - if err := d.Set("location", *cluster.Properties.Location); err != nil { - return utils.GenerateSetError(constant.K8sClusterResource, "location", err) - } + if cluster.Properties.Location != nil { + if err := d.Set("location", *cluster.Properties.Location); err != nil { + return utils.GenerateSetError(constant.K8sClusterResource, "location", err) } + } - if cluster.Properties.NatGatewayIp != nil { - if err := d.Set("nat_gateway_ip", *cluster.Properties.NatGatewayIp); err != nil { - return utils.GenerateSetError(constant.K8sClusterResource, "nat_gateway_ip", err) - } + if cluster.Properties.NatGatewayIp != nil { + if err := d.Set("nat_gateway_ip", *cluster.Properties.NatGatewayIp); err != nil { + return utils.GenerateSetError(constant.K8sClusterResource, "nat_gateway_ip", err) } + } - if cluster.Properties.NodeSubnet != nil { - if err := d.Set("node_subnet", *cluster.Properties.NodeSubnet); err != nil { - return utils.GenerateSetError(constant.K8sClusterResource, "node_subnet", err) - } + if cluster.Properties.NodeSubnet != nil { + if err := d.Set("node_subnet", *cluster.Properties.NodeSubnet); err != nil { + return utils.GenerateSetError(constant.K8sClusterResource, "node_subnet", err) } + } - if cluster.Properties.ApiSubnetAllowList != nil { - apiSubnetAllowLists := make([]interface{}, len(*cluster.Properties.ApiSubnetAllowList), len(*cluster.Properties.ApiSubnetAllowList)) - for i, apiSubnetAllowList := range *cluster.Properties.ApiSubnetAllowList { - apiSubnetAllowLists[i] = apiSubnetAllowList - } - if err := d.Set("api_subnet_allow_list", apiSubnetAllowLists); err != nil { - return fmt.Errorf("error while setting api_subnet_allow_list property for cluster with ID: %s, error: %w", d.Id(), err) - } - } else { - var emptySlice []interface{} - if err := d.Set("api_subnet_allow_list", emptySlice); err != nil { - return fmt.Errorf("error while setting api_subnet_allow_list property for cluster with ID: %s, error: %w", d.Id(), err) - } + if cluster.Properties.ApiSubnetAllowList != nil { + apiSubnetAllowLists := make([]interface{}, len(cluster.Properties.ApiSubnetAllowList), len(cluster.Properties.ApiSubnetAllowList)) + for i, apiSubnetAllowList := range cluster.Properties.ApiSubnetAllowList { + apiSubnetAllowLists[i] = apiSubnetAllowList } - - if cluster.Properties.S3Buckets != nil { - s3Buckets := make([]interface{}, len(*cluster.Properties.S3Buckets), len(*cluster.Properties.S3Buckets)) - for i, s3Bucket := range *cluster.Properties.S3Buckets { - s3BucketEntry := make(map[string]interface{}) - s3BucketEntry["name"] = *s3Bucket.Name - s3Buckets[i] = s3BucketEntry - } - if err := d.Set("s3_buckets", s3Buckets); err != nil { - return fmt.Errorf("error while setting s3_buckets property for cluser %s: %w", d.Id(), err) - } + if err := d.Set("api_subnet_allow_list", apiSubnetAllowLists); err != nil { + return fmt.Errorf("error while setting api_subnet_allow_list property for cluster with ID: %s, error: %w", d.Id(), err) + } + } else { + var emptySlice []interface{} + if err := d.Set("api_subnet_allow_list", emptySlice); err != nil { + return fmt.Errorf("error while setting api_subnet_allow_list property for cluster with ID: %s, error: %w", d.Id(), err) } + } + if cluster.Properties.S3Buckets != nil { + s3Buckets := make([]interface{}, len(cluster.Properties.S3Buckets), len(cluster.Properties.S3Buckets)) + for i, s3Bucket := range cluster.Properties.S3Buckets { + s3BucketEntry := make(map[string]interface{}) + s3BucketEntry["name"] = s3Bucket.Name + s3Buckets[i] = s3BucketEntry + } + if err := d.Set("s3_buckets", s3Buckets); err != nil { + return fmt.Errorf("error while setting s3_buckets property for cluser %s: %w", d.Id(), err) + } } return nil diff --git a/ionoscloud/resource_k8s_cluster_test.go b/ionoscloud/resource_k8s_cluster_test.go index 550e08932..234ba8ad5 100644 --- a/ionoscloud/resource_k8s_cluster_test.go +++ b/ionoscloud/resource_k8s_cluster_test.go @@ -9,7 +9,7 @@ import ( "regexp" "testing" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/utils/constant" diff --git a/ionoscloud/resource_k8s_node_pool.go b/ionoscloud/resource_k8s_node_pool.go index 806a7a782..94299ac95 100644 --- a/ionoscloud/resource_k8s_node_pool.go +++ b/ionoscloud/resource_k8s_node_pool.go @@ -4,6 +4,7 @@ import ( "context" "encoding/json" "fmt" + "github.com/ionos-cloud/sdk-go-bundle/shared" "log" "reflect" "strings" @@ -16,7 +17,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" ) func resourceK8sNodePool() *schema.Resource { @@ -340,7 +341,7 @@ func getLanResourceData(lansList *schema.Set) []ionoscloud.KubernetesNodePoolLan if lanID, lanIdOk := lanContent["id"].(int); lanIdOk { log.Printf("[INFO] Adding LAN %v to node pool...", lanID) lanID := int32(lanID) - lan.Id = &lanID + lan.Id = lanID } if lanDhcp, lanDhcpOk := lanContent["dhcp"].(bool); lanDhcpOk { @@ -372,7 +373,7 @@ func getLanResourceData(lansList *schema.Set) []ionoscloud.KubernetesNodePoolLan log.Printf("[INFO] k8s node pool LanRoutes set to %+v", routes) } - lan.Routes = &routes + lan.Routes = routes lans = append(lans, lan) } } @@ -397,9 +398,9 @@ func getAutoscalingData(d *schema.ResourceData) (*ionoscloud.KubernetesAutoScali } log.Printf("[INFO] Setting Autoscaling minimum node count to : %d", asmnVal) - autoscaling.MinNodeCount = &asmnVal + autoscaling.MinNodeCount = asmnVal log.Printf("[INFO] Setting Autoscaling maximum node count to : %d", asmxnVal) - autoscaling.MaxNodeCount = &asmxnVal + autoscaling.MaxNodeCount = asmxnVal } return &autoscaling, nil @@ -419,17 +420,17 @@ func resourcek8sNodePoolCreate(ctx context.Context, d *schema.ResourceData, meta ramSize := int32(d.Get("ram_size").(int)) k8sNodepool := ionoscloud.KubernetesNodePoolForPost{ - Properties: &ionoscloud.KubernetesNodePoolPropertiesForPost{ - AvailabilityZone: &availabilityZone, - CoresCount: &coresCount, - CpuFamily: &cpuFamily, - DatacenterId: &datacenterId, + Properties: ionoscloud.KubernetesNodePoolPropertiesForPost{ + AvailabilityZone: availabilityZone, + CoresCount: coresCount, + CpuFamily: cpuFamily, + DatacenterId: datacenterId, K8sVersion: &k8sVersion, - Name: &name, - NodeCount: &nodeCount, - RamSize: &ramSize, - StorageSize: &storageSize, - StorageType: &storageType, + Name: name, + NodeCount: nodeCount, + RamSize: ramSize, + StorageSize: storageSize, + StorageType: storageType, }, } @@ -440,12 +441,12 @@ func resourcek8sNodePoolCreate(ctx context.Context, d *schema.ResourceData, meta if mtVal, mtOk := d.GetOk("maintenance_window.0.time"); mtOk { log.Printf("[INFO] Setting Maintenance Window Time to : %s", mtVal.(string)) mtVal := mtVal.(string) - k8sNodepool.Properties.MaintenanceWindow.Time = &mtVal + k8sNodepool.Properties.MaintenanceWindow.Time = mtVal } if mdVal, mdOk := d.GetOk("maintenance_window.0.day_of_the_week"); mdOk { mdVal := mdVal.(string) - k8sNodepool.Properties.MaintenanceWindow.DayOfTheWeek = &mdVal + k8sNodepool.Properties.MaintenanceWindow.DayOfTheWeek = mdVal } if autoscaling, err := getAutoscalingData(d); err != nil { @@ -454,7 +455,7 @@ func resourcek8sNodePoolCreate(ctx context.Context, d *schema.ResourceData, meta k8sNodepool.Properties.AutoScaling = autoscaling } - if k8sNodepool.Properties.AutoScaling != nil && k8sNodepool.Properties.AutoScaling.MinNodeCount != nil && *k8sNodepool.Properties.NodeCount < *k8sNodepool.Properties.AutoScaling.MinNodeCount { + if k8sNodepool.Properties.AutoScaling != nil && k8sNodepool.Properties.NodeCount < k8sNodepool.Properties.AutoScaling.MinNodeCount { d.SetId("") diags := diag.FromErr(fmt.Errorf("error creating k8s node pool: node_count cannot be lower than min_node_count")) return diags @@ -463,7 +464,7 @@ func resourcek8sNodePoolCreate(ctx context.Context, d *schema.ResourceData, meta if lansVal, lansOK := d.GetOk("lans"); lansOK { lansList := lansVal.(*schema.Set) lans := getLanResourceData(lansList) - k8sNodepool.Properties.Lans = &lans + k8sNodepool.Properties.Lans = lans } publicIpsProp, ok := d.GetOk("public_ips") @@ -471,8 +472,8 @@ func resourcek8sNodePoolCreate(ctx context.Context, d *schema.ResourceData, meta publicIps := publicIpsProp.([]interface{}) /* number of public IPs needs to be at least NodeCount + 1 */ - if len(publicIps) > 0 && int32(len(publicIps)) < *k8sNodepool.Properties.NodeCount+1 { - diags := diag.FromErr(fmt.Errorf("the number of public IPs must be at least %d", *k8sNodepool.Properties.NodeCount+1)) + if len(publicIps) > 0 && int32(len(publicIps)) < k8sNodepool.Properties.NodeCount+1 { + diags := diag.FromErr(fmt.Errorf("the number of public IPs must be at least %d", k8sNodepool.Properties.NodeCount+1)) return diags } @@ -480,7 +481,7 @@ func resourcek8sNodePoolCreate(ctx context.Context, d *schema.ResourceData, meta for i := range publicIps { requestPublicIps = append(requestPublicIps, fmt.Sprint(publicIps[i])) } - k8sNodepool.Properties.PublicIps = &requestPublicIps + k8sNodepool.Properties.PublicIps = requestPublicIps } // if gatewayIp, gatewayIpOk := d.GetOk("gateway_ip"); gatewayIpOk { @@ -580,8 +581,8 @@ func resourcek8sNodePoolUpdate(ctx context.Context, d *schema.ResourceData, meta nodeCount := int32(d.Get("node_count").(int)) - request.Properties = &ionoscloud.KubernetesNodePoolPropertiesForPut{ - NodeCount: &nodeCount, + request.Properties = ionoscloud.KubernetesNodePoolPropertiesForPut{ + NodeCount: nodeCount, } if d.HasChange("node_count") { @@ -602,7 +603,7 @@ func resourcek8sNodePoolUpdate(ctx context.Context, d *schema.ResourceData, meta request.Properties.AutoScaling = autoscaling } - if request.Properties.AutoScaling != nil && request.Properties.AutoScaling.MinNodeCount != nil && *request.Properties.NodeCount < *request.Properties.AutoScaling.MinNodeCount { + if request.Properties.AutoScaling != nil && request.Properties.NodeCount < request.Properties.AutoScaling.MinNodeCount { d.SetId("") diags := diag.FromErr(fmt.Errorf("error creating k8s node pool: node_count cannot be lower than min_node_count")) return diags @@ -623,7 +624,7 @@ func resourcek8sNodePoolUpdate(ctx context.Context, d *schema.ResourceData, meta lansList := newLANs.(*schema.Set) lans := getLanResourceData(lansList) log.Printf("[INFO] k8s node pool LANs changed from %+v to %+v", oldLANs, newLANs) - request.Properties.Lans = &lans + request.Properties.Lans = lans } if d.HasChange("maintenance_window.0") { @@ -636,8 +637,8 @@ func resourcek8sNodePoolUpdate(ctx context.Context, d *schema.ResourceData, meta dayOfTheWeek := d.Get("maintenance_window.0.day_of_the_week").(string) timeS := d.Get("maintenance_window.0.time").(string) maintenanceWindow := &ionoscloud.KubernetesMaintenanceWindow{ - DayOfTheWeek: &dayOfTheWeek, - Time: &timeS, + DayOfTheWeek: dayOfTheWeek, + Time: timeS, } if d.HasChange("maintenance_window.0.day_of_the_week") { @@ -647,7 +648,7 @@ func resourcek8sNodePoolUpdate(ctx context.Context, d *schema.ResourceData, meta log.Printf("[INFO] k8s node pool maintenance window DOW changed from %+v to %+v", oldMd, newMd) updateMaintenanceWindow = true newMd := newMd.(string) - maintenanceWindow.DayOfTheWeek = &newMd + maintenanceWindow.DayOfTheWeek = newMd } } @@ -657,7 +658,7 @@ func resourcek8sNodePoolUpdate(ctx context.Context, d *schema.ResourceData, meta log.Printf("[INFO] k8s node pool maintenance window time changed from %+v to %+v", oldMt, newMt) updateMaintenanceWindow = true newMt := newMt.(string) - maintenanceWindow.Time = &newMt + maintenanceWindow.Time = newMt } } @@ -677,8 +678,8 @@ func resourcek8sNodePoolUpdate(ctx context.Context, d *schema.ResourceData, meta publicIps := newPublicIps.([]interface{}) /* number of public IPs needs to be at least NodeCount + 1 */ - if len(publicIps) > 0 && int32(len(publicIps)) < *request.Properties.NodeCount+1 { - diags := diag.FromErr(fmt.Errorf("the number of public IPs must be at least %d", *request.Properties.NodeCount+1)) + if len(publicIps) > 0 && int32(len(publicIps)) < request.Properties.NodeCount+1 { + diags := diag.FromErr(fmt.Errorf("the number of public IPs must be at least %d", request.Properties.NodeCount+1)) return diags } @@ -687,7 +688,7 @@ func resourcek8sNodePoolUpdate(ctx context.Context, d *schema.ResourceData, meta } } - request.Properties.PublicIps = &requestPublicIps + request.Properties.PublicIps = requestPublicIps } @@ -823,7 +824,7 @@ func resourceK8sNodepoolImport(ctx context.Context, d *schema.ResourceData, meta logApiRequestTime(apiResponse) if err != nil { - if _, ok := err.(ionoscloud.GenericOpenAPIError); ok { + if _, ok := err.(shared.GenericOpenAPIError); ok { if httpNotFound(apiResponse) { d.SetId("") return nil, fmt.Errorf("unable to find k8s node pool %q", npId) @@ -852,136 +853,114 @@ func setK8sNodePoolData(d *schema.ResourceData, nodePool *ionoscloud.KubernetesN d.SetId(*nodePool.Id) } - if nodePool.Properties != nil { - if nodePool.Properties.Name != nil { - if err := d.Set("name", *nodePool.Properties.Name); err != nil { - return err - } - } + if err := d.Set("name", nodePool.Properties.Name); err != nil { + return err + } - if nodePool.Properties.DatacenterId != nil { - if err := d.Set("datacenter_id", *nodePool.Properties.DatacenterId); err != nil { - return err - } - } + if err := d.Set("datacenter_id", nodePool.Properties.DatacenterId); err != nil { + return err + } - if nodePool.Properties.NodeCount != nil { - if err := d.Set("node_count", *nodePool.Properties.NodeCount); err != nil { - return err - } - } + if err := d.Set("node_count", nodePool.Properties.NodeCount); err != nil { + return err + } - if nodePool.Properties.CpuFamily != nil { - if err := d.Set("cpu_family", *nodePool.Properties.CpuFamily); err != nil { - return err - } - } + if err := d.Set("cpu_family", nodePool.Properties.CpuFamily); err != nil { + return err + } - if nodePool.Properties.CoresCount != nil { - if err := d.Set("cores_count", *nodePool.Properties.CoresCount); err != nil { - return err - } - } + if err := d.Set("cores_count", nodePool.Properties.CoresCount); err != nil { + return err + } - if nodePool.Properties.RamSize != nil { - if err := d.Set("ram_size", *nodePool.Properties.RamSize); err != nil { - return err - } - } + if err := d.Set("ram_size", nodePool.Properties.RamSize); err != nil { + return err + } - if nodePool.Properties.AvailabilityZone != nil { - if err := d.Set("availability_zone", *nodePool.Properties.AvailabilityZone); err != nil { - return err - } - } + if err := d.Set("availability_zone", nodePool.Properties.AvailabilityZone); err != nil { + return err + } - if nodePool.Properties.StorageType != nil { - if err := d.Set("storage_type", *nodePool.Properties.StorageType); err != nil { - return err - } - } + if err := d.Set("storage_type", nodePool.Properties.StorageType); err != nil { + return err + } - if nodePool.Properties.StorageSize != nil { - if err := d.Set("storage_size", *nodePool.Properties.StorageSize); err != nil { - return err - } - } + if err := d.Set("storage_size", nodePool.Properties.StorageSize); err != nil { + return err + } - if nodePool.Properties.K8sVersion != nil { - if err := d.Set("k8s_version", *nodePool.Properties.K8sVersion); err != nil { - return err - } + if nodePool.Properties.K8sVersion != nil { + if err := d.Set("k8s_version", *nodePool.Properties.K8sVersion); err != nil { + return err } + } - if nodePool.Properties.PublicIps != nil && len(*nodePool.Properties.PublicIps) > 0 { - if err := d.Set("public_ips", *nodePool.Properties.PublicIps); err != nil { - return err - } + if len(nodePool.Properties.PublicIps) > 0 { + if err := d.Set("public_ips", nodePool.Properties.PublicIps); err != nil { + return err } + } - if nodePool.Properties.MaintenanceWindow != nil && nodePool.Properties.MaintenanceWindow.Time != nil && nodePool.Properties.MaintenanceWindow.DayOfTheWeek != nil { - if err := d.Set("maintenance_window", []map[string]string{ - { - "time": *nodePool.Properties.MaintenanceWindow.Time, - "day_of_the_week": *nodePool.Properties.MaintenanceWindow.DayOfTheWeek, - }, - }); err != nil { - return err - } + if nodePool.Properties.MaintenanceWindow != nil { + if err := d.Set("maintenance_window", []map[string]string{ + { + "time": nodePool.Properties.MaintenanceWindow.Time, + "day_of_the_week": nodePool.Properties.MaintenanceWindow.DayOfTheWeek, + }, + }); err != nil { + return err } + } - if nodePool.Properties.AutoScaling != nil && nodePool.Properties.AutoScaling.MinNodeCount != nil && - nodePool.Properties.AutoScaling.MaxNodeCount != nil && (*nodePool.Properties.AutoScaling.MinNodeCount != 0 && - *nodePool.Properties.AutoScaling.MaxNodeCount != 0) { - if err := d.Set("auto_scaling", []map[string]uint32{ - { - "min_node_count": uint32(*nodePool.Properties.AutoScaling.MinNodeCount), - "max_node_count": uint32(*nodePool.Properties.AutoScaling.MaxNodeCount), - }, - }); err != nil { - return err - } + if nodePool.Properties.AutoScaling != nil && (nodePool.Properties.AutoScaling.MinNodeCount != 0 && + nodePool.Properties.AutoScaling.MaxNodeCount != 0) { + if err := d.Set("auto_scaling", []map[string]uint32{ + { + "min_node_count": uint32(nodePool.Properties.AutoScaling.MinNodeCount), + "max_node_count": uint32(nodePool.Properties.AutoScaling.MaxNodeCount), + }, + }); err != nil { + return err } + } - if nodePool.Properties.Lans != nil && len(*nodePool.Properties.Lans) > 0 { + if len(nodePool.Properties.Lans) > 0 { - nodePoolLans := getK8sNodePoolLans(*nodePool.Properties.Lans) - - if err := d.Set("lans", nodePoolLans); err != nil { - return fmt.Errorf("error while setting lans property for k8sNodepool %s: %w", d.Id(), err) - } + nodePoolLans := getK8sNodePoolLans(nodePool.Properties.Lans) + if err := d.Set("lans", nodePoolLans); err != nil { + return fmt.Errorf("error while setting lans property for k8sNodepool %s: %w", d.Id(), err) } - // if nodePool.Properties.GatewayIp != nil { - // if err := d.Set("gateway_ip", *nodePool.Properties.GatewayIp); err != nil { - // return fmt.Errorf("error while setting gateway_ip property for nodepool %s: %w", d.Id(), err) - // } - //} - - labels := make(map[string]interface{}) - if nodePool.Properties.Labels != nil && len(*nodePool.Properties.Labels) > 0 { - for k, v := range *nodePool.Properties.Labels { - labels[k] = v - } - } + } - if err := d.Set("labels", labels); err != nil { - return fmt.Errorf("error while setting the labels property for k8sNodepool %s: %w", d.Id(), err) + // if nodePool.Properties.GatewayIp != nil { + // if err := d.Set("gateway_ip", *nodePool.Properties.GatewayIp); err != nil { + // return fmt.Errorf("error while setting gateway_ip property for nodepool %s: %w", d.Id(), err) + // } + //} + labels := make(map[string]interface{}) + if nodePool.Properties.Labels != nil && len(*nodePool.Properties.Labels) > 0 { + for k, v := range *nodePool.Properties.Labels { + labels[k] = v } + } - annotations := make(map[string]interface{}) - if nodePool.Properties.Annotations != nil && len(*nodePool.Properties.Annotations) > 0 { - for k, v := range *nodePool.Properties.Annotations { - annotations[k] = v - } - } + if err := d.Set("labels", labels); err != nil { + return fmt.Errorf("error while setting the labels property for k8sNodepool %s: %w", d.Id(), err) + + } - if err := d.Set("annotations", annotations); err != nil { - return fmt.Errorf("error while setting the annotations property for k8sNodepool %s: %w", d.Id(), err) + annotations := make(map[string]interface{}) + if nodePool.Properties.Annotations != nil && len(*nodePool.Properties.Annotations) > 0 { + for k, v := range *nodePool.Properties.Annotations { + annotations[k] = v } + } + if err := d.Set("annotations", annotations); err != nil { + return fmt.Errorf("error while setting the annotations property for k8sNodepool %s: %w", d.Id(), err) } return nil @@ -1027,17 +1006,15 @@ func getK8sNodePoolLans(lans []ionoscloud.KubernetesNodePoolLan) []interface{} { for _, nodePoolLan := range lans { lanEntry := make(map[string]interface{}) - if nodePoolLan.Id != nil { - lanEntry["id"] = *nodePoolLan.Id - } + lanEntry["id"] = nodePoolLan.Id if nodePoolLan.Dhcp != nil { lanEntry["dhcp"] = *nodePoolLan.Dhcp } - if nodePoolLan.Routes != nil && len(*nodePoolLan.Routes) > 0 { + if len(nodePoolLan.Routes) > 0 { var nodePoolRoutes []interface{} - for _, nodePoolRoute := range *nodePoolLan.Routes { + for _, nodePoolRoute := range nodePoolLan.Routes { routeEntry := make(map[string]string) if nodePoolRoute.Network != nil { routeEntry["network"] = *nodePoolRoute.Network diff --git a/ionoscloud/resource_k8s_node_pool_test.go b/ionoscloud/resource_k8s_node_pool_test.go index 8b0689a17..20bffdfac 100644 --- a/ionoscloud/resource_k8s_node_pool_test.go +++ b/ionoscloud/resource_k8s_node_pool_test.go @@ -10,7 +10,7 @@ import ( "regexp" "testing" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/utils/constant" diff --git a/ionoscloud/resource_lan.go b/ionoscloud/resource_lan.go index 2819f700a..ecf68d3f0 100644 --- a/ionoscloud/resource_lan.go +++ b/ionoscloud/resource_lan.go @@ -16,7 +16,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" ) func resourceLan() *schema.Resource { @@ -91,7 +91,7 @@ func resourceLanCreate(ctx context.Context, d *schema.ResourceData, meta interfa client := meta.(services.SdkBundle).CloudApiClient public := d.Get("public").(bool) request := ionoscloud.Lan{ - Properties: &ionoscloud.LanProperties{ + Properties: ionoscloud.LanProperties{ Public: &public, }, } @@ -110,7 +110,9 @@ func resourceLanCreate(ctx context.Context, d *schema.ResourceData, meta interfa if d.Get("ipv6_cidr_block") != nil { ipv6 := d.Get("ipv6_cidr_block").(string) log.Printf("[INFO] Setting ipv6CidrBlock for LAN %s to %s...", d.Id(), ipv6) - request.Properties.Ipv6CidrBlock = &ipv6 + ipv6NulString := ionoscloud.NullableString{} + ipv6NulString.Set(&ipv6) + request.Properties.Ipv6CidrBlock = ipv6NulString } else { request.Properties.SetIpv6CidrBlockNil() } @@ -222,7 +224,9 @@ func resourceLanUpdate(ctx context.Context, d *schema.ResourceData, meta interfa if newIpv6 != nil && newIpv6.(string) != "" { log.Printf("[INFO] Setting ipv6CidrBlock for LAN %s to %s...", d.Id(), newIpv6.(string)) ipv6 := newIpv6.(string) - properties.Ipv6CidrBlock = &ipv6 + ipv6NulStr := ionoscloud.NullableString{} + ipv6NulStr.Set(&ipv6) + properties.Ipv6CidrBlock = ipv6NulStr } else { properties.SetIpv6CidrBlockNil() } @@ -308,38 +312,36 @@ func resourceLanImport(ctx context.Context, d *schema.ResourceData, meta interfa func setLanData(d *schema.ResourceData, lan *ionoscloud.Lan) error { d.SetId(*lan.Id) - if lan.Properties != nil { - if lan.Properties.Name != nil { - if err := d.Set("name", *lan.Properties.Name); err != nil { - return err - } + if lan.Properties.Name != nil { + if err := d.Set("name", *lan.Properties.Name); err != nil { + return err } - if lan.Properties.IpFailover != nil && len(*lan.Properties.IpFailover) > 0 { - if err := d.Set("ip_failover", convertIpFailoverList(lan.Properties.IpFailover)); err != nil { - return err - } + } + if len(lan.Properties.IpFailover) > 0 { + if err := d.Set("ip_failover", convertIpFailoverList(&lan.Properties.IpFailover)); err != nil { + return err } - if lan.Properties.Pcc != nil { - if err := d.Set("pcc", *lan.Properties.Pcc); err != nil { - return err - } + } + if lan.Properties.Pcc != nil { + if err := d.Set("pcc", *lan.Properties.Pcc); err != nil { + return err } - if lan.Properties.Public != nil { - if err := d.Set("public", *lan.Properties.Public); err != nil { - return err - } + } + if lan.Properties.Public != nil { + if err := d.Set("public", *lan.Properties.Public); err != nil { + return err } + } - if lan.Properties.Ipv4CidrBlock != nil { - if err := d.Set("ipv4_cidr_block", *lan.Properties.Ipv4CidrBlock); err != nil { - return utils.GenerateSetError("lan", "ipv4_cidr_block", err) - } + if lan.Properties.Ipv4CidrBlock.IsSet() && lan.Properties.Ipv4CidrBlock.Get() != nil { + if err := d.Set("ipv4_cidr_block", *lan.Properties.Ipv4CidrBlock.Get()); err != nil { + return utils.GenerateSetError("lan", "ipv4_cidr_block", err) } + } - if lan.Properties.Ipv6CidrBlock != nil { - if err := d.Set("ipv6_cidr_block", *lan.Properties.Ipv6CidrBlock); err != nil { - return utils.GenerateSetError("lan", "ipv6_cidr_block", err) - } + if lan.Properties.Ipv6CidrBlock.IsSet() && lan.Properties.Ipv6CidrBlock.Get() != nil { + if err := d.Set("ipv6_cidr_block", *lan.Properties.Ipv6CidrBlock.Get()); err != nil { + return utils.GenerateSetError("lan", "ipv6_cidr_block", err) } } @@ -417,7 +419,7 @@ func lanNicsDeleted(ctx context.Context, client *ionoscloud.APIClient, d *schema return false, fmt.Errorf("an error occurred while searching for nics in datacenter with id: %s for lan with: id %s %w", dcId, d.Id(), err) } - if nics.Items != nil && len(*nics.Items) > 0 { + if len(nics.Items) > 0 { log.Printf("[INFO] there are still nics under LAN with id %s", d.Id()) return false, nil } diff --git a/ionoscloud/resource_lan_test.go b/ionoscloud/resource_lan_test.go index 975bc8124..4b7fee591 100644 --- a/ionoscloud/resource_lan_test.go +++ b/ionoscloud/resource_lan_test.go @@ -8,7 +8,7 @@ import ( "regexp" "testing" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/utils/constant" diff --git a/ionoscloud/resource_loadbalancer.go b/ionoscloud/resource_loadbalancer.go index 9ffadf7db..12fe84359 100644 --- a/ionoscloud/resource_loadbalancer.go +++ b/ionoscloud/resource_loadbalancer.go @@ -12,7 +12,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" ) func resourceLoadbalancer() *schema.Resource { @@ -72,12 +72,12 @@ func resourceLoadbalancerCreate(ctx context.Context, d *schema.ResourceData, met name := d.Get("name").(string) lb := &ionoscloud.Loadbalancer{ - Properties: &ionoscloud.LoadbalancerProperties{ + Properties: ionoscloud.LoadbalancerProperties{ Name: &name, }, Entities: &ionoscloud.LoadbalancerEntities{ Balancednics: &ionoscloud.BalancedNics{ - Items: &nicIds, + Items: nicIds, }, }, } @@ -125,8 +125,8 @@ func resourceLoadbalancerRead(ctx context.Context, d *schema.ResourceData, meta } } - if lb.Properties.Ip != nil { - if err := d.Set("ip", *lb.Properties.Ip); err != nil { + if lb.Properties.Ip.IsSet() && lb.Properties.Ip.Get() != nil { + if err := d.Set("ip", *lb.Properties.Ip.Get()); err != nil { diags := diag.FromErr(fmt.Errorf("")) return diags } @@ -157,7 +157,9 @@ func resourceLoadbalancerUpdate(ctx context.Context, d *schema.ResourceData, met if d.HasChange("ip") { _, newVal := d.GetChange("ip") ip := newVal.(string) - properties.Ip = &ip + ipNulStr := ionoscloud.NullableString{} + ipNulStr.Set(&ip) + properties.Ip = ipNulStr hasChangeCount++ } if d.HasChange("dhcp") { @@ -278,8 +280,8 @@ func resourceLoadbalancerImporter(ctx context.Context, d *schema.ResourceData, m } } - if loadbalancer.Properties.Ip != nil { - if err := d.Set("ip", *loadbalancer.Properties.Ip); err != nil { + if loadbalancer.Properties.Ip.IsSet() && loadbalancer.Properties.Ip.Get() != nil { + if err := d.Set("ip", *loadbalancer.Properties.Ip.Get()); err != nil { return nil, err } } @@ -291,10 +293,10 @@ func resourceLoadbalancerImporter(ctx context.Context, d *schema.ResourceData, m } if loadbalancer.Entities != nil && loadbalancer.Entities.Balancednics != nil && - loadbalancer.Entities.Balancednics.Items != nil && len(*loadbalancer.Entities.Balancednics.Items) > 0 { + len(loadbalancer.Entities.Balancednics.Items) > 0 { var lans []string - for _, lan := range *loadbalancer.Entities.Balancednics.Items { + for _, lan := range loadbalancer.Entities.Balancednics.Items { if *lan.Id != "" { lans = append(lans, *lan.Id) } diff --git a/ionoscloud/resource_loadbalancer_test.go b/ionoscloud/resource_loadbalancer_test.go index 0d0b5e167..556547b8f 100644 --- a/ionoscloud/resource_loadbalancer_test.go +++ b/ionoscloud/resource_loadbalancer_test.go @@ -8,7 +8,7 @@ import ( "fmt" "testing" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/utils/constant" diff --git a/ionoscloud/resource_natgateway.go b/ionoscloud/resource_natgateway.go index 7994f7dd1..33b5d2f5a 100644 --- a/ionoscloud/resource_natgateway.go +++ b/ionoscloud/resource_natgateway.go @@ -12,7 +12,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" ) func resourceNatGateway() *schema.Resource { @@ -81,8 +81,8 @@ func resourceNatGatewayCreate(ctx context.Context, d *schema.ResourceData, meta name := d.Get("name").(string) natGateway := ionoscloud.NatGateway{ - Properties: &ionoscloud.NatGatewayProperties{ - Name: &name, + Properties: ionoscloud.NatGatewayProperties{ + Name: name, }, } @@ -93,7 +93,7 @@ func resourceNatGatewayCreate(ctx context.Context, d *schema.ResourceData, meta for _, publicIp := range publicIpsVal { publicIps = append(publicIps, publicIp.(string)) } - natGateway.Properties.PublicIps = &publicIps + natGateway.Properties.PublicIps = publicIps } else { diags := diag.FromErr(fmt.Errorf("you must provide public_ips for nat gateway resource \n")) return diags @@ -110,7 +110,7 @@ func resourceNatGatewayCreate(ctx context.Context, d *schema.ResourceData, meta addLan := false if lanID, lanIdOk := d.GetOk(fmt.Sprintf("lans.%d.id", lanIndex)); lanIdOk { lanID := int32(lanID.(int)) - lan.Id = &lanID + lan.Id = lanID addLan = true } if lanGatewayIps, lanGatewayIpsOk := d.GetOk(fmt.Sprintf("lans.%d.gateway_ips", lanIndex)); lanGatewayIpsOk { @@ -120,7 +120,7 @@ func resourceNatGatewayCreate(ctx context.Context, d *schema.ResourceData, meta for idx := range lanGatewayIps { gatewayIps[idx] = fmt.Sprint(lanGatewayIps[idx]) } - lan.GatewayIps = &gatewayIps + lan.GatewayIps = gatewayIps } } if addLan { @@ -134,7 +134,7 @@ func resourceNatGatewayCreate(ctx context.Context, d *schema.ResourceData, meta if updateLans == true { log.Printf("[INFO] NatGateway LANs set to %+v", lans) - natGateway.Properties.Lans = &lans + natGateway.Properties.Lans = lans } else { diags := diag.FromErr(fmt.Errorf("you must provide lans for the nat gateway resource \n")) return diags @@ -195,7 +195,7 @@ func resourceNatGatewayRead(ctx context.Context, d *schema.ResourceData, meta in func resourceNatGatewayUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { client := meta.(services.SdkBundle).CloudApiClient request := ionoscloud.NatGateway{ - Properties: &ionoscloud.NatGatewayProperties{}, + Properties: ionoscloud.NatGatewayProperties{}, } dcId := d.Get("datacenter_id").(string) @@ -203,7 +203,7 @@ func resourceNatGatewayUpdate(ctx context.Context, d *schema.ResourceData, meta if d.HasChange("name") { _, v := d.GetChange("name") vStr := v.(string) - request.Properties.Name = &vStr + request.Properties.Name = vStr } if d.HasChange("public_ips") { @@ -215,7 +215,7 @@ func resourceNatGatewayUpdate(ctx context.Context, d *schema.ResourceData, meta for _, publicIp := range publicIpsVal { publicIps = append(publicIps, publicIp.(string)) } - request.Properties.PublicIps = &publicIps + request.Properties.PublicIps = publicIps } } @@ -230,7 +230,7 @@ func resourceNatGatewayUpdate(ctx context.Context, d *schema.ResourceData, meta addLan := false if lanID, lanIdOk := d.GetOk(fmt.Sprintf("lans.%d.id", lanIndex)); lanIdOk { lanID := int32(lanID.(int)) - lan.Id = &lanID + lan.Id = lanID addLan = true } if lanGatewayIps, lanGatewayIpsOk := d.GetOk(fmt.Sprintf("lans.%d.gateway_ips", lanIndex)); lanGatewayIpsOk { @@ -240,7 +240,7 @@ func resourceNatGatewayUpdate(ctx context.Context, d *schema.ResourceData, meta for _, lanGatewayIp := range lanGatewayIps { gatewayIps = append(gatewayIps, lanGatewayIp.(string)) } - lan.GatewayIps = &gatewayIps + lan.GatewayIps = gatewayIps } } if addLan { @@ -254,12 +254,12 @@ func resourceNatGatewayUpdate(ctx context.Context, d *schema.ResourceData, meta if updateLans == true { log.Printf("[INFO] nat gateway LANs changed from %+v to %+v", oldLANs, newLANs) - request.Properties.Lans = &lans + request.Properties.Lans = lans } } } - _, apiResponse, err := client.NATGatewaysApi.DatacentersNatgatewaysPatch(ctx, dcId, d.Id()).NatGatewayProperties(*request.Properties).Execute() + _, apiResponse, err := client.NATGatewaysApi.DatacentersNatgatewaysPatch(ctx, dcId, d.Id()).NatGatewayProperties(request.Properties).Execute() logApiRequestTime(apiResponse) if err != nil { @@ -336,46 +336,38 @@ func setNatGatewayData(d *schema.ResourceData, natGateway *ionoscloud.NatGateway d.SetId(*natGateway.Id) } - if natGateway.Properties != nil { - if natGateway.Properties.Name != nil { - err := d.Set("name", *natGateway.Properties.Name) - if err != nil { - return fmt.Errorf("error while setting name property for nat gateway %s: %w", d.Id(), err) - } - } - - if natGateway.Properties.PublicIps != nil { - err := d.Set("public_ips", *natGateway.Properties.PublicIps) - if err != nil { - return fmt.Errorf("error while setting public_ips property for nat gateway %s: %w", d.Id(), err) - } - } + err := d.Set("name", natGateway.Properties.Name) + if err != nil { + return fmt.Errorf("error while setting name property for nat gateway %s: %w", d.Id(), err) + } - if natGateway.Properties.Lans != nil && len(*natGateway.Properties.Lans) > 0 { - var natGatewayLans []interface{} - for _, lan := range *natGateway.Properties.Lans { - lanEntry := make(map[string]interface{}) + err = d.Set("public_ips", natGateway.Properties.PublicIps) + if err != nil { + return fmt.Errorf("error while setting public_ips property for nat gateway %s: %w", d.Id(), err) + } - if lan.Id != nil { - lanEntry["id"] = *lan.Id - } + if len(natGateway.Properties.Lans) > 0 { + var natGatewayLans []interface{} + for _, lan := range natGateway.Properties.Lans { + lanEntry := make(map[string]interface{}) - if len(*lan.GatewayIps) > 0 { - var gatewayIps []interface{} - for _, gatewayIp := range *lan.GatewayIps { - gatewayIps = append(gatewayIps, gatewayIp) - } - lanEntry["gateway_ips"] = gatewayIps + lanEntry["id"] = lan.Id + if len(lan.GatewayIps) > 0 { + var gatewayIps []interface{} + for _, gatewayIp := range lan.GatewayIps { + gatewayIps = append(gatewayIps, gatewayIp) } + lanEntry["gateway_ips"] = gatewayIps - natGatewayLans = append(natGatewayLans, lanEntry) } - if len(natGatewayLans) > 0 { - if err := d.Set("lans", natGatewayLans); err != nil { - return fmt.Errorf("error while setting lans property for nat gateway %s: %w", d.Id(), err) - } + natGatewayLans = append(natGatewayLans, lanEntry) + } + + if len(natGatewayLans) > 0 { + if err := d.Set("lans", natGatewayLans); err != nil { + return fmt.Errorf("error while setting lans property for nat gateway %s: %w", d.Id(), err) } } } diff --git a/ionoscloud/resource_natgateway_rule.go b/ionoscloud/resource_natgateway_rule.go index 59f1d2c94..15b300029 100644 --- a/ionoscloud/resource_natgateway_rule.go +++ b/ionoscloud/resource_natgateway_rule.go @@ -12,7 +12,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" ) func resourceNatGatewayRule() *schema.Resource { @@ -114,12 +114,12 @@ func resourceNatGatewayRuleCreate(ctx context.Context, d *schema.ResourceData, m client := meta.(services.SdkBundle).CloudApiClient natGatewayRule := ionoscloud.NatGatewayRule{ - Properties: &ionoscloud.NatGatewayRuleProperties{}, + Properties: ionoscloud.NatGatewayRuleProperties{}, } if name, nameOk := d.GetOk("name"); nameOk { name := name.(string) - natGatewayRule.Properties.Name = &name + natGatewayRule.Properties.Name = name } else { diags := diag.FromErr(fmt.Errorf("name must be provided for nat gateway rule")) return diags @@ -127,7 +127,7 @@ func resourceNatGatewayRuleCreate(ctx context.Context, d *schema.ResourceData, m if sourceSubnet, sourceSubnetOk := d.GetOk("source_subnet"); sourceSubnetOk { sourceSubnet := sourceSubnet.(string) - natGatewayRule.Properties.SourceSubnet = &sourceSubnet + natGatewayRule.Properties.SourceSubnet = sourceSubnet } else { diags := diag.FromErr(fmt.Errorf("source subnet must be provided for nat gateway rule")) return diags @@ -135,7 +135,7 @@ func resourceNatGatewayRuleCreate(ctx context.Context, d *schema.ResourceData, m if publicIp, publicIpOk := d.GetOk("public_ip"); publicIpOk { publicIp := publicIp.(string) - natGatewayRule.Properties.PublicIp = &publicIp + natGatewayRule.Properties.PublicIp = publicIp } else { diags := diag.FromErr(fmt.Errorf("public Ip must be provided for nat gateway rule")) return diags @@ -236,7 +236,7 @@ func resourceNatGatewayRuleRead(ctx context.Context, d *schema.ResourceData, met func resourceNatGatewayRuleUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { client := meta.(services.SdkBundle).CloudApiClient request := ionoscloud.NatGatewayRule{ - Properties: &ionoscloud.NatGatewayRuleProperties{}, + Properties: ionoscloud.NatGatewayRuleProperties{}, } dcId := d.Get("datacenter_id").(string) @@ -245,7 +245,7 @@ func resourceNatGatewayRuleUpdate(ctx context.Context, d *schema.ResourceData, m if d.HasChange("name") { _, v := d.GetChange("name") vStr := v.(string) - request.Properties.Name = &vStr + request.Properties.Name = vStr } if d.HasChange("type") { @@ -263,13 +263,13 @@ func resourceNatGatewayRuleUpdate(ctx context.Context, d *schema.ResourceData, m if d.HasChange("source_subnet") { _, v := d.GetChange("source_subnet") vStr := v.(string) - request.Properties.SourceSubnet = &vStr + request.Properties.SourceSubnet = vStr } if d.HasChange("public_ip") { _, v := d.GetChange("public_ip") vStr := v.(string) - request.Properties.PublicIp = &vStr + request.Properties.PublicIp = vStr } if d.HasChange("target_subnet") { @@ -315,7 +315,7 @@ func resourceNatGatewayRuleUpdate(ctx context.Context, d *schema.ResourceData, m _, apiResponse, err := client.NATGatewaysApi. DatacentersNatgatewaysRulesPatch(ctx, dcId, ngId, d.Id()). - NatGatewayRuleProperties(*request.Properties). + NatGatewayRuleProperties(request.Properties). Execute() if err != nil { @@ -397,59 +397,51 @@ func setNatGatewayRuleData(d *schema.ResourceData, natGatewayRule *ionoscloud.Na d.SetId(*natGatewayRule.Id) } - if natGatewayRule.Properties != nil { - if natGatewayRule.Properties.Name != nil { - err := d.Set("name", *natGatewayRule.Properties.Name) - if err != nil { - return fmt.Errorf("error while setting name property for nat gateway %s: %w", d.Id(), err) - } - } + err := d.Set("name", natGatewayRule.Properties.Name) + if err != nil { + return fmt.Errorf("error while setting name property for nat gateway %s: %w", d.Id(), err) + } - if natGatewayRule.Properties.Type != nil { - err := d.Set("type", *natGatewayRule.Properties.Type) - if err != nil { - return fmt.Errorf("error while setting type property for nat gateway %s: %w", d.Id(), err) - } + if natGatewayRule.Properties.Type != nil { + err := d.Set("type", *natGatewayRule.Properties.Type) + if err != nil { + return fmt.Errorf("error while setting type property for nat gateway %s: %w", d.Id(), err) } + } - if natGatewayRule.Properties.Protocol != nil { - err := d.Set("protocol", *natGatewayRule.Properties.Protocol) - if err != nil { - return fmt.Errorf("error while setting protocol property for nat gateway %s: %w", d.Id(), err) - } + if natGatewayRule.Properties.Protocol != nil { + err := d.Set("protocol", *natGatewayRule.Properties.Protocol) + if err != nil { + return fmt.Errorf("error while setting protocol property for nat gateway %s: %w", d.Id(), err) } + } - if natGatewayRule.Properties.SourceSubnet != nil { - err := d.Set("source_subnet", *natGatewayRule.Properties.SourceSubnet) - if err != nil { - return fmt.Errorf("error while setting source_subnet property for nat gateway %s: %w", d.Id(), err) - } - } + err = d.Set("source_subnet", natGatewayRule.Properties.SourceSubnet) + if err != nil { + return fmt.Errorf("error while setting source_subnet property for nat gateway %s: %w", d.Id(), err) + } - if natGatewayRule.Properties.PublicIp != nil { - err := d.Set("public_ip", *natGatewayRule.Properties.PublicIp) - if err != nil { - return fmt.Errorf("error while setting public_ip property for nat gateway %s: %w", d.Id(), err) - } - } + err = d.Set("public_ip", natGatewayRule.Properties.PublicIp) + if err != nil { + return fmt.Errorf("error while setting public_ip property for nat gateway %s: %w", d.Id(), err) + } - if natGatewayRule.Properties.TargetSubnet != nil { - err := d.Set("target_subnet", *natGatewayRule.Properties.TargetSubnet) - if err != nil { - return fmt.Errorf("error while setting target_subnet property for nat gateway %s: %w", d.Id(), err) - } + if natGatewayRule.Properties.TargetSubnet != nil { + err := d.Set("target_subnet", *natGatewayRule.Properties.TargetSubnet) + if err != nil { + return fmt.Errorf("error while setting target_subnet property for nat gateway %s: %w", d.Id(), err) } + } - if natGatewayRule.Properties.TargetPortRange != nil && natGatewayRule.Properties.TargetPortRange.Start != nil && - natGatewayRule.Properties.TargetPortRange.End != nil { - err := d.Set("target_port_range", []map[string]int32{{ - "start": *natGatewayRule.Properties.TargetPortRange.Start, - "end": *natGatewayRule.Properties.TargetPortRange.End, - }, - }) - if err != nil { - return fmt.Errorf("error while setting target_port_range property for nat gateway %s: %w", d.Id(), err) - } + if natGatewayRule.Properties.TargetPortRange != nil && natGatewayRule.Properties.TargetPortRange.Start != nil && + natGatewayRule.Properties.TargetPortRange.End != nil { + err := d.Set("target_port_range", []map[string]int32{{ + "start": *natGatewayRule.Properties.TargetPortRange.Start, + "end": *natGatewayRule.Properties.TargetPortRange.End, + }, + }) + if err != nil { + return fmt.Errorf("error while setting target_port_range property for nat gateway %s: %w", d.Id(), err) } } return nil diff --git a/ionoscloud/resource_natgateway_rule_test.go b/ionoscloud/resource_natgateway_rule_test.go index 4f19776f0..3230b87b6 100644 --- a/ionoscloud/resource_natgateway_rule_test.go +++ b/ionoscloud/resource_natgateway_rule_test.go @@ -9,7 +9,7 @@ import ( "regexp" "testing" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/utils/constant" diff --git a/ionoscloud/resource_natgateway_test.go b/ionoscloud/resource_natgateway_test.go index ece3c7591..4c059788e 100644 --- a/ionoscloud/resource_natgateway_test.go +++ b/ionoscloud/resource_natgateway_test.go @@ -9,7 +9,7 @@ import ( "regexp" "testing" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/utils/constant" diff --git a/ionoscloud/resource_networkloadbalancer.go b/ionoscloud/resource_networkloadbalancer.go index e2b1d00e9..65b5ae4ab 100644 --- a/ionoscloud/resource_networkloadbalancer.go +++ b/ionoscloud/resource_networkloadbalancer.go @@ -15,7 +15,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" ) func resourceNetworkLoadBalancer() *schema.Resource { @@ -103,12 +103,12 @@ func resourceNetworkLoadBalancerCreate(ctx context.Context, d *schema.ResourceDa client := meta.(services.SdkBundle).CloudApiClient networkLoadBalancer := ionoscloud.NetworkLoadBalancer{ - Properties: &ionoscloud.NetworkLoadBalancerProperties{}, + Properties: ionoscloud.NetworkLoadBalancerProperties{}, } if name, nameOk := d.GetOk("name"); nameOk { name := name.(string) - networkLoadBalancer.Properties.Name = &name + networkLoadBalancer.Properties.Name = name } else { diags := diag.FromErr(fmt.Errorf("name must be provided for network loadbalancer")) return diags @@ -116,7 +116,7 @@ func resourceNetworkLoadBalancerCreate(ctx context.Context, d *schema.ResourceDa if listenerLan, listenerLanOk := d.GetOk("listener_lan"); listenerLanOk { listenerLan := int32(listenerLan.(int)) - networkLoadBalancer.Properties.ListenerLan = &listenerLan + networkLoadBalancer.Properties.ListenerLan = listenerLan } else { diags := diag.FromErr(fmt.Errorf("listener lan must be provided for network loadbalancer")) return diags @@ -124,7 +124,7 @@ func resourceNetworkLoadBalancerCreate(ctx context.Context, d *schema.ResourceDa if targetLan, targetLanOk := d.GetOk("target_lan"); targetLanOk { targetLan := int32(targetLan.(int)) - networkLoadBalancer.Properties.TargetLan = &targetLan + networkLoadBalancer.Properties.TargetLan = targetLan } else { diags := diag.FromErr(fmt.Errorf("target lan must be provided for network loadbalancer")) return diags @@ -147,7 +147,7 @@ func resourceNetworkLoadBalancerCreate(ctx context.Context, d *schema.ResourceDa for idx := range ipsVal { ips[idx] = fmt.Sprint(ipsVal[idx]) } - networkLoadBalancer.Properties.Ips = &ips + networkLoadBalancer.Properties.Ips = ips } } @@ -158,20 +158,20 @@ func resourceNetworkLoadBalancerCreate(ctx context.Context, d *schema.ResourceDa for idx := range lbPrivateIpsVal { lbPrivateIps[idx] = fmt.Sprint(lbPrivateIpsVal[idx]) } - networkLoadBalancer.Properties.LbPrivateIps = &lbPrivateIps + networkLoadBalancer.Properties.LbPrivateIps = lbPrivateIps } } if flowLogs, ok := d.GetOk("flowlog"); ok { networkLoadBalancer.Entities = &ionoscloud.NetworkLoadBalancerEntities{ Flowlogs: &ionoscloud.FlowLogs{ - Items: &[]ionoscloud.FlowLog{}, + Items: []ionoscloud.FlowLog{}, }, } if flowLogList, ok := flowLogs.([]any); ok { for _, flowLogData := range flowLogList { if flowLog, ok := flowLogData.(map[string]interface{}); ok { - *networkLoadBalancer.Entities.Flowlogs.Items = append(*networkLoadBalancer.Entities.Flowlogs.Items, cloudapiflowlog.GetFlowlogFromMap(flowLog)) + networkLoadBalancer.Entities.Flowlogs.Items = append(networkLoadBalancer.Entities.Flowlogs.Items, cloudapiflowlog.GetFlowlogFromMap(flowLog)) } } } @@ -227,7 +227,7 @@ func resourceNetworkLoadBalancerRead(ctx context.Context, d *schema.ResourceData func resourceNetworkLoadBalancerUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { client := meta.(services.SdkBundle).CloudApiClient request := ionoscloud.NetworkLoadBalancer{ - Properties: &ionoscloud.NetworkLoadBalancerProperties{}, + Properties: ionoscloud.NetworkLoadBalancerProperties{}, } dcId := d.Get("datacenter_id").(string) @@ -235,19 +235,19 @@ func resourceNetworkLoadBalancerUpdate(ctx context.Context, d *schema.ResourceDa if d.HasChange("name") { _, v := d.GetChange("name") vStr := v.(string) - request.Properties.Name = &vStr + request.Properties.Name = vStr } if d.HasChange("listener_lan") { _, v := d.GetChange("listener_lan") vInt := int32(v.(int)) - request.Properties.ListenerLan = &vInt + request.Properties.ListenerLan = vInt } if d.HasChange("target_lan") { _, v := d.GetChange("target_lan") vInt := int32(v.(int)) - request.Properties.TargetLan = &vInt + request.Properties.TargetLan = vInt } if d.HasChange("central_logging") { @@ -273,7 +273,7 @@ func resourceNetworkLoadBalancerUpdate(ctx context.Context, d *schema.ResourceDa } } if len(ips) > 0 { - request.Properties.Ips = &ips + request.Properties.Ips = ips } else { diags := diag.FromErr(fmt.Errorf("you can not empty the ips field for networkloadbalancer %s", d.Id())) return diags @@ -294,7 +294,7 @@ func resourceNetworkLoadBalancerUpdate(ctx context.Context, d *schema.ResourceDa diags := diag.FromErr(fmt.Errorf("you can not empty the lbPrivateIps field for networkloadbalancer %s", d.Id())) return diags } - request.Properties.LbPrivateIps = &lbPrivateIps + request.Properties.LbPrivateIps = lbPrivateIps } if d.HasChange("flowlog") { @@ -326,7 +326,7 @@ func resourceNetworkLoadBalancerUpdate(ctx context.Context, d *schema.ResourceDa } } - _, apiResponse, err := client.NetworkLoadBalancersApi.DatacentersNetworkloadbalancersPatch(ctx, dcId, d.Id()).NetworkLoadBalancerProperties(*request.Properties).Execute() + _, apiResponse, err := client.NetworkLoadBalancersApi.DatacentersNetworkloadbalancersPatch(ctx, dcId, d.Id()).NetworkLoadBalancerProperties(request.Properties).Execute() logApiRequestTime(apiResponse) if err != nil { @@ -403,70 +403,61 @@ func setNetworkLoadBalancerData(d *schema.ResourceData, networkLoadBalancer *ion d.SetId(*networkLoadBalancer.Id) } - if networkLoadBalancer.Properties != nil { - if networkLoadBalancer.Properties.Name != nil { - err := d.Set("name", *networkLoadBalancer.Properties.Name) - if err != nil { - return fmt.Errorf("error while setting name property for network load balancer %s: %w", d.Id(), err) - } - } + err := d.Set("name", networkLoadBalancer.Properties.Name) + if err != nil { + return fmt.Errorf("error while setting name property for network load balancer %s: %w", d.Id(), err) + } - if networkLoadBalancer.Properties.ListenerLan != nil { - err := d.Set("listener_lan", *networkLoadBalancer.Properties.ListenerLan) - if err != nil { - return fmt.Errorf("error while setting listener_lan property for network load balancer %s: %w", d.Id(), err) - } - } + err = d.Set("listener_lan", networkLoadBalancer.Properties.ListenerLan) + if err != nil { + return fmt.Errorf("error while setting listener_lan property for network load balancer %s: %w", d.Id(), err) + } - if networkLoadBalancer.Properties.TargetLan != nil { - err := d.Set("target_lan", *networkLoadBalancer.Properties.TargetLan) - if err != nil { - return fmt.Errorf("error while setting target_lan property for network load balancer %s: %w", d.Id(), err) - } - } + err = d.Set("target_lan", networkLoadBalancer.Properties.TargetLan) + if err != nil { + return fmt.Errorf("error while setting target_lan property for network load balancer %s: %w", d.Id(), err) + } - if networkLoadBalancer.Properties.Ips != nil { - err := d.Set("ips", *networkLoadBalancer.Properties.Ips) - if err != nil { - return fmt.Errorf("error while setting ips property for network load balancer %s: %w", d.Id(), err) - } + if networkLoadBalancer.Properties.Ips != nil { + err := d.Set("ips", networkLoadBalancer.Properties.Ips) + if err != nil { + return fmt.Errorf("error while setting ips property for network load balancer %s: %w", d.Id(), err) } + } - if networkLoadBalancer.Properties.CentralLogging != nil { - err := d.Set("central_logging", *networkLoadBalancer.Properties.CentralLogging) - if err != nil { - return fmt.Errorf("error while setting central_logging property for network load balancer %s: %w", d.Id(), err) - } + if networkLoadBalancer.Properties.CentralLogging != nil { + err := d.Set("central_logging", *networkLoadBalancer.Properties.CentralLogging) + if err != nil { + return fmt.Errorf("error while setting central_logging property for network load balancer %s: %w", d.Id(), err) } + } - if networkLoadBalancer.Properties.LoggingFormat != nil { - err := d.Set("logging_format", *networkLoadBalancer.Properties.LoggingFormat) - if err != nil { - return fmt.Errorf("error while setting logging_format property for network load balancer %s: %w", d.Id(), err) - } + if networkLoadBalancer.Properties.LoggingFormat != nil { + err := d.Set("logging_format", *networkLoadBalancer.Properties.LoggingFormat) + if err != nil { + return fmt.Errorf("error while setting logging_format property for network load balancer %s: %w", d.Id(), err) } + } - if networkLoadBalancer.Properties.LbPrivateIps != nil { - err := d.Set("lb_private_ips", *networkLoadBalancer.Properties.LbPrivateIps) + if networkLoadBalancer.Properties.LbPrivateIps != nil { + err := d.Set("lb_private_ips", networkLoadBalancer.Properties.LbPrivateIps) + if err != nil { + return fmt.Errorf("error while setting lb_private_ips property for network load balancer %s: %w", d.Id(), err) + } + } + if networkLoadBalancer.Entities != nil && networkLoadBalancer.Entities.Flowlogs != nil && len(networkLoadBalancer.Entities.Flowlogs.Items) > 0 { + var flowlogs []map[string]any + for _, flowLog := range networkLoadBalancer.Entities.Flowlogs.Items { + result := map[string]any{} + result, err := utils.DecodeStructToMap(flowLog.Properties) if err != nil { - return fmt.Errorf("error while setting lb_private_ips property for network load balancer %s: %w", d.Id(), err) + return err } + result["id"] = *flowLog.Id + flowlogs = append(flowlogs, result) } - if networkLoadBalancer.Entities != nil && networkLoadBalancer.Entities.Flowlogs != nil && - networkLoadBalancer.Entities.Flowlogs.Items != nil && len(*networkLoadBalancer.Entities.Flowlogs.Items) > 0 { - var flowlogs []map[string]any - for _, flowLog := range *networkLoadBalancer.Entities.Flowlogs.Items { - result := map[string]any{} - result, err := utils.DecodeStructToMap(flowLog.Properties) - if err != nil { - return err - } - result["id"] = *flowLog.Id - flowlogs = append(flowlogs, result) - } - if err := d.Set("flowlog", flowlogs); err != nil { - return fmt.Errorf("error setting flowlog %w", err) - } + if err := d.Set("flowlog", flowlogs); err != nil { + return fmt.Errorf("error setting flowlog %w", err) } } return nil diff --git a/ionoscloud/resource_networkloadbalancer_forwardingrule.go b/ionoscloud/resource_networkloadbalancer_forwardingrule.go index acb579648..3c543a839 100644 --- a/ionoscloud/resource_networkloadbalancer_forwardingrule.go +++ b/ionoscloud/resource_networkloadbalancer_forwardingrule.go @@ -13,7 +13,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" ) func resourceNetworkLoadBalancerForwardingRule() *schema.Resource { @@ -174,12 +174,12 @@ func resourceNetworkLoadBalancerForwardingRuleCreate(ctx context.Context, d *sch client := meta.(services.SdkBundle).CloudApiClient networkLoadBalancerForwardingRule := ionoscloud.NetworkLoadBalancerForwardingRule{ - Properties: &ionoscloud.NetworkLoadBalancerForwardingRuleProperties{}, + Properties: ionoscloud.NetworkLoadBalancerForwardingRuleProperties{}, } if name, nameOk := d.GetOk("name"); nameOk { name := name.(string) - networkLoadBalancerForwardingRule.Properties.Name = &name + networkLoadBalancerForwardingRule.Properties.Name = name } else { diags := diag.FromErr(fmt.Errorf("name must be provided for network loadbalancer forwarding rule")) return diags @@ -187,7 +187,7 @@ func resourceNetworkLoadBalancerForwardingRuleCreate(ctx context.Context, d *sch if algorithm, algorithmOk := d.GetOk("algorithm"); algorithmOk { algorithm := algorithm.(string) - networkLoadBalancerForwardingRule.Properties.Algorithm = &algorithm + networkLoadBalancerForwardingRule.Properties.Algorithm = algorithm } else { diags := diag.FromErr(fmt.Errorf("algorithm must be provided for network loadbalancer forwarding rule")) return diags @@ -195,7 +195,7 @@ func resourceNetworkLoadBalancerForwardingRuleCreate(ctx context.Context, d *sch if protocol, protocolOk := d.GetOk("protocol"); protocolOk { protocol := protocol.(string) - networkLoadBalancerForwardingRule.Properties.Protocol = &protocol + networkLoadBalancerForwardingRule.Properties.Protocol = protocol } else { diags := diag.FromErr(fmt.Errorf("protocol must be provided for network loadbalancer forwarding rule")) return diags @@ -203,7 +203,7 @@ func resourceNetworkLoadBalancerForwardingRuleCreate(ctx context.Context, d *sch if listenerIp, listenerIpOk := d.GetOk("listener_ip"); listenerIpOk { listenerIp := listenerIp.(string) - networkLoadBalancerForwardingRule.Properties.ListenerIp = &listenerIp + networkLoadBalancerForwardingRule.Properties.ListenerIp = listenerIp } else { diags := diag.FromErr(fmt.Errorf("listner ip must be provided for network loadbalancer forwarding rule")) return diags @@ -211,7 +211,7 @@ func resourceNetworkLoadBalancerForwardingRuleCreate(ctx context.Context, d *sch if listenerPort, listenerPortOk := d.GetOk("listener_port"); listenerPortOk { listenerPort := int32(listenerPort.(int)) - networkLoadBalancerForwardingRule.Properties.ListenerPort = &listenerPort + networkLoadBalancerForwardingRule.Properties.ListenerPort = listenerPort } else { diags := diag.FromErr(fmt.Errorf("listner port must be provided for network loadbalancer forwarding rule")) return diags @@ -249,7 +249,7 @@ func resourceNetworkLoadBalancerForwardingRuleCreate(ctx context.Context, d *sch } if len(targets) > 0 { log.Printf("[INFO] Network load balancer forwarding rule targets set to %+v", targets) - networkLoadBalancerForwardingRule.Properties.Targets = &targets + networkLoadBalancerForwardingRule.Properties.Targets = targets } } @@ -287,7 +287,7 @@ func getTargetsData(targets interface{}) ([]ionoscloud.NetworkLoadBalancerForwar addTarget := false if ip, ipOk := targetMap["ip"].(string); ipOk { - target.Ip = &ip + target.Ip = ip addTarget = true } else { diags := diag.FromErr(fmt.Errorf("ip must be provided for network loadbalancer forwarding rule target")) @@ -296,7 +296,7 @@ func getTargetsData(targets interface{}) ([]ionoscloud.NetworkLoadBalancerForwar if port, portOk := targetMap["port"].(int); portOk { port := int32(port) - target.Port = &port + target.Port = port } else { diags := diag.FromErr(fmt.Errorf("port must be provided for network loadbalancer forwarding rule target")) return nil, diags @@ -304,7 +304,7 @@ func getTargetsData(targets interface{}) ([]ionoscloud.NetworkLoadBalancerForwar if weight, weightOk := targetMap["weight"].(int); weightOk { weight := int32(weight) - target.Weight = &weight + target.Weight = weight } else { diags := diag.FromErr(fmt.Errorf("weight must be provided for network loadbalancer forwarding rule target")) return nil, diags @@ -377,7 +377,7 @@ func resourceNetworkLoadBalancerForwardingRuleUpdate(ctx context.Context, d *sch client := meta.(services.SdkBundle).CloudApiClient request := ionoscloud.NetworkLoadBalancerForwardingRule{ - Properties: &ionoscloud.NetworkLoadBalancerForwardingRuleProperties{}, + Properties: ionoscloud.NetworkLoadBalancerForwardingRuleProperties{}, } dcId := d.Get("datacenter_id").(string) @@ -386,31 +386,31 @@ func resourceNetworkLoadBalancerForwardingRuleUpdate(ctx context.Context, d *sch if d.HasChange("name") { _, v := d.GetChange("name") vStr := v.(string) - request.Properties.Name = &vStr + request.Properties.Name = vStr } if d.HasChange("algorithm") { _, v := d.GetChange("algorithm") vStr := v.(string) - request.Properties.Algorithm = &vStr + request.Properties.Algorithm = vStr } if d.HasChange("protocol") { _, v := d.GetChange("protocol") vStr := v.(string) - request.Properties.Protocol = &vStr + request.Properties.Protocol = vStr } if d.HasChange("listener_ip") { _, v := d.GetChange("listener_ip") vStr := v.(string) - request.Properties.ListenerIp = &vStr + request.Properties.ListenerIp = vStr } if d.HasChange("listener_port") { _, v := d.GetChange("listener_port") vStr := int32(v.(int)) - request.Properties.ListenerPort = &vStr + request.Properties.ListenerPort = vStr } if d.HasChange("health_check.0") { @@ -462,9 +462,9 @@ func resourceNetworkLoadBalancerForwardingRuleUpdate(ctx context.Context, d *sch return diags } log.Printf("[INFO] Network load balancer forwarding rule targets changed from %+v to %+v", oldTargets, newTargets) - request.Properties.Targets = &targets + request.Properties.Targets = targets } - _, apiResponse, err := client.NetworkLoadBalancersApi.DatacentersNetworkloadbalancersForwardingrulesPatch(ctx, dcId, nlbID, d.Id()).NetworkLoadBalancerForwardingRuleProperties(*request.Properties).Execute() + _, apiResponse, err := client.NetworkLoadBalancersApi.DatacentersNetworkloadbalancersForwardingrulesPatch(ctx, dcId, nlbID, d.Id()).NetworkLoadBalancerForwardingRuleProperties(request.Properties).Execute() logApiRequestTime(apiResponse) if err != nil { @@ -547,124 +547,105 @@ func setNetworkLoadBalancerForwardingRuleData(d *schema.ResourceData, networkLoa d.SetId(*networkLoadBalancerForwardingRule.Id) } - if networkLoadBalancerForwardingRule.Properties != nil { + err := d.Set("name", networkLoadBalancerForwardingRule.Properties.Name) + if err != nil { + return fmt.Errorf("error while setting name property for network load balancer forwarding rule %s: %w", d.Id(), err) + } - if networkLoadBalancerForwardingRule.Properties.Name != nil { - err := d.Set("name", *networkLoadBalancerForwardingRule.Properties.Name) - if err != nil { - return fmt.Errorf("error while setting name property for network load balancer forwarding rule %s: %w", d.Id(), err) - } - } + err = d.Set("algorithm", networkLoadBalancerForwardingRule.Properties.Algorithm) + if err != nil { + return fmt.Errorf("error while setting algorithm property for network load balancer forwarding rule %s: %w", d.Id(), err) + } - if networkLoadBalancerForwardingRule.Properties.Algorithm != nil { - err := d.Set("algorithm", *networkLoadBalancerForwardingRule.Properties.Algorithm) - if err != nil { - return fmt.Errorf("error while setting algorithm property for network load balancer forwarding rule %s: %w", d.Id(), err) - } - } + err = d.Set("protocol", networkLoadBalancerForwardingRule.Properties.Protocol) + if err != nil { + return fmt.Errorf("error while setting protocol property for network load balancer forwarding rule %s: %w", d.Id(), err) + } - if networkLoadBalancerForwardingRule.Properties.Protocol != nil { - err := d.Set("protocol", *networkLoadBalancerForwardingRule.Properties.Protocol) - if err != nil { - return fmt.Errorf("error while setting protocol property for network load balancer forwarding rule %s: %w", d.Id(), err) - } + err = d.Set("listener_ip", networkLoadBalancerForwardingRule.Properties.ListenerIp) + if err != nil { + return fmt.Errorf("error while setting listener_ip property for network load balancer forwarding rule %s: %w", d.Id(), err) + } + + err = d.Set("listener_port", networkLoadBalancerForwardingRule.Properties.ListenerPort) + if err != nil { + return fmt.Errorf("error while setting listener_port property for network load balancer forwarding rule %s: %w", d.Id(), err) + } + + if networkLoadBalancerForwardingRule.Properties.HealthCheck != nil { + var healthCheck []interface{} + + healthCheckEntry := make(map[string]interface{}) + if networkLoadBalancerForwardingRule.Properties.HealthCheck.ClientTimeout != nil { + healthCheckEntry["client_timeout"] = *networkLoadBalancerForwardingRule.Properties.HealthCheck.ClientTimeout } - if networkLoadBalancerForwardingRule.Properties.ListenerIp != nil { - err := d.Set("listener_ip", *networkLoadBalancerForwardingRule.Properties.ListenerIp) - if err != nil { - return fmt.Errorf("error while setting listener_ip property for network load balancer forwarding rule %s: %w", d.Id(), err) - } + if networkLoadBalancerForwardingRule.Properties.HealthCheck.ConnectTimeout != nil { + healthCheckEntry["connect_timeout"] = *networkLoadBalancerForwardingRule.Properties.HealthCheck.ConnectTimeout } - if networkLoadBalancerForwardingRule.Properties.ListenerPort != nil { - err := d.Set("listener_port", *networkLoadBalancerForwardingRule.Properties.ListenerPort) - if err != nil { - return fmt.Errorf("error while setting listener_port property for network load balancer forwarding rule %s: %w", d.Id(), err) - } + if networkLoadBalancerForwardingRule.Properties.HealthCheck.TargetTimeout != nil { + healthCheckEntry["target_timeout"] = *networkLoadBalancerForwardingRule.Properties.HealthCheck.TargetTimeout } - if networkLoadBalancerForwardingRule.Properties.HealthCheck != nil { - var healthCheck []interface{} + if networkLoadBalancerForwardingRule.Properties.HealthCheck.Retries != nil { + healthCheckEntry["retries"] = *networkLoadBalancerForwardingRule.Properties.HealthCheck.Retries + } - healthCheckEntry := make(map[string]interface{}) - if networkLoadBalancerForwardingRule.Properties.HealthCheck.ClientTimeout != nil { - healthCheckEntry["client_timeout"] = *networkLoadBalancerForwardingRule.Properties.HealthCheck.ClientTimeout - } + healthCheck = append(healthCheck, healthCheckEntry) - if networkLoadBalancerForwardingRule.Properties.HealthCheck.ConnectTimeout != nil { - healthCheckEntry["connect_timeout"] = *networkLoadBalancerForwardingRule.Properties.HealthCheck.ConnectTimeout - } + err := d.Set("health_check", healthCheck) + if err != nil { + return fmt.Errorf("error while setting health_check property for network load balancer forwarding rule %s: %w", d.Id(), err) + } - if networkLoadBalancerForwardingRule.Properties.HealthCheck.TargetTimeout != nil { - healthCheckEntry["target_timeout"] = *networkLoadBalancerForwardingRule.Properties.HealthCheck.TargetTimeout - } + } - if networkLoadBalancerForwardingRule.Properties.HealthCheck.Retries != nil { - healthCheckEntry["retries"] = *networkLoadBalancerForwardingRule.Properties.HealthCheck.Retries - } + if len(networkLoadBalancerForwardingRule.Properties.Targets) > 0 { + var forwardingRuleTargets []interface{} + for _, target := range networkLoadBalancerForwardingRule.Properties.Targets { + targetEntry := make(map[string]interface{}) - healthCheck = append(healthCheck, healthCheckEntry) + targetEntry["ip"] = target.Ip - err := d.Set("health_check", healthCheck) - if err != nil { - return fmt.Errorf("error while setting health_check property for network load balancer forwarding rule %s: %w", d.Id(), err) - } + targetEntry["port"] = target.Port - } + targetEntry["weight"] = target.Weight - if networkLoadBalancerForwardingRule.Properties.Targets != nil && len(*networkLoadBalancerForwardingRule.Properties.Targets) > 0 { - var forwardingRuleTargets []interface{} - for _, target := range *networkLoadBalancerForwardingRule.Properties.Targets { - targetEntry := make(map[string]interface{}) + if target.ProxyProtocol != nil { + targetEntry["proxy_protocol"] = *target.ProxyProtocol + } - if target.Ip != nil { - targetEntry["ip"] = *target.Ip - } + if target.HealthCheck != nil { + var healthCheck []interface{} - if target.Port != nil { - targetEntry["port"] = *target.Port - } + healthCheckEntry := make(map[string]interface{}) - if target.Weight != nil { - targetEntry["weight"] = *target.Weight + if target.HealthCheck.Check != nil { + healthCheckEntry["check"] = *target.HealthCheck.Check } - if target.ProxyProtocol != nil { - targetEntry["proxy_protocol"] = *target.ProxyProtocol + if target.HealthCheck.CheckInterval != nil { + healthCheckEntry["check_interval"] = *target.HealthCheck.CheckInterval } - if target.HealthCheck != nil { - var healthCheck []interface{} - - healthCheckEntry := make(map[string]interface{}) - - if target.HealthCheck.Check != nil { - healthCheckEntry["check"] = *target.HealthCheck.Check - } - - if target.HealthCheck.CheckInterval != nil { - healthCheckEntry["check_interval"] = *target.HealthCheck.CheckInterval - } - - if target.HealthCheck.Maintenance != nil { - healthCheckEntry["maintenance"] = *target.HealthCheck.Maintenance - } - - healthCheck = append(healthCheck, healthCheckEntry) - targetEntry["health_check"] = healthCheck + if target.HealthCheck.Maintenance != nil { + healthCheckEntry["maintenance"] = *target.HealthCheck.Maintenance } - forwardingRuleTargets = append(forwardingRuleTargets, targetEntry) + healthCheck = append(healthCheck, healthCheckEntry) + targetEntry["health_check"] = healthCheck } - if len(forwardingRuleTargets) > 0 { - if err := d.Set("targets", forwardingRuleTargets); err != nil { - return fmt.Errorf("error while setting targets property for network load balancer forwarding rule %s: %w", d.Id(), err) - } - } + forwardingRuleTargets = append(forwardingRuleTargets, targetEntry) } + if len(forwardingRuleTargets) > 0 { + if err := d.Set("targets", forwardingRuleTargets); err != nil { + return fmt.Errorf("error while setting targets property for network load balancer forwarding rule %s: %w", d.Id(), err) + } + } } + return nil } diff --git a/ionoscloud/resource_networkloadbalancer_forwardingrule_test.go b/ionoscloud/resource_networkloadbalancer_forwardingrule_test.go index 67585e3ce..85b85afd4 100644 --- a/ionoscloud/resource_networkloadbalancer_forwardingrule_test.go +++ b/ionoscloud/resource_networkloadbalancer_forwardingrule_test.go @@ -9,7 +9,7 @@ import ( "regexp" "testing" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/utils/constant" diff --git a/ionoscloud/resource_networkloadbalancer_test.go b/ionoscloud/resource_networkloadbalancer_test.go index e41c6ffb2..547dd84c7 100644 --- a/ionoscloud/resource_networkloadbalancer_test.go +++ b/ionoscloud/resource_networkloadbalancer_test.go @@ -9,7 +9,7 @@ import ( "regexp" "testing" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/utils/constant" diff --git a/ionoscloud/resource_nic.go b/ionoscloud/resource_nic.go index 71a1f4bf7..59d22d00d 100644 --- a/ionoscloud/resource_nic.go +++ b/ionoscloud/resource_nic.go @@ -11,7 +11,8 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" + "github.com/ionos-cloud/sdk-go-bundle/shared" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/cloudapi/cloudapinic" @@ -213,7 +214,7 @@ func resourceNicCreate(ctx context.Context, d *schema.ResourceData, meta interfa // Probably a read write consistency issue. // We're retrying for 5 minutes. 404 - means we keep on trying. var foundNic = &ionoscloud.Nic{} - var apiResponse = &ionoscloud.APIResponse{} + var apiResponse = &shared.APIResponse{} err = retry.RetryContext(ctx, 5*time.Minute, func() *retry.RetryError { var err error foundNic, apiResponse, err = ns.Get(ctx, dcid, srvid, *createdNic.Id, 3) @@ -304,7 +305,7 @@ func resourceNicUpdate(ctx context.Context, d *schema.ResourceData, meta interfa return diags } - _, _, err = ns.Update(ctx, dcID, srvID, nicID, *nic.Properties) + _, _, err = ns.Update(ctx, dcID, srvID, nicID, nic.Properties) if err != nil { diags := diag.FromErr(fmt.Errorf("error occurred while updating a nic: %w", err)) return diags diff --git a/ionoscloud/resource_nic_test.go b/ionoscloud/resource_nic_test.go index 9bcac4652..c588e4833 100644 --- a/ionoscloud/resource_nic_test.go +++ b/ionoscloud/resource_nic_test.go @@ -8,7 +8,7 @@ import ( "regexp" "testing" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/utils/constant" diff --git a/ionoscloud/resource_nsg.go b/ionoscloud/resource_nsg.go index 357104acd..4472cdd44 100644 --- a/ionoscloud/resource_nsg.go +++ b/ionoscloud/resource_nsg.go @@ -13,7 +13,7 @@ import ( "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/cloudapi" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" ) func resourceNSG() *schema.Resource { @@ -58,8 +58,8 @@ func resourceNSGCreate(ctx context.Context, d *schema.ResourceData, meta any) di sgDescription := d.Get("description").(string) sg := ionoscloud.SecurityGroupRequest{ - Properties: &ionoscloud.SecurityGroupProperties{ - Name: &sgName, + Properties: ionoscloud.SecurityGroupProperties{ + Name: sgName, Description: &sgDescription, }, } @@ -101,8 +101,8 @@ func resourceNSGUpdate(ctx context.Context, d *schema.ResourceData, meta interfa sgDescription := d.Get("description").(string) sg := ionoscloud.SecurityGroupRequest{ - Properties: &ionoscloud.SecurityGroupProperties{ - Name: &sgName, + Properties: ionoscloud.SecurityGroupProperties{ + Name: sgName, Description: &sgDescription, }, } @@ -180,25 +180,21 @@ func setNSGData(d *schema.ResourceData, securityGroup *ionoscloud.SecurityGroup) d.SetId(*securityGroup.Id) } - if securityGroup.Properties != nil { - if securityGroup.Properties.Name != nil { - err := d.Set("name", *securityGroup.Properties.Name) - if err != nil { - return fmt.Errorf("error while setting Network Security Group name %s: %w", d.Id(), err) - } - } - if securityGroup.Properties.Description != nil { - err := d.Set("description", *securityGroup.Properties.Description) - if err != nil { - return fmt.Errorf("error while setting Network Security Group description %s: %w", d.Id(), err) - } + err := d.Set("name", securityGroup.Properties.Name) + if err != nil { + return fmt.Errorf("error while setting Network Security Group name %s: %w", d.Id(), err) + } + if securityGroup.Properties.Description != nil { + err := d.Set("description", *securityGroup.Properties.Description) + if err != nil { + return fmt.Errorf("error while setting Network Security Group description %s: %w", d.Id(), err) } } var ruleIDs []string if securityGroup.Entities != nil { if securityGroup.Entities.Rules != nil && securityGroup.Entities.Rules.Items != nil { - ruleIDs = make([]string, 0, len(*securityGroup.Entities.Rules.Items)) - for _, rule := range *securityGroup.Entities.Rules.Items { + ruleIDs = make([]string, 0, len(securityGroup.Entities.Rules.Items)) + for _, rule := range securityGroup.Entities.Rules.Items { ruleIDs = append(ruleIDs, *rule.Id) } } diff --git a/ionoscloud/resource_nsg_firewallrule.go b/ionoscloud/resource_nsg_firewallrule.go index 7d73cd71b..5398cd5ac 100644 --- a/ionoscloud/resource_nsg_firewallrule.go +++ b/ionoscloud/resource_nsg_firewallrule.go @@ -148,7 +148,7 @@ func resourceNSGFirewallUpdate(ctx context.Context, d *schema.ResourceData, meta } nsgID := d.Get("nsg_id").(string) dcID := d.Get("datacenter_id").(string) - _, apiResponse, err := client.SecurityGroupsApi.DatacentersSecuritygroupsRulesPatch(ctx, dcID, nsgID, d.Id()).Rule(*firewall.Properties).Execute() + _, apiResponse, err := client.SecurityGroupsApi.DatacentersSecuritygroupsRulesPatch(ctx, dcID, nsgID, d.Id()).Rule(firewall.Properties).Execute() logApiRequestTime(apiResponse) if err != nil { diff --git a/ionoscloud/resource_nsg_test.go b/ionoscloud/resource_nsg_test.go index f3a676f4a..b0f849234 100644 --- a/ionoscloud/resource_nsg_test.go +++ b/ionoscloud/resource_nsg_test.go @@ -12,7 +12,7 @@ import ( "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/utils/constant" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" ) func TestAccNSGBasic(t *testing.T) { diff --git a/ionoscloud/resource_private_crossconnect.go b/ionoscloud/resource_private_crossconnect.go index 307ae2da8..0dc6a6e58 100644 --- a/ionoscloud/resource_private_crossconnect.go +++ b/ionoscloud/resource_private_crossconnect.go @@ -13,7 +13,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" ) func resourcePrivateCrossConnect() *schema.Resource { @@ -107,7 +107,7 @@ func resourcePrivateCrossConnectCreate(ctx context.Context, d *schema.ResourceDa name := d.Get("name").(string) pcc := ionoscloud.PrivateCrossConnect{ - Properties: &ionoscloud.PrivateCrossConnectProperties{ + Properties: ionoscloud.PrivateCrossConnectProperties{ Name: &name, }, } @@ -118,7 +118,7 @@ func resourcePrivateCrossConnectCreate(ctx context.Context, d *schema.ResourceDa pcc.Properties.Description = &description } - rsp, apiResponse, err := client.PrivateCrossConnectsApi.PccsPost(ctx).Pcc(pcc).Execute() + rsp, apiResponse, err := client.CrossConnectsApi.PccsPost(ctx).Pcc(pcc).Execute() logApiRequestTime(apiResponse) if err != nil { @@ -139,7 +139,7 @@ func resourcePrivateCrossConnectCreate(ctx context.Context, d *schema.ResourceDa func resourcePrivateCrossConnectRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { client := meta.(services.SdkBundle).CloudApiClient - pcc, apiResponse, err := client.PrivateCrossConnectsApi.PccsFindById(ctx, d.Id()).Execute() + pcc, apiResponse, err := client.CrossConnectsApi.PccsFindById(ctx, d.Id()).Execute() logApiRequestTime(apiResponse) if err != nil { @@ -164,7 +164,7 @@ func resourcePrivateCrossConnectUpdate(ctx context.Context, d *schema.ResourceDa request := ionoscloud.PrivateCrossConnect{} name := d.Get("name").(string) - request.Properties = &ionoscloud.PrivateCrossConnectProperties{ + request.Properties = ionoscloud.PrivateCrossConnectProperties{ Name: &name, } @@ -186,7 +186,7 @@ func resourcePrivateCrossConnectUpdate(ctx context.Context, d *schema.ResourceDa } } - _, apiResponse, err := client.PrivateCrossConnectsApi.PccsPatch(ctx, d.Id()).Pcc(*request.Properties).Execute() + _, apiResponse, err := client.CrossConnectsApi.PccsPatch(ctx, d.Id()).Pcc(request.Properties).Execute() logApiRequestTime(apiResponse) if err != nil { @@ -207,7 +207,7 @@ func resourcePrivateCrossConnectUpdate(ctx context.Context, d *schema.ResourceDa func resourcePrivateCrossConnectDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { client := meta.(services.SdkBundle).CloudApiClient - apiResponse, err := client.PrivateCrossConnectsApi.PccsDelete(ctx, d.Id()).Execute() + apiResponse, err := client.CrossConnectsApi.PccsDelete(ctx, d.Id()).Execute() logApiRequestTime(apiResponse) if err != nil { @@ -252,7 +252,7 @@ func resourcePrivateCrossConnectImport(ctx context.Context, d *schema.ResourceDa pccId := d.Id() - pcc, apiResponse, err := client.PrivateCrossConnectsApi.PccsFindById(ctx, d.Id()).Execute() + pcc, apiResponse, err := client.CrossConnectsApi.PccsFindById(ctx, d.Id()).Execute() logApiRequestTime(apiResponse) if err != nil { @@ -283,7 +283,7 @@ func resourcePrivateCrossConnectImport(ctx context.Context, d *schema.ResourceDa } func privateCrossConnectReady(ctx context.Context, client *ionoscloud.APIClient, d *schema.ResourceData) (bool, error) { - rsp, apiResponse, err := client.PrivateCrossConnectsApi.PccsFindById(ctx, d.Id()).Execute() + rsp, apiResponse, err := client.CrossConnectsApi.PccsFindById(ctx, d.Id()).Execute() logApiRequestTime(apiResponse) if err != nil { @@ -293,7 +293,7 @@ func privateCrossConnectReady(ctx context.Context, client *ionoscloud.APIClient, } func privateCrossConnectDeleted(ctx context.Context, client *ionoscloud.APIClient, d *schema.ResourceData) (bool, error) { - _, apiResponse, err := client.PrivateCrossConnectsApi.PccsFindById(ctx, d.Id()).Execute() + _, apiResponse, err := client.CrossConnectsApi.PccsFindById(ctx, d.Id()).Execute() logApiRequestTime(apiResponse) if err != nil { diff --git a/ionoscloud/resource_private_crossconnect_test.go b/ionoscloud/resource_private_crossconnect_test.go index 9cf6c7158..db1593c97 100644 --- a/ionoscloud/resource_private_crossconnect_test.go +++ b/ionoscloud/resource_private_crossconnect_test.go @@ -8,7 +8,7 @@ import ( "regexp" "testing" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/utils/constant" @@ -85,7 +85,7 @@ func testAccCheckPrivateCrossConnectDestroyCheck(s *terraform.State) error { continue } - _, apiResponse, err := client.PrivateCrossConnectsApi.PccsFindById(ctx, rs.Primary.ID).Execute() + _, apiResponse, err := client.CrossConnectsApi.PccsFindById(ctx, rs.Primary.ID).Execute() logApiRequestTime(apiResponse) if err != nil { @@ -118,7 +118,7 @@ func testAccCheckPrivateCrossConnectExists(n string, privateCrossConnect *ionosc return fmt.Errorf("no Record ID is set") } - foundPrivateCrossConnect, apiResponse, err := client.PrivateCrossConnectsApi.PccsFindById(ctx, rs.Primary.ID).Execute() + foundPrivateCrossConnect, apiResponse, err := client.CrossConnectsApi.PccsFindById(ctx, rs.Primary.ID).Execute() logApiRequestTime(apiResponse) if err != nil { diff --git a/ionoscloud/resource_s3_key.go b/ionoscloud/resource_s3_key.go index 046b3e1d5..5f5c39bde 100644 --- a/ionoscloud/resource_s3_key.go +++ b/ionoscloud/resource_s3_key.go @@ -4,6 +4,7 @@ import ( "context" "errors" "fmt" + "github.com/ionos-cloud/sdk-go-bundle/shared" "log" "strings" "time" @@ -15,7 +16,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" ) func resourceS3Key() *schema.Resource { @@ -76,7 +77,7 @@ func resourceS3KeyCreate(ctx context.Context, d *schema.ResourceData, meta inter active := d.Get("active").(bool) s3Key := ionoscloud.S3Key{ - Properties: &ionoscloud.S3KeyProperties{ + Properties: ionoscloud.S3KeyProperties{ Active: &active, }, } @@ -113,7 +114,7 @@ func resourceS3KeyRead(ctx context.Context, d *schema.ResourceData, meta interfa log.Printf("[INFO] Successfully retrieved Object Storage key %+v \n", *s3Key.Id) - if s3Key.HasProperties() && s3Key.Properties.HasActive() { + if s3Key.Properties.HasActive() { log.Printf("[INFO] Successfully retrieved Object Storage key with status: %t", *s3Key.Properties.Active) } @@ -128,7 +129,7 @@ func resourceS3KeyUpdate(ctx context.Context, d *schema.ResourceData, meta inter client := meta.(services.SdkBundle).CloudApiClient request := ionoscloud.S3Key{} - request.Properties = &ionoscloud.S3KeyProperties{} + request.Properties = ionoscloud.S3KeyProperties{} log.Printf("[INFO] Attempting to update Object Storage key %s", d.Id()) @@ -207,7 +208,7 @@ func resourceS3KeyDelete(ctx context.Context, d *schema.ResourceData, meta inter // isS3KeyNotFound needed because api returns 422 instead of 404 on key being not found. will be removed once API issue is fixed func isS3KeyNotFound(err error) bool { - var genericOpenAPIError ionoscloud.GenericOpenAPIError + var genericOpenAPIError shared.GenericOpenAPIError if !errors.As(err, &genericOpenAPIError) { return false } diff --git a/ionoscloud/resource_s3_key_test.go b/ionoscloud/resource_s3_key_test.go index d8d110c2b..9f7b5a74d 100644 --- a/ionoscloud/resource_s3_key_test.go +++ b/ionoscloud/resource_s3_key_test.go @@ -6,7 +6,7 @@ import ( "context" "fmt" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/utils" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/utils/constant" diff --git a/ionoscloud/resource_server.go b/ionoscloud/resource_server.go index 09a31c793..7f2793015 100644 --- a/ionoscloud/resource_server.go +++ b/ionoscloud/resource_server.go @@ -18,7 +18,7 @@ import ( "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/utils" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/utils/constant" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" @@ -615,9 +615,9 @@ func resourceServerCreate(ctx context.Context, d *schema.ResourceData, meta inte } // add volume object to serverReq serverReq.Entities.Volumes = &ionoscloud.AttachedVolumes{ - Items: &[]ionoscloud.Volume{ + Items: []ionoscloud.Volume{ { - Properties: volume, + Properties: *volume, }, }, } @@ -625,7 +625,7 @@ func resourceServerCreate(ctx context.Context, d *schema.ResourceData, meta inte // get nic data and add object to serverReq if nics, ok := d.GetOk("nic"); ok { serverReq.Entities.Nics = &ionoscloud.Nics{ - Items: &[]ionoscloud.Nic{}, + Items: []ionoscloud.Nic{}, } if nics.([]interface{}) != nil { for nicIndex := range nics.([]interface{}) { @@ -635,13 +635,13 @@ func resourceServerCreate(ctx context.Context, d *schema.ResourceData, meta inte diags := diag.FromErr(fmt.Errorf("create error occurred while getting nic from schema: %w", err)) return diags } - *serverReq.Entities.Nics.Items = append(*serverReq.Entities.Nics.Items, nic) + serverReq.Entities.Nics.Items = append(serverReq.Entities.Nics.Items, nic) fwRulesPath := nicPath + "firewall" if firewallRules, ok := d.GetOk(fwRulesPath); ok { fwRules := []ionoscloud.FirewallRule{} - (*serverReq.Entities.Nics.Items)[nicIndex].Entities = &ionoscloud.NicEntities{ + (serverReq.Entities.Nics.Items)[nicIndex].Entities = &ionoscloud.NicEntities{ Firewallrules: &ionoscloud.FirewallRules{ - Items: &[]ionoscloud.FirewallRule{}, + Items: []ionoscloud.FirewallRule{}, }, } @@ -656,12 +656,12 @@ func resourceServerCreate(ctx context.Context, d *schema.ResourceData, meta inte for idx := range fwRulesProperties { cloudapifirewall.PropUnsetSetFieldIfNotSetInSchema(&fwRulesProperties[idx], fwRulesPath, d) firewall := ionoscloud.FirewallRule{ - Properties: &fwRulesProperties[idx], + Properties: fwRulesProperties[idx], } fwRules = append(fwRules, firewall) } } - *(*serverReq.Entities.Nics.Items)[nicIndex].Entities.Firewallrules.Items = fwRules + (serverReq.Entities.Nics.Items)[nicIndex].Entities.Firewallrules.Items = fwRules } } } @@ -708,17 +708,17 @@ func resourceServerCreate(ctx context.Context, d *schema.ResourceData, meta inte return diags } if foundServer.Entities.Nics.Items != nil { - if len(*foundServer.Entities.Nics.Items) > 0 { + if len(foundServer.Entities.Nics.Items) > 0 { // what we get from backend - foundFirstNic := (*foundServer.Entities.Nics.Items)[0] + foundFirstNic := (foundServer.Entities.Nics.Items)[0] var orderedRuleIds []string if foundFirstNic.Entities != nil && foundFirstNic.Entities.Firewallrules != nil && foundFirstNic.Entities.Firewallrules.Items != nil { // what we get from schema and send to the API - sentFirstNic := (*serverReq.Entities.Nics.Items)[0] + sentFirstNic := (serverReq.Entities.Nics.Items)[0] if sentFirstNic.Entities != nil && sentFirstNic.Entities.Firewallrules != nil && sentFirstNic.Entities.Firewallrules.Items != nil { - sentRules := *sentFirstNic.Entities.Firewallrules.Items - foundRules := *foundFirstNic.Entities.Firewallrules.Items + sentRules := sentFirstNic.Entities.Firewallrules.Items + foundRules := foundFirstNic.Entities.Firewallrules.Items orderedRuleIds = cloudapifirewall.ExtractOrderedFirewallIds(foundRules, sentRules) if len(orderedRuleIds) > 0 { if err := d.Set("firewallrule_id", orderedRuleIds[0]); err != nil { @@ -752,39 +752,36 @@ func resourceServerCreate(ctx context.Context, d *schema.ResourceData, meta inte } } foundNicProps := foundFirstNic.Properties - if foundNicProps != nil { - firstNicIps := foundNicProps.Ips - if firstNicIps != nil && - len(*firstNicIps) > 0 { - log.Printf("[DEBUG] set primary_ip to %s", (*firstNicIps)[0]) - if err := d.Set("primary_ip", (*firstNicIps)[0]); err != nil { - diags := diag.FromErr(utils.GenerateSetError("ionoscloud_server", "primary_ip", err)) - return diags - } - } - var volumeItems *[]ionoscloud.Volume - var firstVolumeItem ionoscloud.Volume - if serverReq.Entities.Volumes != nil { - volumeItems = serverReq.Entities.Volumes.Items - if volumeItems != nil && len(*volumeItems) > 0 { - firstVolumeItem = (*volumeItems)[0] - } + firstNicIps := foundNicProps.Ips + if firstNicIps != nil && + len(firstNicIps) > 0 { + log.Printf("[DEBUG] set primary_ip to %s", (firstNicIps)[0]) + if err := d.Set("primary_ip", (firstNicIps)[0]); err != nil { + diags := diag.FromErr(utils.GenerateSetError("ionoscloud_server", "primary_ip", err)) + return diags } - if foundNicProps.Ips != nil && - firstNicIps != nil && - len(*firstNicIps) > 0 && - volumeItems != nil && - len(*volumeItems) > 0 && - firstVolumeItem.Properties != nil && - firstVolumeItem.Properties.ImagePassword != nil { - - d.SetConnInfo(map[string]string{ - "type": "ssh", - "host": (*firstNicIps)[0], - "password": *firstVolumeItem.Properties.ImagePassword, - }) + } + var volumeItems *[]ionoscloud.Volume + var firstVolumeItem ionoscloud.Volume + if serverReq.Entities.Volumes != nil { + volumeItems = &serverReq.Entities.Volumes.Items + if volumeItems != nil && len(*volumeItems) > 0 { + firstVolumeItem = (*volumeItems)[0] } } + if foundNicProps.Ips != nil && + firstNicIps != nil && + len(firstNicIps) > 0 && + volumeItems != nil && + len(*volumeItems) > 0 && + firstVolumeItem.Properties.ImagePassword != nil { + + d.SetConnInfo(map[string]string{ + "type": "ssh", + "host": (firstNicIps)[0], + "password": *firstVolumeItem.Properties.ImagePassword, + }) + } } } @@ -792,7 +789,7 @@ func resourceServerCreate(ctx context.Context, d *schema.ResourceData, meta inte // Set inline volumes if foundServer.Entities.Volumes != nil && foundServer.Entities.Volumes.Items != nil { var inlineVolumeIds []string - for _, volume := range *foundServer.Entities.Volumes.Items { + for _, volume := range foundServer.Entities.Volumes.Items { inlineVolumeIds = append(inlineVolumeIds, *volume.Id) } @@ -843,34 +840,32 @@ func resourceServerRead(ctx context.Context, d *schema.ResourceData, meta interf func SetVolumeProperties(volume ionoscloud.Volume) map[string]interface{} { volumeMap := map[string]interface{}{} - if volume.Properties != nil { - if volume.Properties.SshKeys != nil && len(*volume.Properties.SshKeys) > 0 { - var sshKeys []interface{} - for _, sshKey := range *volume.Properties.SshKeys { - sshKeys = append(sshKeys, sshKey) - } - volumeMap["ssh_keys"] = sshKeys - } - - utils.SetPropWithNilCheck(volumeMap, "image_password", volume.Properties.ImagePassword) - utils.SetPropWithNilCheck(volumeMap, "name", volume.Properties.Name) - - utils.SetPropWithNilCheck(volumeMap, "size", volume.Properties.Size) - utils.SetPropWithNilCheck(volumeMap, "disk_type", volume.Properties.Type) - utils.SetPropWithNilCheck(volumeMap, "licence_type", volume.Properties.LicenceType) - utils.SetPropWithNilCheck(volumeMap, "bus", volume.Properties.Bus) - utils.SetPropWithNilCheck(volumeMap, "availability_zone", volume.Properties.AvailabilityZone) - utils.SetPropWithNilCheck(volumeMap, "cpu_hot_plug", volume.Properties.CpuHotPlug) - utils.SetPropWithNilCheck(volumeMap, "ram_hot_plug", volume.Properties.RamHotPlug) - utils.SetPropWithNilCheck(volumeMap, "nic_hot_plug", volume.Properties.NicHotPlug) - utils.SetPropWithNilCheck(volumeMap, "nic_hot_unplug", volume.Properties.NicHotUnplug) - utils.SetPropWithNilCheck(volumeMap, "disc_virtio_hot_plug", volume.Properties.DiscVirtioHotPlug) - utils.SetPropWithNilCheck(volumeMap, "disc_virtio_hot_unplug", volume.Properties.DiscVirtioHotUnplug) - utils.SetPropWithNilCheck(volumeMap, "device_number", volume.Properties.DeviceNumber) - utils.SetPropWithNilCheck(volumeMap, "user_data", volume.Properties.UserData) - utils.SetPropWithNilCheck(volumeMap, "backup_unit_id", volume.Properties.BackupunitId) - utils.SetPropWithNilCheck(volumeMap, "boot_server", volume.Properties.BootServer) - } + if len(volume.Properties.SshKeys) > 0 { + var sshKeys []interface{} + for _, sshKey := range volume.Properties.SshKeys { + sshKeys = append(sshKeys, sshKey) + } + volumeMap["ssh_keys"] = sshKeys + } + + utils.SetPropWithNilCheck(volumeMap, "image_password", volume.Properties.ImagePassword) + utils.SetPropWithNilCheck(volumeMap, "name", volume.Properties.Name) + + utils.SetPropWithNilCheck(volumeMap, "size", volume.Properties.Size) + utils.SetPropWithNilCheck(volumeMap, "disk_type", volume.Properties.Type) + utils.SetPropWithNilCheck(volumeMap, "licence_type", volume.Properties.LicenceType) + utils.SetPropWithNilCheck(volumeMap, "bus", volume.Properties.Bus) + utils.SetPropWithNilCheck(volumeMap, "availability_zone", volume.Properties.AvailabilityZone) + utils.SetPropWithNilCheck(volumeMap, "cpu_hot_plug", volume.Properties.CpuHotPlug) + utils.SetPropWithNilCheck(volumeMap, "ram_hot_plug", volume.Properties.RamHotPlug) + utils.SetPropWithNilCheck(volumeMap, "nic_hot_plug", volume.Properties.NicHotPlug) + utils.SetPropWithNilCheck(volumeMap, "nic_hot_unplug", volume.Properties.NicHotUnplug) + utils.SetPropWithNilCheck(volumeMap, "disc_virtio_hot_plug", volume.Properties.DiscVirtioHotPlug) + utils.SetPropWithNilCheck(volumeMap, "disc_virtio_hot_unplug", volume.Properties.DiscVirtioHotUnplug) + utils.SetPropWithNilCheck(volumeMap, "device_number", volume.Properties.DeviceNumber) + utils.SetPropWithNilCheck(volumeMap, "user_data", volume.Properties.UserData) + utils.SetPropWithNilCheck(volumeMap, "backup_unit_id", volume.Properties.BackupunitId) + utils.SetPropWithNilCheck(volumeMap, "boot_server", volume.Properties.BootServer) return volumeMap } @@ -990,7 +985,7 @@ func resourceServerUpdate(ctx context.Context, d *schema.ResourceData, meta inte } if v, ok := d.GetOk(volumePath + "size"); ok { vInt := float32(v.(int)) - properties.Size = &vInt + properties.Size = vInt } if v, ok := d.GetOk(volumePath + "bus"); ok { vStr := v.(string) @@ -1043,7 +1038,7 @@ func resourceServerUpdate(ctx context.Context, d *schema.ResourceData, meta inte } else { primaryNic := d.Get("primary_nic").(string) nic := &ionoscloud.Nic{} - for _, n := range *server.Entities.Nics.Items { + for _, n := range server.Entities.Nics.Items { if *n.Id == primaryNic { nic = &n break @@ -1052,7 +1047,7 @@ func resourceServerUpdate(ctx context.Context, d *schema.ResourceData, meta inte lan := int32(d.Get("nic.0.lan").(int)) nicProperties := ionoscloud.NicProperties{ - Lan: &lan, + Lan: lan, } if v, ok := d.GetOk("nic.0.name"); ok { @@ -1062,7 +1057,9 @@ func resourceServerUpdate(ctx context.Context, d *schema.ResourceData, meta inte if v, ok := d.GetOk("nic.0.ipv6_cidr_block"); ok { ipv6Block := v.(string) - nicProperties.Ipv6CidrBlock = &ipv6Block + ipv6BlockNulStr := ionoscloud.NullableString{} + ipv6BlockNulStr.Set(&ipv6Block) + nicProperties.Ipv6CidrBlock = ipv6BlockNulStr } if v, ok := d.GetOk("nic.0.ips"); ok { @@ -1076,7 +1073,7 @@ func resourceServerUpdate(ctx context.Context, d *schema.ResourceData, meta inte } } if ips != nil && len(ips) > 0 { - nicProperties.Ips = &ips + nicProperties.Ips = ips } } } @@ -1089,7 +1086,7 @@ func resourceServerUpdate(ctx context.Context, d *schema.ResourceData, meta inte return diags } if len(ipv6Ips) > 0 { - nicProperties.Ipv6Ips = &ipv6Ips + nicProperties.Ipv6Ips = ipv6Ips } } @@ -1100,7 +1097,9 @@ func resourceServerUpdate(ctx context.Context, d *schema.ResourceData, meta inte if d.HasChange("nic.0.dhcpv6") { if dhcpv6, ok := d.GetOkExists("nic.0.dhcpv6"); ok { dhcpv6 := dhcpv6.(bool) - nicProperties.Dhcpv6 = &dhcpv6 + dhcpv6NulBool := ionoscloud.NullableBool{} + dhcpv6NulBool.Set(&dhcpv6) + nicProperties.Dhcpv6 = dhcpv6NulBool } else { nicProperties.SetDhcpv6Nil() } @@ -1123,7 +1122,7 @@ func resourceServerUpdate(ctx context.Context, d *schema.ResourceData, meta inte if len(firewallRules) > 0 { nic.Entities = &ionoscloud.NicEntities{ Firewallrules: &ionoscloud.FirewallRules{ - Items: &firewallRules, + Items: firewallRules, }, } } @@ -1131,7 +1130,7 @@ func resourceServerUpdate(ctx context.Context, d *schema.ResourceData, meta inte log.Printf("[DEBUG] Updating props: %s", string(mProp)) var createdNic *ionoscloud.Nic if createNic { - nic.Properties = &nicProperties + nic.Properties = nicProperties createdNic, apiResponse, err = ns.Create(ctx, d.Get("datacenter_id").(string), *server.Id, *nic) } else if nic.Id != nil { _, apiResponse, err = ns.Update(ctx, d.Get("datacenter_id").(string), *server.Id, *nic.Id, nicProperties) @@ -1303,18 +1302,18 @@ func resourceServerImport(ctx context.Context, d *schema.ResourceData, meta inte return nil, fmt.Errorf("error setting primary_nic id %w", err) } } else { - if server.Entities != nil && server.Entities.Nics != nil && len(*server.Entities.Nics.Items) > 0 { - primaryNic = (*server.Entities.Nics.Items)[0] + if server.Entities != nil && server.Entities.Nics != nil && len(server.Entities.Nics.Items) > 0 { + primaryNic = (server.Entities.Nics.Items)[0] } } if primaryNicId != "" { if server.Entities != nil && server.Entities.Nics != nil && server.Entities.Nics.Items != nil { - for _, nic := range *server.Entities.Nics.Items { + for _, nic := range server.Entities.Nics.Items { if *nic.Id == primaryNicId { primaryNic = nic - if primaryNic.Properties != nil && *nic.Properties.Ips != nil && len(*nic.Properties.Ips) > 0 { - log.Printf("[DEBUG] set primary_ip to %s", (*primaryNic.Properties.Ips)[0]) - if err := d.Set("primary_ip", (*primaryNic.Properties.Ips)[0]); err != nil { + if len(nic.Properties.Ips) > 0 { + log.Printf("[DEBUG] set primary_ip to %s", (primaryNic.Properties.Ips)[0]) + if err := d.Set("primary_ip", (primaryNic.Properties.Ips)[0]); err != nil { return nil, fmt.Errorf("error while setting primary ip %s: %w", d.Id(), err) } } @@ -1349,25 +1348,23 @@ func resourceServerImport(ctx context.Context, d *schema.ResourceData, meta inte func SetCdromProperties(image ionoscloud.Image) map[string]interface{} { cdrom := make(map[string]interface{}) - if image.Properties != nil { - utils.SetPropWithNilCheck(cdrom, "name", image.Properties.Name) - utils.SetPropWithNilCheck(cdrom, "description", image.Properties.Description) - utils.SetPropWithNilCheck(cdrom, "location", image.Properties.Location) - utils.SetPropWithNilCheck(cdrom, "size", image.Properties.Size) - utils.SetPropWithNilCheck(cdrom, "cpu_hot_plug", image.Properties.CpuHotPlug) - utils.SetPropWithNilCheck(cdrom, "cpu_hot_unplug", image.Properties.CpuHotUnplug) - utils.SetPropWithNilCheck(cdrom, "ram_hot_plug", image.Properties.RamHotPlug) - utils.SetPropWithNilCheck(cdrom, "ram_hot_unplug", image.Properties.RamHotUnplug) - utils.SetPropWithNilCheck(cdrom, "nic_hot_plug", image.Properties.NicHotPlug) - utils.SetPropWithNilCheck(cdrom, "nic_hot_unplug", image.Properties.NicHotUnplug) - utils.SetPropWithNilCheck(cdrom, "disc_virtio_hot_plug", image.Properties.DiscVirtioHotPlug) - utils.SetPropWithNilCheck(cdrom, "disc_virtio_hot_unplug", image.Properties.DiscVirtioHotUnplug) - utils.SetPropWithNilCheck(cdrom, "disc_scsi_hot_plug", image.Properties.DiscScsiHotPlug) - utils.SetPropWithNilCheck(cdrom, "disc_scsi_hot_unplug", image.Properties.DiscScsiHotUnplug) - utils.SetPropWithNilCheck(cdrom, "licence_type", image.Properties.LicenceType) - utils.SetPropWithNilCheck(cdrom, "image_type", image.Properties.ImageType) - utils.SetPropWithNilCheck(cdrom, "public", image.Properties.Public) - } + utils.SetPropWithNilCheck(cdrom, "name", image.Properties.Name) + utils.SetPropWithNilCheck(cdrom, "description", image.Properties.Description) + utils.SetPropWithNilCheck(cdrom, "location", image.Properties.Location) + utils.SetPropWithNilCheck(cdrom, "size", image.Properties.Size) + utils.SetPropWithNilCheck(cdrom, "cpu_hot_plug", image.Properties.CpuHotPlug) + utils.SetPropWithNilCheck(cdrom, "cpu_hot_unplug", image.Properties.CpuHotUnplug) + utils.SetPropWithNilCheck(cdrom, "ram_hot_plug", image.Properties.RamHotPlug) + utils.SetPropWithNilCheck(cdrom, "ram_hot_unplug", image.Properties.RamHotUnplug) + utils.SetPropWithNilCheck(cdrom, "nic_hot_plug", image.Properties.NicHotPlug) + utils.SetPropWithNilCheck(cdrom, "nic_hot_unplug", image.Properties.NicHotUnplug) + utils.SetPropWithNilCheck(cdrom, "disc_virtio_hot_plug", image.Properties.DiscVirtioHotPlug) + utils.SetPropWithNilCheck(cdrom, "disc_virtio_hot_unplug", image.Properties.DiscVirtioHotUnplug) + utils.SetPropWithNilCheck(cdrom, "disc_scsi_hot_plug", image.Properties.DiscScsiHotPlug) + utils.SetPropWithNilCheck(cdrom, "disc_scsi_hot_unplug", image.Properties.DiscScsiHotUnplug) + utils.SetPropWithNilCheck(cdrom, "licence_type", image.Properties.LicenceType) + utils.SetPropWithNilCheck(cdrom, "image_type", image.Properties.ImageType) + utils.SetPropWithNilCheck(cdrom, "public", image.Properties.Public) return cdrom } @@ -1453,7 +1450,7 @@ func getServerData(d *schema.ResourceData) (*ionoscloud.Server, error) { bootCdrom := d.Get("boot_cdrom").(string) if utils.IsValidUUID(bootCdrom) { server.Properties.BootCdrom = &ionoscloud.ResourceReference{ - Id: &bootCdrom, + Id: bootCdrom, } } else { @@ -1488,79 +1485,77 @@ func setResourceServerData(ctx context.Context, client *ionoscloud.APIClient, d } datacenterId := d.Get("datacenter_id").(string) - if server.Properties != nil { - if server.Properties.Name != nil { - if err := d.Set("name", *server.Properties.Name); err != nil { - return fmt.Errorf("error setting name %w", err) - } + if server.Properties.Name != nil { + if err := d.Set("name", *server.Properties.Name); err != nil { + return fmt.Errorf("error setting name %w", err) } - if server.Properties.Hostname != nil { - if err := d.Set("hostname", *server.Properties.Hostname); err != nil { - return fmt.Errorf("error setting hostname %w", err) - } + } + if server.Properties.Hostname != nil { + if err := d.Set("hostname", *server.Properties.Hostname); err != nil { + return fmt.Errorf("error setting hostname %w", err) } - if server.Properties.Cores != nil { - if err := d.Set("cores", *server.Properties.Cores); err != nil { - return fmt.Errorf("error setting cores %w", err) - } + } + if server.Properties.Cores != nil { + if err := d.Set("cores", *server.Properties.Cores); err != nil { + return fmt.Errorf("error setting cores %w", err) } + } - if server.Properties.Ram != nil { - if err := d.Set("ram", *server.Properties.Ram); err != nil { - return fmt.Errorf("error setting ram %w", err) - } + if server.Properties.Ram != nil { + if err := d.Set("ram", *server.Properties.Ram); err != nil { + return fmt.Errorf("error setting ram %w", err) } + } - if server.Properties.AvailabilityZone != nil { - if err := d.Set("availability_zone", *server.Properties.AvailabilityZone); err != nil { - return fmt.Errorf("error setting availability_zone %w", err) - } + if server.Properties.AvailabilityZone != nil { + if err := d.Set("availability_zone", *server.Properties.AvailabilityZone); err != nil { + return fmt.Errorf("error setting availability_zone %w", err) } + } - if server.Properties.CpuFamily != nil { - if err := d.Set("cpu_family", *server.Properties.CpuFamily); err != nil { - return fmt.Errorf("error setting cpu_family %w", err) - } + if server.Properties.CpuFamily != nil { + if err := d.Set("cpu_family", *server.Properties.CpuFamily); err != nil { + return fmt.Errorf("error setting cpu_family %w", err) } + } - if server.Properties.Type != nil { - if err := d.Set("type", *server.Properties.Type); err != nil { - return fmt.Errorf("error setting type %w", err) - } + if server.Properties.Type != nil { + if err := d.Set("type", *server.Properties.Type); err != nil { + return fmt.Errorf("error setting type %w", err) } + } - if server.Properties.VmState != nil { - if err := d.Set("vm_state", *server.Properties.VmState); err != nil { - return fmt.Errorf("error setting vm_state %w", err) - } + if server.Properties.VmState != nil { + if err := d.Set("vm_state", *server.Properties.VmState); err != nil { + return fmt.Errorf("error setting vm_state %w", err) } + } - if server.Properties.BootCdrom != nil { - if err := d.Set("boot_cdrom", *server.Properties.BootCdrom.Id); err != nil { - return fmt.Errorf("error setting boot_cdrom %w", err) - } - } else { - d.Set("boot_cdrom", nil) + if server.Properties.BootCdrom != nil { + if err := d.Set("boot_cdrom", server.Properties.BootCdrom.Id); err != nil { + return fmt.Errorf("error setting boot_cdrom %w", err) } + } else { + d.Set("boot_cdrom", nil) + } - if server.Properties.BootVolume != nil { - if err := d.Set("boot_volume", *server.Properties.BootVolume.Id); err != nil { - return fmt.Errorf("error setting bootVolume %w", err) - } - } else { - d.Set("boot_volume", nil) + if server.Properties.BootVolume != nil { + if err := d.Set("boot_volume", server.Properties.BootVolume.Id); err != nil { + return fmt.Errorf("error setting bootVolume %w", err) } - if server.Entities != nil { - if server.Entities.Volumes != nil && server.Entities.Volumes.Items != nil && len(*server.Entities.Volumes.Items) > 0 && - (*server.Entities.Volumes.Items)[0].Properties != nil && (*server.Entities.Volumes.Items)[0].Properties.Image != nil { - if err := d.Set("boot_image", *(*server.Entities.Volumes.Items)[0].Properties.Image); err != nil { - return fmt.Errorf("error setting boot_image %w", err) - } + } else { + d.Set("boot_volume", nil) + } + if server.Entities != nil { + if server.Entities.Volumes != nil && len(server.Entities.Volumes.Items) > 0 && + (server.Entities.Volumes.Items)[0].Properties.Image != nil { + if err := d.Set("boot_image", *(server.Entities.Volumes.Items)[0].Properties.Image); err != nil { + return fmt.Errorf("error setting boot_image %w", err) } - if server.Entities.Securitygroups != nil && server.Entities.Securitygroups.Items != nil { - if err := nsg.SetNSGInResourceData(d, server.Entities.Securitygroups.Items); err != nil { - return err - } + } + if server.Entities.Securitygroups != nil && server.Entities.Securitygroups.Items != nil { + if err := nsg.SetNSGInResourceData(d, &server.Entities.Securitygroups.Items); err != nil { + return err } } } @@ -1623,10 +1618,10 @@ func setResourceServerData(ctx context.Context, client *ionoscloud.APIClient, d var nicEntry map[string]interface{} var fwRulesEntries []map[string]interface{} - if nic != nil && nic.Properties != nil { + if nic != nil { // fixes #467 - if nic.Properties.Ips != nil && len(*nic.Properties.Ips) > 0 { - if err := d.Set("primary_ip", (*nic.Properties.Ips)[0]); err != nil { + if nic.Properties.Ips != nil && len(nic.Properties.Ips) > 0 { + if err := d.Set("primary_ip", (nic.Properties.Ips)[0]); err != nil { return err } } @@ -1646,7 +1641,7 @@ func setResourceServerData(ctx context.Context, client *ionoscloud.APIClient, d } if nic != nil && nic.Entities != nil && nic.Entities.Securitygroups != nil && nic.Entities.Securitygroups.Items != nil { nsgIDs := make([]string, 0) - for _, group := range *nic.Entities.Securitygroups.Items { + for _, group := range nic.Entities.Securitygroups.Items { if group.Id != nil { id := *group.Id nsgIDs = append(nsgIDs, id) diff --git a/ionoscloud/resource_server_boot_device_selection.go b/ionoscloud/resource_server_boot_device_selection.go index 1f7fb0aab..079abe95b 100644 --- a/ionoscloud/resource_server_boot_device_selection.go +++ b/ionoscloud/resource_server_boot_device_selection.go @@ -11,7 +11,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/diag" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" @@ -149,14 +149,14 @@ func resourceServerBootDeviceSelectionDelete(ctx context.Context, d *schema.Reso func setServerBootDeviceSelectionData(d *schema.ResourceData, server *ionoscloud.Server) error { if server.Properties.BootCdrom != nil { - if err := d.Set("boot_device_id", *server.Properties.BootCdrom.Id); err != nil { + if err := d.Set("boot_device_id", server.Properties.BootCdrom.Id); err != nil { return err } return nil } if server.Properties.BootVolume != nil { - if err := d.Set("boot_device_id", *server.Properties.BootVolume.Id); err != nil { + if err := d.Set("boot_device_id", server.Properties.BootVolume.Id); err != nil { return err } } diff --git a/ionoscloud/resource_server_test.go b/ionoscloud/resource_server_test.go index 735d9fa8a..544c5c1a1 100644 --- a/ionoscloud/resource_server_test.go +++ b/ionoscloud/resource_server_test.go @@ -12,7 +12,7 @@ import ( "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/utils/constant" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" "github.com/hashicorp/terraform-plugin-testing/helper/resource" "github.com/hashicorp/terraform-plugin-testing/terraform" @@ -950,7 +950,7 @@ func testAccCheckServerAndVolumesDestroyed(dcName string) resource.TestCheckFunc logApiRequestTime(apiResponse) if err == nil { if serverItems, ok := servers.GetItemsOk(); ok { - if len(*serverItems) > 0 { + if len(serverItems) > 0 { return fmt.Errorf("server still exists for data center with ID: %s", dcId) } } @@ -962,7 +962,7 @@ func testAccCheckServerAndVolumesDestroyed(dcName string) resource.TestCheckFunc logApiRequestTime(apiResponse) if err == nil { if volItems, ok := volumes.GetItemsOk(); ok { - if len(*volItems) > 0 { + if len(volItems) > 0 { return fmt.Errorf("volumes still exists for data center with ID: %s", dcId) } } diff --git a/ionoscloud/resource_share.go b/ionoscloud/resource_share.go index 1af6f5eea..f2dc5eaa7 100644 --- a/ionoscloud/resource_share.go +++ b/ionoscloud/resource_share.go @@ -10,7 +10,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/cloudapi" ) @@ -52,7 +52,7 @@ func resourceShareCreate(ctx context.Context, d *schema.ResourceData, meta inter client := meta.(services.SdkBundle).CloudApiClient request := ionoscloud.GroupShare{ - Properties: &ionoscloud.GroupShareProperties{}, + Properties: ionoscloud.GroupShareProperties{}, } tempSharePrivilege := d.Get("share_privilege").(bool) @@ -110,7 +110,7 @@ func resourceShareUpdate(ctx context.Context, d *schema.ResourceData, meta inter tempEditPrivilege := d.Get("edit_privilege").(bool) shareReq := ionoscloud.GroupShare{ - Properties: &ionoscloud.GroupShareProperties{ + Properties: ionoscloud.GroupShareProperties{ EditPrivilege: &tempEditPrivilege, SharePrivilege: &tempSharePrivilege, }, diff --git a/ionoscloud/resource_share_test.go b/ionoscloud/resource_share_test.go index b8c43b973..c1146fdda 100644 --- a/ionoscloud/resource_share_test.go +++ b/ionoscloud/resource_share_test.go @@ -7,7 +7,7 @@ import ( "fmt" "testing" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/utils/constant" diff --git a/ionoscloud/resource_snapshot.go b/ionoscloud/resource_snapshot.go index 425082f68..d1ecdcdb8 100644 --- a/ionoscloud/resource_snapshot.go +++ b/ionoscloud/resource_snapshot.go @@ -3,12 +3,13 @@ package ionoscloud import ( "context" "fmt" + "github.com/ionos-cloud/sdk-go-bundle/shared" "log" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/cloudapi" @@ -130,15 +131,15 @@ func resourceSnapshotCreate(ctx context.Context, d *schema.ResourceData, meta in snapshot := ionoscloud.NewCreateSnapshot() snapshot.Properties = ionoscloud.NewCreateSnapshotProperties() props := snapshot.Properties - props.Name = ionoscloud.ToPtr(name) + props.Name = shared.ToPtr(name) if v, ok := d.GetOk("description"); ok { - props.Description = ionoscloud.ToPtr(v.(string)) + props.Description = shared.ToPtr(v.(string)) } if v, ok := d.GetOk("licence_type"); ok { - props.LicenceType = ionoscloud.ToPtr(v.(string)) + props.LicenceType = shared.ToPtr(v.(string)) } if v, ok := d.GetOk("sec_auth_protection"); ok { - props.SecAuthProtection = ionoscloud.ToPtr(v.(bool)) + props.SecAuthProtection = shared.ToPtr(v.(bool)) } rsp, apiResponse, err := client.VolumesApi.DatacentersVolumesCreateSnapshotPost(ctx, dcId, volumeId).Snapshot(*snapshot).Execute() logApiRequestTime(apiResponse) @@ -188,31 +189,31 @@ func resourceSnapshotUpdate(ctx context.Context, d *schema.ResourceData, meta in input.Name = &name if d.HasChange("description") { - input.Description = ionoscloud.ToPtr(d.Get("description").(string)) + input.Description = shared.ToPtr(d.Get("description").(string)) } if d.HasChange("licence_type") { - input.LicenceType = ionoscloud.ToPtr(d.Get("licence_type").(string)) + input.LicenceType = shared.ToPtr(d.Get("licence_type").(string)) } if d.HasChange("sec_auth_protection") { - input.SecAuthProtection = ionoscloud.ToPtr(d.Get("sec_auth_protection").(bool)) + input.SecAuthProtection = shared.ToPtr(d.Get("sec_auth_protection").(bool)) } if d.HasChange("cpu_hot_plug") { - input.CpuHotPlug = ionoscloud.ToPtr(d.Get("cpu_hot_plug").(bool)) + input.CpuHotPlug = shared.ToPtr(d.Get("cpu_hot_plug").(bool)) } if d.HasChange("nic_hot_plug") { - input.NicHotPlug = ionoscloud.ToPtr(d.Get("nic_hot_plug").(bool)) + input.NicHotPlug = shared.ToPtr(d.Get("nic_hot_plug").(bool)) } if d.HasChange("nic_hot_unplug") { - input.NicHotUnplug = ionoscloud.ToPtr(d.Get("nic_hot_unplug").(bool)) + input.NicHotUnplug = shared.ToPtr(d.Get("nic_hot_unplug").(bool)) } if d.HasChange("ram_hot_plug") { - input.RamHotPlug = ionoscloud.ToPtr(d.Get("ram_hot_plug").(bool)) + input.RamHotPlug = shared.ToPtr(d.Get("ram_hot_plug").(bool)) } if d.HasChange("disc_virtio_hot_plug") { - input.DiscVirtioHotPlug = ionoscloud.ToPtr(d.Get("disc_virtio_hot_plug").(bool)) + input.DiscVirtioHotPlug = shared.ToPtr(d.Get("disc_virtio_hot_plug").(bool)) } if d.HasChange("disc_virtio_hot_unplug") { - input.DiscVirtioHotUnplug = ionoscloud.ToPtr(d.Get("disc_virtio_hot_unplug").(bool)) + input.DiscVirtioHotUnplug = shared.ToPtr(d.Get("disc_virtio_hot_unplug").(bool)) } _, apiResponse, err := client.SnapshotsApi.SnapshotsPatch(ctx, d.Id()).Snapshot(*input).Execute() logApiRequestTime(apiResponse) @@ -273,101 +274,99 @@ func resourceSnapshotImport(ctx context.Context, d *schema.ResourceData, meta in func setSnapshotData(d *schema.ResourceData, snapshot *ionoscloud.Snapshot) error { d.SetId(*snapshot.Id) - if snapshot.Properties != nil { - if snapshot.Properties.Name != nil { - if err := d.Set("name", *snapshot.Properties.Name); err != nil { - return err - } + if snapshot.Properties.Name != nil { + if err := d.Set("name", *snapshot.Properties.Name); err != nil { + return err } + } - if snapshot.Properties.Location != nil { - if err := d.Set("location", *snapshot.Properties.Location); err != nil { - return err - } + if snapshot.Properties.Location != nil { + if err := d.Set("location", *snapshot.Properties.Location); err != nil { + return err } + } - if snapshot.Properties.Size != nil { - if err := d.Set("size", *snapshot.Properties.Size); err != nil { - return err - } + if snapshot.Properties.Size != nil { + if err := d.Set("size", *snapshot.Properties.Size); err != nil { + return err } + } - if snapshot.Properties.Description != nil { - if err := d.Set("description", *snapshot.Properties.Description); err != nil { - return err - } + if snapshot.Properties.Description != nil { + if err := d.Set("description", *snapshot.Properties.Description); err != nil { + return err } + } - if snapshot.Properties.LicenceType != nil { - if err := d.Set("licence_type", *snapshot.Properties.LicenceType); err != nil { - return err - } + if snapshot.Properties.LicenceType != nil { + if err := d.Set("licence_type", *snapshot.Properties.LicenceType); err != nil { + return err } + } - if snapshot.Properties.SecAuthProtection != nil { - if err := d.Set("sec_auth_protection", *snapshot.Properties.SecAuthProtection); err != nil { - return err - } + if snapshot.Properties.SecAuthProtection != nil { + if err := d.Set("sec_auth_protection", *snapshot.Properties.SecAuthProtection); err != nil { + return err } + } - if snapshot.Properties.CpuHotPlug != nil { - if err := d.Set("cpu_hot_plug", *snapshot.Properties.CpuHotPlug); err != nil { - return err - } + if snapshot.Properties.CpuHotPlug != nil { + if err := d.Set("cpu_hot_plug", *snapshot.Properties.CpuHotPlug); err != nil { + return err } + } - if snapshot.Properties.CpuHotUnplug != nil { - if err := d.Set("cpu_hot_unplug", *snapshot.Properties.CpuHotUnplug); err != nil { - return err - } + if snapshot.Properties.CpuHotUnplug != nil { + if err := d.Set("cpu_hot_unplug", *snapshot.Properties.CpuHotUnplug); err != nil { + return err } + } - if snapshot.Properties.RamHotPlug != nil { - if err := d.Set("ram_hot_plug", *snapshot.Properties.RamHotPlug); err != nil { - return err - } + if snapshot.Properties.RamHotPlug != nil { + if err := d.Set("ram_hot_plug", *snapshot.Properties.RamHotPlug); err != nil { + return err } + } - if snapshot.Properties.RamHotUnplug != nil { - if err := d.Set("ram_hot_unplug", *snapshot.Properties.RamHotUnplug); err != nil { - return err - } + if snapshot.Properties.RamHotUnplug != nil { + if err := d.Set("ram_hot_unplug", *snapshot.Properties.RamHotUnplug); err != nil { + return err } + } - if snapshot.Properties.NicHotPlug != nil { - if err := d.Set("nic_hot_plug", *snapshot.Properties.NicHotPlug); err != nil { - return err - } + if snapshot.Properties.NicHotPlug != nil { + if err := d.Set("nic_hot_plug", *snapshot.Properties.NicHotPlug); err != nil { + return err } + } - if snapshot.Properties.NicHotUnplug != nil { - if err := d.Set("nic_hot_unplug", *snapshot.Properties.NicHotUnplug); err != nil { - return err - } + if snapshot.Properties.NicHotUnplug != nil { + if err := d.Set("nic_hot_unplug", *snapshot.Properties.NicHotUnplug); err != nil { + return err } + } - if snapshot.Properties.DiscVirtioHotPlug != nil { - if err := d.Set("disc_virtio_hot_plug", *snapshot.Properties.DiscVirtioHotPlug); err != nil { - return err - } + if snapshot.Properties.DiscVirtioHotPlug != nil { + if err := d.Set("disc_virtio_hot_plug", *snapshot.Properties.DiscVirtioHotPlug); err != nil { + return err } + } - if snapshot.Properties.DiscVirtioHotUnplug != nil { - if err := d.Set("disc_virtio_hot_unplug", *snapshot.Properties.DiscVirtioHotUnplug); err != nil { - return err - } + if snapshot.Properties.DiscVirtioHotUnplug != nil { + if err := d.Set("disc_virtio_hot_unplug", *snapshot.Properties.DiscVirtioHotUnplug); err != nil { + return err } + } - if snapshot.Properties.DiscScsiHotPlug != nil { - if err := d.Set("disc_scsi_hot_plug", *snapshot.Properties.DiscVirtioHotUnplug); err != nil { - return err - } + if snapshot.Properties.DiscScsiHotPlug != nil { + if err := d.Set("disc_scsi_hot_plug", *snapshot.Properties.DiscVirtioHotUnplug); err != nil { + return err } + } - if snapshot.Properties.DiscScsiHotUnplug != nil { - if err := d.Set("disc_scsi_hot_unplug", *snapshot.Properties.DiscVirtioHotUnplug); err != nil { - return err - } + if snapshot.Properties.DiscScsiHotUnplug != nil { + if err := d.Set("disc_scsi_hot_unplug", *snapshot.Properties.DiscVirtioHotUnplug); err != nil { + return err } } return nil diff --git a/ionoscloud/resource_snapshot_test.go b/ionoscloud/resource_snapshot_test.go index 9f1661c7a..25ea01559 100644 --- a/ionoscloud/resource_snapshot_test.go +++ b/ionoscloud/resource_snapshot_test.go @@ -8,7 +8,7 @@ import ( "regexp" "testing" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/utils/constant" diff --git a/ionoscloud/resource_target_group.go b/ionoscloud/resource_target_group.go index 35e18f6e6..ec3493347 100644 --- a/ionoscloud/resource_target_group.go +++ b/ionoscloud/resource_target_group.go @@ -7,7 +7,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/cloudapi" @@ -174,22 +174,22 @@ func resourceTargetGroupCreate(ctx context.Context, d *schema.ResourceData, meta client := meta.(services.SdkBundle).CloudApiClient targetGroup := ionoscloud.TargetGroup{ - Properties: &ionoscloud.TargetGroupProperties{}, + Properties: ionoscloud.TargetGroupProperties{}, } if name, nameOk := d.GetOk("name"); nameOk { name := name.(string) - targetGroup.Properties.Name = &name + targetGroup.Properties.Name = name } if algorithm, algorithmOk := d.GetOk("algorithm"); algorithmOk { algorithm := algorithm.(string) - targetGroup.Properties.Algorithm = &algorithm + targetGroup.Properties.Algorithm = algorithm } if protocol, protocolOk := d.GetOk("protocol"); protocolOk { protocol := protocol.(string) - targetGroup.Properties.Protocol = &protocol + targetGroup.Properties.Protocol = protocol } if protocolVersion, protocolVersionOk := d.GetOk("protocol_version"); protocolVersionOk { @@ -197,7 +197,7 @@ func resourceTargetGroupCreate(ctx context.Context, d *schema.ResourceData, meta targetGroup.Properties.ProtocolVersion = &protocolVersion } - targetGroup.Properties.Targets = getTargetGroupTargetData(d) + targetGroup.Properties.Targets = *getTargetGroupTargetData(d) if _, healthCheckOk := d.GetOk("health_check.0"); healthCheckOk { targetGroup.Properties.HealthCheck = getTargetGroupHealthCheckData(d) @@ -252,22 +252,22 @@ func resourceTargetGroupUpdate(ctx context.Context, d *schema.ResourceData, meta client := meta.(services.SdkBundle).CloudApiClient targetGroup := ionoscloud.TargetGroupPut{ - Properties: &ionoscloud.TargetGroupProperties{}, + Properties: ionoscloud.TargetGroupProperties{}, } if name, nameOk := d.GetOk("name"); nameOk { name := name.(string) - targetGroup.Properties.Name = &name + targetGroup.Properties.Name = name } if algorithm, algorithmOk := d.GetOk("algorithm"); algorithmOk { algorithm := algorithm.(string) - targetGroup.Properties.Algorithm = &algorithm + targetGroup.Properties.Algorithm = algorithm } if protocol, protocolOk := d.GetOk("protocol"); protocolOk { protocol := protocol.(string) - targetGroup.Properties.Protocol = &protocol + targetGroup.Properties.Protocol = protocol } if protocolVersion, protocolVersionOk := d.GetOk("protocol_version"); protocolVersionOk { @@ -275,7 +275,7 @@ func resourceTargetGroupUpdate(ctx context.Context, d *schema.ResourceData, meta targetGroup.Properties.ProtocolVersion = &protocolVersion } - targetGroup.Properties.Targets = getTargetGroupTargetData(d) + targetGroup.Properties.Targets = *getTargetGroupTargetData(d) if _, healthCheckOk := d.GetOk("health_check.0"); healthCheckOk { targetGroup.Properties.HealthCheck = getTargetGroupHealthCheckData(d) @@ -350,137 +350,116 @@ func setTargetGroupData(d *schema.ResourceData, targetGroup *ionoscloud.TargetGr d.SetId(*targetGroup.Id) } - if targetGroup.Properties != nil { - - if targetGroup.Properties.Name != nil { - err := d.Set("name", *targetGroup.Properties.Name) - if err != nil { - return fmt.Errorf("error while setting name property for target group %s: %w", d.Id(), err) - } - } + err := d.Set("name", targetGroup.Properties.Name) + if err != nil { + return fmt.Errorf("error while setting name property for target group %s: %w", d.Id(), err) + } - if targetGroup.Properties.Algorithm != nil { - err := d.Set("algorithm", *targetGroup.Properties.Algorithm) - if err != nil { - return fmt.Errorf("error while setting algorithm property for target group %s: %w", d.Id(), err) - } - } + err = d.Set("algorithm", targetGroup.Properties.Algorithm) + if err != nil { + return fmt.Errorf("error while setting algorithm property for target group %s: %w", d.Id(), err) + } - if targetGroup.Properties.Protocol != nil { - err := d.Set("protocol", *targetGroup.Properties.Protocol) - if err != nil { - return fmt.Errorf("error while setting protocol property for target group %s: %w", d.Id(), err) - } - } + err = d.Set("protocol", targetGroup.Properties.Protocol) + if err != nil { + return fmt.Errorf("error while setting protocol property for target group %s: %w", d.Id(), err) + } - if targetGroup.Properties.ProtocolVersion != nil { - err := d.Set("protocol_version", *targetGroup.Properties.ProtocolVersion) - if err != nil { - return fmt.Errorf("error while setting protocol_version property for target group %s: %w", d.Id(), err) - } + if targetGroup.Properties.ProtocolVersion != nil { + err := d.Set("protocol_version", *targetGroup.Properties.ProtocolVersion) + if err != nil { + return fmt.Errorf("error while setting protocol_version property for target group %s: %w", d.Id(), err) } + } - forwardingRuleTargets := make([]interface{}, 0) - if targetGroup.Properties.Targets != nil && len(*targetGroup.Properties.Targets) > 0 { - forwardingRuleTargets = make([]interface{}, 0) - for _, target := range *targetGroup.Properties.Targets { - targetEntry := make(map[string]interface{}) - - if target.Ip != nil { - targetEntry["ip"] = *target.Ip - } - - if target.Port != nil { - targetEntry["port"] = *target.Port - } - - if target.Weight != nil { - targetEntry["weight"] = *target.Weight - } - - if target.ProxyProtocol != nil { - targetEntry["proxy_protocol"] = *target.ProxyProtocol - } + forwardingRuleTargets := make([]interface{}, 0) + if len(targetGroup.Properties.Targets) > 0 { + forwardingRuleTargets = make([]interface{}, 0) + for _, target := range targetGroup.Properties.Targets { + targetEntry := make(map[string]interface{}) - if target.HealthCheckEnabled != nil { - targetEntry["health_check_enabled"] = *target.HealthCheckEnabled - } + targetEntry["ip"] = target.Ip + targetEntry["port"] = target.Port + targetEntry["weight"] = target.Weight - if target.MaintenanceEnabled != nil { - targetEntry["maintenance_enabled"] = *target.MaintenanceEnabled - } + if target.ProxyProtocol != nil { + targetEntry["proxy_protocol"] = *target.ProxyProtocol + } - forwardingRuleTargets = append(forwardingRuleTargets, targetEntry) + if target.HealthCheckEnabled != nil { + targetEntry["health_check_enabled"] = *target.HealthCheckEnabled } - } - if len(forwardingRuleTargets) > 0 { - if err := d.Set("targets", forwardingRuleTargets); err != nil { - return fmt.Errorf("error while setting targets property for target group %s: %w", d.Id(), err) + if target.MaintenanceEnabled != nil { + targetEntry["maintenance_enabled"] = *target.MaintenanceEnabled } + + forwardingRuleTargets = append(forwardingRuleTargets, targetEntry) } + } - if targetGroup.Properties.HealthCheck != nil { - healthCheck := make([]interface{}, 1) + if len(forwardingRuleTargets) > 0 { + if err := d.Set("targets", forwardingRuleTargets); err != nil { + return fmt.Errorf("error while setting targets property for target group %s: %w", d.Id(), err) + } + } - healthCheckEntry := make(map[string]interface{}) + if targetGroup.Properties.HealthCheck != nil { + healthCheck := make([]interface{}, 1) - if targetGroup.Properties.HealthCheck.CheckTimeout != nil { - healthCheckEntry["check_timeout"] = *targetGroup.Properties.HealthCheck.CheckTimeout - } + healthCheckEntry := make(map[string]interface{}) - if targetGroup.Properties.HealthCheck.CheckInterval != nil { - healthCheckEntry["check_interval"] = *targetGroup.Properties.HealthCheck.CheckInterval - } + if targetGroup.Properties.HealthCheck.CheckTimeout != nil { + healthCheckEntry["check_timeout"] = *targetGroup.Properties.HealthCheck.CheckTimeout + } - if targetGroup.Properties.HealthCheck.Retries != nil { - healthCheckEntry["retries"] = *targetGroup.Properties.HealthCheck.Retries - } + if targetGroup.Properties.HealthCheck.CheckInterval != nil { + healthCheckEntry["check_interval"] = *targetGroup.Properties.HealthCheck.CheckInterval + } - healthCheck[0] = healthCheckEntry - err := d.Set("health_check", healthCheck) - if err != nil { - return fmt.Errorf("error while setting health_check property for target group %s: %w", d.Id(), err) - } + if targetGroup.Properties.HealthCheck.Retries != nil { + healthCheckEntry["retries"] = *targetGroup.Properties.HealthCheck.Retries } - if targetGroup.Properties.HttpHealthCheck != nil { - httpHealthCheck := make([]interface{}, 1) + healthCheck[0] = healthCheckEntry + err := d.Set("health_check", healthCheck) + if err != nil { + return fmt.Errorf("error while setting health_check property for target group %s: %w", d.Id(), err) + } + } - httpHealthCheckEntry := make(map[string]interface{}) + if targetGroup.Properties.HttpHealthCheck != nil { + httpHealthCheck := make([]interface{}, 1) - if targetGroup.Properties.HttpHealthCheck.Path != nil { - httpHealthCheckEntry["path"] = *targetGroup.Properties.HttpHealthCheck.Path - } + httpHealthCheckEntry := make(map[string]interface{}) - if targetGroup.Properties.HttpHealthCheck.Method != nil { - httpHealthCheckEntry["method"] = *targetGroup.Properties.HttpHealthCheck.Method - } + if targetGroup.Properties.HttpHealthCheck.Path != nil { + httpHealthCheckEntry["path"] = *targetGroup.Properties.HttpHealthCheck.Path + } - if targetGroup.Properties.HttpHealthCheck.MatchType != nil { - httpHealthCheckEntry["match_type"] = *targetGroup.Properties.HttpHealthCheck.MatchType - } + if targetGroup.Properties.HttpHealthCheck.Method != nil { + httpHealthCheckEntry["method"] = *targetGroup.Properties.HttpHealthCheck.Method + } - if targetGroup.Properties.HttpHealthCheck.Response != nil { - httpHealthCheckEntry["response"] = *targetGroup.Properties.HttpHealthCheck.Response - } + httpHealthCheckEntry["match_type"] = targetGroup.Properties.HttpHealthCheck.MatchType - if targetGroup.Properties.HttpHealthCheck.Regex != nil { - httpHealthCheckEntry["regex"] = *targetGroup.Properties.HttpHealthCheck.Regex - } + httpHealthCheckEntry["response"] = targetGroup.Properties.HttpHealthCheck.Response - if targetGroup.Properties.HttpHealthCheck.Negate != nil { - httpHealthCheckEntry["negate"] = *targetGroup.Properties.HttpHealthCheck.Negate - } + if targetGroup.Properties.HttpHealthCheck.Regex != nil { + httpHealthCheckEntry["regex"] = *targetGroup.Properties.HttpHealthCheck.Regex + } - httpHealthCheck[0] = httpHealthCheckEntry - err := d.Set("http_health_check", httpHealthCheck) - if err != nil { - return fmt.Errorf("error while setting http_health_check property for target group %s: %w", d.Id(), err) - } + if targetGroup.Properties.HttpHealthCheck.Negate != nil { + httpHealthCheckEntry["negate"] = *targetGroup.Properties.HttpHealthCheck.Negate } + httpHealthCheck[0] = httpHealthCheckEntry + err := d.Set("http_health_check", httpHealthCheck) + if err != nil { + return fmt.Errorf("error while setting http_health_check property for target group %s: %w", d.Id(), err) + } } + return nil } @@ -495,17 +474,17 @@ func getTargetGroupTargetData(d *schema.ResourceData) *[]ionoscloud.TargetGroupT target := ionoscloud.TargetGroupTarget{} if ip, ipOk := d.GetOk(fmt.Sprintf("targets.%d.ip", targetIndex)); ipOk { ip := ip.(string) - target.Ip = &ip + target.Ip = ip } if port, portOk := d.GetOk(fmt.Sprintf("targets.%d.port", targetIndex)); portOk { port := int32(port.(int)) - target.Port = &port + target.Port = port } if weight, weightOk := d.GetOk(fmt.Sprintf("targets.%d.weight", targetIndex)); weightOk { weight := int32(weight.(int)) - target.Weight = &weight + target.Weight = weight } if proxy, proxyOk := d.GetOk(fmt.Sprintf("targets.%d.proxy_protocol", targetIndex)); proxyOk { @@ -562,12 +541,12 @@ func getTargetGroupHttpHealthCheckData(d *schema.ResourceData) *ionoscloud.Targe if matchType, matchTypeOk := d.GetOk("http_health_check.0.match_type"); matchTypeOk { matchType := matchType.(string) - httpHealthCheck.MatchType = &matchType + httpHealthCheck.MatchType = matchType } if response, responseOk := d.GetOk("http_health_check.0.response"); responseOk { response := response.(string) - httpHealthCheck.Response = &response + httpHealthCheck.Response = response } if regex, regexOk := d.GetOk("http_health_check.0.regex"); regexOk { diff --git a/ionoscloud/resource_target_group_test.go b/ionoscloud/resource_target_group_test.go index f6fcaeea0..eb33a1e7d 100644 --- a/ionoscloud/resource_target_group_test.go +++ b/ionoscloud/resource_target_group_test.go @@ -8,7 +8,7 @@ import ( "regexp" "testing" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/utils/constant" diff --git a/ionoscloud/resource_user.go b/ionoscloud/resource_user.go index 6e50403a3..ae2686708 100644 --- a/ionoscloud/resource_user.go +++ b/ionoscloud/resource_user.go @@ -8,7 +8,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/cloudapi" @@ -90,7 +90,7 @@ func resourceUser() *schema.Resource { func resourceUserCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { client := meta.(services.SdkBundle).CloudApiClient request := ionoscloud.UserPost{ - Properties: &ionoscloud.UserPropertiesPost{}, + Properties: ionoscloud.UserPropertiesPost{}, } log.Printf("[DEBUG] NAME %s", d.Get("first_name")) @@ -193,17 +193,15 @@ func resourceUserUpdate(ctx context.Context, d *schema.ResourceData, meta interf } userReq := ionoscloud.UserPut{ - Properties: &ionoscloud.UserPropertiesPut{}, + Properties: ionoscloud.UserPropertiesPut{}, } // this is a PUT, so we first fill everything, then we change what has been modified - if foundUser.Properties != nil { - userReq.Properties.Firstname = foundUser.Properties.Firstname - userReq.Properties.Lastname = foundUser.Properties.Lastname - userReq.Properties.Email = foundUser.Properties.Email - userReq.Properties.Active = foundUser.Properties.Active - userReq.Properties.Administrator = foundUser.Properties.Administrator - userReq.Properties.ForceSecAuth = foundUser.Properties.ForceSecAuth - } + userReq.Properties.Firstname = foundUser.Properties.Firstname + userReq.Properties.Lastname = foundUser.Properties.Lastname + userReq.Properties.Email = foundUser.Properties.Email + userReq.Properties.Active = foundUser.Properties.Active + userReq.Properties.Administrator = foundUser.Properties.Administrator + userReq.Properties.ForceSecAuth = foundUser.Properties.ForceSecAuth if d.HasChange("first_name") { _, newValue := d.GetChange("first_name") @@ -335,50 +333,48 @@ func resourceUserImporter(ctx context.Context, d *schema.ResourceData, meta inte func setUserData(d *schema.ResourceData, user *ionoscloud.User) error { d.SetId(*user.Id) - if user.Properties != nil { - if user.Properties.Firstname != nil { - if err := d.Set("first_name", *user.Properties.Firstname); err != nil { - return err - } + if user.Properties.Firstname != nil { + if err := d.Set("first_name", *user.Properties.Firstname); err != nil { + return err } + } - if user.Properties.Lastname != nil { - if err := d.Set("last_name", *user.Properties.Lastname); err != nil { - return err - } + if user.Properties.Lastname != nil { + if err := d.Set("last_name", *user.Properties.Lastname); err != nil { + return err } - if user.Properties.Email != nil { - if err := d.Set("email", *user.Properties.Email); err != nil { - return err - } + } + if user.Properties.Email != nil { + if err := d.Set("email", *user.Properties.Email); err != nil { + return err } - if user.Properties.Administrator != nil { - if err := d.Set("administrator", *user.Properties.Administrator); err != nil { - return err - } + } + if user.Properties.Administrator != nil { + if err := d.Set("administrator", *user.Properties.Administrator); err != nil { + return err } - if user.Properties.ForceSecAuth != nil { - if err := d.Set("force_sec_auth", *user.Properties.ForceSecAuth); err != nil { - return err - } + } + if user.Properties.ForceSecAuth != nil { + if err := d.Set("force_sec_auth", *user.Properties.ForceSecAuth); err != nil { + return err } + } - if user.Properties.SecAuthActive != nil { - if err := d.Set("sec_auth_active", *user.Properties.SecAuthActive); err != nil { - return err - } + if user.Properties.SecAuthActive != nil { + if err := d.Set("sec_auth_active", *user.Properties.SecAuthActive); err != nil { + return err } + } - if user.Properties.S3CanonicalUserId != nil { - if err := d.Set("s3_canonical_user_id", *user.Properties.S3CanonicalUserId); err != nil { - return err - } + if user.Properties.S3CanonicalUserId != nil { + if err := d.Set("s3_canonical_user_id", *user.Properties.S3CanonicalUserId); err != nil { + return err } + } - if user.Properties.Active != nil { - if err := d.Set("active", *user.Properties.Active); err != nil { - return err - } + if user.Properties.Active != nil { + if err := d.Set("active", *user.Properties.Active); err != nil { + return err } } @@ -399,7 +395,7 @@ func getUserGroups(user *ionoscloud.User) []string { return groupIDs } - groups := *user.Entities.Groups.Items + groups := user.Entities.Groups.Items for _, g := range groups { if g.Id != nil { groupIDs = append(groupIDs, *g.Id) diff --git a/ionoscloud/resource_user_test.go b/ionoscloud/resource_user_test.go index b7cf1f8c5..6f0e6cee9 100644 --- a/ionoscloud/resource_user_test.go +++ b/ionoscloud/resource_user_test.go @@ -13,7 +13,7 @@ import ( "github.com/hashicorp/terraform-plugin-testing/helper/resource" "github.com/hashicorp/terraform-plugin-testing/terraform" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/utils" ) diff --git a/ionoscloud/resource_vcpu_server_test.go b/ionoscloud/resource_vcpu_server_test.go index 91d37c287..af027ec65 100644 --- a/ionoscloud/resource_vcpu_server_test.go +++ b/ionoscloud/resource_vcpu_server_test.go @@ -9,7 +9,7 @@ import ( "regexp" "testing" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" "github.com/hashicorp/terraform-plugin-testing/helper/resource" "github.com/hashicorp/terraform-plugin-testing/terraform" @@ -810,7 +810,7 @@ func testAccCheckServerVCPUAndVolumesDestroyed(dcName string) resource.TestCheck logApiRequestTime(apiResponse) if err == nil { if serverItems, ok := servers.GetItemsOk(); ok { - if len(*serverItems) > 0 { + if len(serverItems) > 0 { return fmt.Errorf("server still exists for data center with ID: %s", dcId) } } @@ -822,7 +822,7 @@ func testAccCheckServerVCPUAndVolumesDestroyed(dcName string) resource.TestCheck logApiRequestTime(apiResponse) if err == nil { if volItems, ok := volumes.GetItemsOk(); ok { - if len(*volItems) > 0 { + if len(volItems) > 0 { return fmt.Errorf("volumes still exists for data center with ID: %s", dcId) } } diff --git a/ionoscloud/resource_volume.go b/ionoscloud/resource_volume.go index 7beea5088..e5865f4ee 100644 --- a/ionoscloud/resource_volume.go +++ b/ionoscloud/resource_volume.go @@ -10,7 +10,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/cloudapi" @@ -210,9 +210,9 @@ func resourceVolumeCreate(ctx context.Context, d *schema.ResourceData, meta inte } volume := ionoscloud.Volume{ - Properties: volumeProperties, + Properties: *volumeProperties, } - image, imageAlias, err = getImage(ctx, client, d, *volume.Properties) + image, imageAlias, err = getImage(ctx, client, d, volume.Properties) if err != nil { return diag.FromErr(err) } @@ -349,7 +349,7 @@ func resourceVolumeUpdate(ctx context.Context, d *schema.ResourceData, meta inte if d.HasChange("size") { _, newValue := d.GetChange("size") newValueFloat32 := float32(newValue.(int)) - properties.Size = &newValueFloat32 + properties.Size = newValueFloat32 } if d.HasChange("bus") { _, newValue := d.GetChange("bus") @@ -478,11 +478,9 @@ func setVolumeData(d *schema.ResourceData, volume *ionoscloud.Volume) error { } } - if volume.Properties.Size != nil { - err := d.Set("size", *volume.Properties.Size) - if err != nil { - return fmt.Errorf("error while setting size property for volume %s: %w", d.Id(), err) - } + err := d.Set("size", volume.Properties.Size) + if err != nil { + return fmt.Errorf("error while setting size property for volume %s: %w", d.Id(), err) } if volume.Properties.Bus != nil { @@ -615,7 +613,7 @@ func getVolumeData(d *schema.ResourceData, path, serverType string) (*ionoscloud if !strings.EqualFold(serverType, constant.CubeType) { volumeSize = float32(d.Get(path + "size").(int)) if volumeSize > 0 { - volume.Size = &volumeSize + volume.Size = volumeSize } } @@ -659,7 +657,7 @@ func getVolumeData(d *schema.ResourceData, path, serverType string) (*ionoscloud publicKeys = append(publicKeys, publicKey) } if len(publicKeys) > 0 { - volume.SshKeys = &publicKeys + volume.SshKeys = publicKeys } } return &volume, nil @@ -688,7 +686,7 @@ func getImage(ctx context.Context, client *ionoscloud.APIClient, d *schema.Resou return image, imageAlias, fmt.Errorf("error fetching datacenter %s: (%w)", dcId, err) } - img, err := resolveVolumeImageName(ctx, client, imageName, *dc.Properties.Location) + img, err := resolveVolumeImageName(ctx, client, imageName, dc.Properties.Location) if err != nil { return image, imageAlias, err } @@ -704,14 +702,14 @@ func getImage(ctx context.Context, client *ionoscloud.APIClient, d *schema.Resou } else { log.Printf("[INFO] looking for an image alias for %s\n", imageName) - imageAlias = getImageAlias(ctx, client, imageName, *dc.Properties.Location) + imageAlias = getImageAlias(ctx, client, imageName, dc.Properties.Location) if imageAlias == "" { return image, imageAlias, fmt.Errorf("Could not find an image/imagealias/snapshot that matches %s ", imageName) } } } - if volume.ImagePassword == nil && (volume.SshKeys == nil || len(*volume.SshKeys) == 0) && isSnapshot == false && + if volume.ImagePassword == nil && len(volume.SshKeys) == 0 && isSnapshot == false && (img == nil || (img.Properties.Public != nil && *img.Properties.Public)) { return image, imageAlias, fmt.Errorf("volume, either 'image_password' or 'ssh_key_path'/'ssh_keys' must be provided") } @@ -737,7 +735,7 @@ func getImage(ctx context.Context, client *ionoscloud.APIClient, d *schema.Resou if isSnapshot == false && img.Properties.Public != nil && *img.Properties.Public == true { - if volume.ImagePassword == nil && (volume.SshKeys == nil || len(*volume.SshKeys) == 0) { + if volume.ImagePassword == nil && len(volume.SshKeys) == 0 { return image, imageAlias, fmt.Errorf("public image, either 'image_password' or 'ssh_key_path'/'ssh_keys' must be provided") } @@ -747,7 +745,7 @@ func getImage(ctx context.Context, client *ionoscloud.APIClient, d *schema.Resou return image, imageAlias, fmt.Errorf("error fetching datacenter %s: (%w)", dcId, err) } - img, err := resolveVolumeImageName(ctx, client, imageName, *dc.Properties.Location) + img, err := resolveVolumeImageName(ctx, client, imageName, dc.Properties.Location) if err != nil { return image, imageAlias, err @@ -779,7 +777,7 @@ func getImage(ctx context.Context, client *ionoscloud.APIClient, d *schema.Resou } else { if isSnapshot == false && img.Properties.Public != nil && *img.Properties.Public == true { - if volume.ImagePassword == nil && (volume.SshKeys == nil || len(*volume.SshKeys) == 0) { + if volume.ImagePassword == nil && (volume.SshKeys == nil || len(volume.SshKeys) == 0) { return image, imageAlias, fmt.Errorf("either 'image_password' or 'ssh_key_path'/'ssh_keys' must be provided for imageName %s ", imageName) } image = imageName @@ -795,7 +793,7 @@ func getImage(ctx context.Context, client *ionoscloud.APIClient, d *schema.Resou return image, imageAlias, fmt.Errorf("either 'image_name', 'licence_type', or 'image_alias' must be set") } - if isSnapshot == true && (volume.ImagePassword != nil || volume.SshKeys != nil && len(*volume.SshKeys) > 0) { + if isSnapshot == true && (volume.ImagePassword != nil || volume.SshKeys != nil && len(volume.SshKeys) > 0) { return image, imageAlias, fmt.Errorf("passwords/SSH keys are not supported for snapshots") } @@ -815,10 +813,10 @@ func getSnapshotId(ctx context.Context, client *ionoscloud.APIClient, snapshotNa log.Print(fmt.Errorf("error while fetching the list of snapshots %w", err)) } - if len(*snapshots.Items) > 0 { - for _, i := range *snapshots.Items { + if len(snapshots.Items) > 0 { + for _, i := range snapshots.Items { imgName := "" - if i.Properties != nil && i.Properties.Name != nil && *i.Properties.Name != "" { + if i.Properties.Name != nil && *i.Properties.Name != "" { imgName = *i.Properties.Name } @@ -847,8 +845,8 @@ func getImageAlias(ctx context.Context, client *ionoscloud.APIClient, imageAlias log.Print(fmt.Errorf("error while fetching the list of locations %w", err)) } - if len(*locations.Properties.ImageAliases) > 0 { - for _, i := range *locations.Properties.ImageAliases { + if len(locations.Properties.ImageAliases) > 0 { + for _, i := range locations.Properties.ImageAliases { alias := "" if i != "" { alias = i @@ -876,13 +874,13 @@ func resolveVolumeImageName(ctx context.Context, client *ionoscloud.APIClient, i return nil, err } - if len(*images.Items) > 0 { + if len(images.Items) > 0 { var partialMatch *ionoscloud.Image - for _, image := range *images.Items { + for _, image := range images.Items { // go for loop variable semantics workaround: https://github.com/golang/go/discussions/56010 imageEntry := image - if imageEntry.Properties != nil && imageEntry.Properties.Name != nil && *imageEntry.Properties.Name != "" { + if imageEntry.Properties.Name != nil && *imageEntry.Properties.Name != "" { if *imageEntry.Properties.ImageType != HDDImage || *imageEntry.Properties.Location != location { continue diff --git a/ionoscloud/resource_volume_test.go b/ionoscloud/resource_volume_test.go index 4efc42e04..7dc23cc26 100644 --- a/ionoscloud/resource_volume_test.go +++ b/ionoscloud/resource_volume_test.go @@ -12,7 +12,7 @@ import ( "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/utils" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/utils/constant" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" "github.com/hashicorp/terraform-plugin-testing/helper/resource" "github.com/hashicorp/terraform-plugin-testing/terraform" diff --git a/ionoscloud/testUtil.go b/ionoscloud/testUtil.go index f82958c85..86a9d0414 100644 --- a/ionoscloud/testUtil.go +++ b/ionoscloud/testUtil.go @@ -3,6 +3,7 @@ package ionoscloud import ( "bytes" "fmt" + "github.com/ionos-cloud/sdk-go-bundle/shared" "html/template" "log" "net/http" @@ -12,7 +13,7 @@ import ( "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" ) // mocked server, that responds with jsonResponse to whatever we send to it @@ -31,11 +32,13 @@ func createMockServer(jsonResponse string) *httptest.Server { func getMockedClient(jsonResponse string) interface{} { ts := createMockServer(jsonResponse) - cfg := ionoscloud.NewConfiguration("", "", "", ts.URL) + cfg := shared.NewConfiguration("", "", "", ts.URL) + client := ionoscloud.NewAPIClient(cfg) cfg.HTTPClient = ts.Client() + client.GetConfig().HTTPClient = ts.Client() return services.SdkBundle{ - CloudApiClient: ionoscloud.NewAPIClient(cfg), + CloudApiClient: client, } } diff --git a/ionoscloud/utils.go b/ionoscloud/utils.go index 0af7d1a4d..e348d4054 100644 --- a/ionoscloud/utils.go +++ b/ionoscloud/utils.go @@ -10,11 +10,10 @@ import ( "time" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + "github.com/ionos-cloud/sdk-go-bundle/shared" ) -func responseBody(resp *ionoscloud.APIResponse) string { +func responseBody(resp *shared.APIResponse) string { ret := "" if resp != nil { ret = string(resp.Payload) @@ -94,7 +93,7 @@ func VerifyUnavailableIPs(val interface{}, key string) (warns []string, errs []e return } -func logApiRequestTime(resp *ionoscloud.APIResponse) { +func logApiRequestTime(resp *shared.APIResponse) { if resp != nil { log.Printf("[DEBUG] Request time : %s for operation : %s", resp.RequestTime, resp.Operation) @@ -104,7 +103,7 @@ func logApiRequestTime(resp *ionoscloud.APIResponse) { } } -func httpNotFound(resp *ionoscloud.APIResponse) bool { +func httpNotFound(resp *shared.APIResponse) bool { if resp != nil && resp.Response != nil && resp.StatusCode == http.StatusNotFound { return true } diff --git a/main.go b/main.go index 6af42a6eb..236599b24 100644 --- a/main.go +++ b/main.go @@ -51,12 +51,14 @@ func main() { var serveOpts []tf6server.ServeOpt + debugMode = true + if debugMode { serveOpts = append(serveOpts, tf6server.WithManagedDebug()) } err = tf6server.Serve( - "registry.terraform.io/ionos-cloud/ionoscloud", + "registry.terraform.io/hashicorp/ionoscloud", muxServer.ProviderServer, serveOpts..., ) diff --git a/services/clients.go b/services/clients.go index 7688ce0f4..feba1dc21 100644 --- a/services/clients.go +++ b/services/clients.go @@ -1,7 +1,7 @@ package services import ( - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/apigateway" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/autoscaling" diff --git a/services/cloudapi/cloudapifirewall/firewall.go b/services/cloudapi/cloudapifirewall/firewall.go index 714b41e2c..5a0a54e24 100644 --- a/services/cloudapi/cloudapifirewall/firewall.go +++ b/services/cloudapi/cloudapifirewall/firewall.go @@ -9,7 +9,8 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" + "github.com/ionos-cloud/sdk-go-bundle/shared" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/cloudapi" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/slice" @@ -29,14 +30,14 @@ func (fs *Service) Get(ctx context.Context, datacenterId, serverId, nicId string if err != nil { return nil, err } - if apiResponse.HttpNotFound() || firewallRules.Items == nil || len(*firewallRules.Items) == 0 { + if apiResponse.HttpNotFound() || firewallRules.Items == nil || len(firewallRules.Items) == 0 { log.Printf("[DEBUG] no firewalls found for datacenter %s, server %s, nic %s", datacenterId, serverId, nicId) return nil, nil } - return *firewallRules.Items, nil + return firewallRules.Items, nil } -func (fs *Service) FindById(ctx context.Context, datacenterId, serverId, nicId, firewallId string) (*ionoscloud.FirewallRule, *ionoscloud.APIResponse, error) { +func (fs *Service) FindById(ctx context.Context, datacenterId, serverId, nicId, firewallId string) (*ionoscloud.FirewallRule, *shared.APIResponse, error) { firewallRule, apiResponse, err := fs.Client.FirewallRulesApi.DatacentersServersNicsFirewallrulesFindById(ctx, datacenterId, serverId, nicId, firewallId).Depth(1).Execute() apiResponse.LogInfo() if err != nil { @@ -49,7 +50,7 @@ func (fs *Service) FindById(ctx context.Context, datacenterId, serverId, nicId, return &firewallRule, apiResponse, nil } -func (fs *Service) Delete(ctx context.Context, datacenterId, serverId, nicId, firewallId string) (*ionoscloud.APIResponse, error) { +func (fs *Service) Delete(ctx context.Context, datacenterId, serverId, nicId, firewallId string) (*shared.APIResponse, error) { apiResponse, err := fs.Client.FirewallRulesApi.DatacentersServersNicsFirewallrulesDelete(ctx, datacenterId, serverId, nicId, firewallId).Execute() apiResponse.LogInfo() if err != nil { @@ -61,7 +62,7 @@ func (fs *Service) Delete(ctx context.Context, datacenterId, serverId, nicId, fi return apiResponse, nil } -func (fs *Service) Create(ctx context.Context, datacenterId, serverId, nicId string, firewallrule ionoscloud.FirewallRule) (*ionoscloud.FirewallRule, *ionoscloud.APIResponse, error) { +func (fs *Service) Create(ctx context.Context, datacenterId, serverId, nicId string, firewallrule ionoscloud.FirewallRule) (*ionoscloud.FirewallRule, *shared.APIResponse, error) { firewall, apiResponse, err := fs.Client.FirewallRulesApi.DatacentersServersNicsFirewallrulesPost(ctx, datacenterId, serverId, nicId).Firewallrule(firewallrule).Execute() apiResponse.LogInfo() if err != nil { @@ -73,7 +74,7 @@ func (fs *Service) Create(ctx context.Context, datacenterId, serverId, nicId str return &firewall, apiResponse, nil } -func (fs *Service) Update(ctx context.Context, datacenterId, serverId, nicId, id string, firewallrule ionoscloud.FirewallRule) (*ionoscloud.FirewallRule, *ionoscloud.APIResponse, error) { +func (fs *Service) Update(ctx context.Context, datacenterId, serverId, nicId, id string, firewallrule ionoscloud.FirewallRule) (*ionoscloud.FirewallRule, *shared.APIResponse, error) { firewall, apiResponse, err := fs.Client.FirewallRulesApi.DatacentersServersNicsFirewallrulesPut(ctx, datacenterId, serverId, nicId, id).Firewallrule(firewallrule).Execute() apiResponse.LogInfo() if err != nil { @@ -88,21 +89,19 @@ func (fs *Service) Update(ctx context.Context, datacenterId, serverId, nicId, id func SetProperties(firewall ionoscloud.FirewallRule) map[string]interface{} { fw := map[string]interface{}{} - if firewall.Properties != nil { - utils.SetPropWithNilCheck(fw, "protocol", firewall.Properties.Protocol) - utils.SetPropWithNilCheck(fw, "name", firewall.Properties.Name) - utils.SetPropWithNilCheck(fw, "source_mac", firewall.Properties.SourceMac) - utils.SetPropWithNilCheck(fw, "source_ip", firewall.Properties.SourceIp) - utils.SetPropWithNilCheck(fw, "target_ip", firewall.Properties.TargetIp) - utils.SetPropWithNilCheck(fw, "port_range_start", firewall.Properties.PortRangeStart) - utils.SetPropWithNilCheck(fw, "port_range_end", firewall.Properties.PortRangeEnd) - utils.SetPropWithNilCheck(fw, "type", firewall.Properties.Type) - if firewall.Properties.IcmpType != nil { - fw["icmp_type"] = strconv.Itoa(int(*firewall.Properties.IcmpType)) - } - if firewall.Properties.IcmpCode != nil { - fw["icmp_code"] = strconv.Itoa(int(*firewall.Properties.IcmpCode)) - } + utils.SetPropWithNilCheck(fw, "protocol", firewall.Properties.Protocol) + utils.SetPropWithNilCheck(fw, "name", firewall.Properties.Name) + utils.SetPropWithNilCheck(fw, "source_mac", firewall.Properties.SourceMac) + utils.SetPropWithNilCheck(fw, "source_ip", firewall.Properties.SourceIp) + utils.SetPropWithNilCheck(fw, "target_ip", firewall.Properties.TargetIp) + utils.SetPropWithNilCheck(fw, "port_range_start", firewall.Properties.PortRangeStart) + utils.SetPropWithNilCheck(fw, "port_range_end", firewall.Properties.PortRangeEnd) + utils.SetPropWithNilCheck(fw, "type", firewall.Properties.Type) + if firewall.Properties.IcmpType.IsSet() && firewall.Properties.IcmpType.Get() != nil { + fw["icmp_type"] = strconv.Itoa(int(*firewall.Properties.IcmpType.Get())) + } + if firewall.Properties.IcmpCode.IsSet() && firewall.Properties.IcmpCode.Get() != nil { + fw["icmp_code"] = strconv.Itoa(int(*firewall.Properties.IcmpCode.Get())) } return fw } @@ -180,14 +179,13 @@ func (fs *Service) GetAndUpdateFirewalls(ctx context.Context, dcId, serverId, ni PropUnsetSetFieldIfNotSetInSchema(&newFirewalls[idx], path, fs.D) prop := newFirewalls[idx] fwRule := ionoscloud.FirewallRule{ - Properties: &prop, + Properties: prop, } var firewall *ionoscloud.FirewallRule if nicId != "" { if id, ok := onlyNew[idx].(map[string]interface{})["id"]; ok && id != "" { // do not send protocol, it's an update - *fwRule.Properties = SetNullableFields(*fwRule.Properties) - fwRule.Properties.Protocol = nil + fwRule.Properties = SetNullableFields(fwRule.Properties) firewall, _, err = fs.Update(ctx, dcId, serverId, nicId, id.(string), fwRule) if err != nil { return firewallRules, []string{}, diag.FromErr(err) @@ -207,24 +205,12 @@ func (fs *Service) GetAndUpdateFirewalls(ctx context.Context, dcId, serverId, ni } func SetNullableFields(prop ionoscloud.FirewallruleProperties) ionoscloud.FirewallruleProperties { - if prop.SourceIp == nil { - prop.SetSourceIpNil() - } - if prop.SourceMac == nil { - prop.SetSourceMacNil() - } - if prop.IpVersion == nil { - prop.SetIpVersionNil() - } - if prop.TargetIp == nil { - prop.SetTargetIpNil() - } - if prop.IcmpCode == nil { - prop.SetIcmpCodeNil() - } - if prop.IcmpType == nil { - prop.SetIcmpTypeNil() - } + prop.SetSourceIpNil() + prop.SetSourceMacNil() + prop.SetIpVersionNil() + prop.SetTargetIpNil() + prop.SetIcmpCodeNil() + prop.SetIcmpTypeNil() return prop } @@ -244,7 +230,7 @@ func (fs *Service) AddToMapIfRuleExists(ctx context.Context, datacenterId, serve if firewall == nil { return firewallEntry, nil } - if firewall.Properties != nil && firewall.Properties.Name != nil { + if firewall.Properties.Name != nil { log.Printf("[DEBUG] found firewall rule with name %s", *firewall.Properties.Name) } firewallEntry = SetProperties(*firewall) @@ -277,10 +263,7 @@ func ExtractOrderedFirewallIds(foundRules, sentRules []ionoscloud.FirewallRule) for _, rule := range sentRules { for _, foundRule := range foundRules { // computed, make equal for comparison - if rule.Properties != nil && - foundRule.Properties != nil && foundRule.Properties.IpVersion != nil { - rule.Properties.IpVersion = foundRule.Properties.IpVersion - } + rule.Properties.IpVersion = foundRule.Properties.IpVersion // we need deepEqual here, because the structures contain pointers and cannot be compared using the stricter `==` if reflect.DeepEqual(rule.Properties, foundRule.Properties) { ruleIds = append(ruleIds, *foundRule.Id) diff --git a/services/cloudapi/cloudapilan/lan.go b/services/cloudapi/cloudapilan/lan.go index dcdd934cb..3cfe55a83 100644 --- a/services/cloudapi/cloudapilan/lan.go +++ b/services/cloudapi/cloudapilan/lan.go @@ -3,13 +3,14 @@ package cloudapilan import ( "context" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" + "github.com/ionos-cloud/sdk-go-bundle/shared" ) // Currently, this is not a service per se, but in the future, when the LAN service will be created, // this function can be included in the service. Right now, it is just an utility function in order // to reuse the code. -func FindLanById(client ionoscloud.APIClient, ctx context.Context, datacenterId string, lanId string) (ionoscloud.Lan, *ionoscloud.APIResponse, error) { +func FindLanById(client ionoscloud.APIClient, ctx context.Context, datacenterId string, lanId string) (ionoscloud.Lan, *shared.APIResponse, error) { lan, apiResponse, err := client.LANsApi.DatacentersLansFindById(ctx, datacenterId, lanId).Execute() apiResponse.LogInfo() return lan, apiResponse, err diff --git a/services/cloudapi/cloudapinic/nic.go b/services/cloudapi/cloudapinic/nic.go index a72416f71..0405e6b37 100644 --- a/services/cloudapi/cloudapinic/nic.go +++ b/services/cloudapi/cloudapinic/nic.go @@ -6,7 +6,8 @@ import ( "log" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" + "github.com/ionos-cloud/sdk-go-bundle/shared" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/cloudapi" cloudapiflowlog "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/cloudapi/flowlog" @@ -31,10 +32,10 @@ func (fs *Service) List(ctx context.Context, datacenterID, serverID string, dept log.Printf("[DEBUG] empty nic list for datacenter %s, server %s", datacenterID, serverID) return emptyNicList, nil } - return *nics.Items, nil + return nics.Items, nil } -func (fs *Service) Get(ctx context.Context, datacenterId, serverId, ID string, depth int32) (*ionoscloud.Nic, *ionoscloud.APIResponse, error) { +func (fs *Service) Get(ctx context.Context, datacenterId, serverId, ID string, depth int32) (*ionoscloud.Nic, *shared.APIResponse, error) { nic, apiResponse, err := fs.Client.NetworkInterfacesApi.DatacentersServersNicsFindById(ctx, datacenterId, serverId, ID).Depth(depth).Execute() apiResponse.LogInfo() if err != nil { @@ -46,7 +47,7 @@ func (fs *Service) Get(ctx context.Context, datacenterId, serverId, ID string, d return &nic, apiResponse, nil } -func (fs *Service) Delete(ctx context.Context, datacenterID, serverID, ID string) (*ionoscloud.APIResponse, error) { +func (fs *Service) Delete(ctx context.Context, datacenterID, serverID, ID string) (*shared.APIResponse, error) { apiResponse, err := fs.Client.NetworkInterfacesApi.DatacentersServersNicsDelete(ctx, datacenterID, serverID, ID).Execute() apiResponse.LogInfo() if err != nil { @@ -59,7 +60,7 @@ func (fs *Service) Delete(ctx context.Context, datacenterID, serverID, ID string } // Create - creates the resource in the backend and waits until it is in an `AVAILABLE` state -func (fs *Service) Create(ctx context.Context, datacenterID, serverID string, nic ionoscloud.Nic) (*ionoscloud.Nic, *ionoscloud.APIResponse, error) { +func (fs *Service) Create(ctx context.Context, datacenterID, serverID string, nic ionoscloud.Nic) (*ionoscloud.Nic, *shared.APIResponse, error) { val, apiResponse, err := fs.Client.NetworkInterfacesApi.DatacentersServersNicsPost(ctx, datacenterID, serverID).Nic(nic).Execute() apiResponse.LogInfo() if err != nil { @@ -74,7 +75,7 @@ func (fs *Service) Create(ctx context.Context, datacenterID, serverID string, ni return &val, apiResponse, nil } -func (fs *Service) Update(ctx context.Context, datacenterID, serverID, ID string, nicProperties ionoscloud.NicProperties) (*ionoscloud.Nic, *ionoscloud.APIResponse, error) { +func (fs *Service) Update(ctx context.Context, datacenterID, serverID, ID string, nicProperties ionoscloud.NicProperties) (*ionoscloud.Nic, *shared.APIResponse, error) { updatedNic, apiResponse, err := fs.Client.NetworkInterfacesApi.DatacentersServersNicsPatch(ctx, datacenterID, serverID, ID).Nic(nicProperties).Execute() apiResponse.LogInfo() if err != nil { @@ -103,24 +104,22 @@ func DecodeTo(oldValues, newValues []interface{}) ([]ionoscloud.Nic, []ionosclou func SetNetworkProperties(nic ionoscloud.Nic) map[string]interface{} { network := map[string]interface{}{} - if nic.Properties != nil { - utils.SetPropWithNilCheck(network, "dhcp", nic.Properties.Dhcp) - utils.SetPropWithNilCheck(network, "dhcpv6", nic.Properties.Dhcpv6) - utils.SetPropWithNilCheck(network, "firewall_active", nic.Properties.FirewallActive) - utils.SetPropWithNilCheck(network, "firewall_type", nic.Properties.FirewallType) - utils.SetPropWithNilCheck(network, "lan", nic.Properties.Lan) - utils.SetPropWithNilCheck(network, "name", nic.Properties.Name) - utils.SetPropWithNilCheck(network, "ips", nic.Properties.Ips) - utils.SetPropWithNilCheck(network, "ipv6_ips", nic.Properties.Ipv6Ips) - utils.SetPropWithNilCheck(network, "ipv6_cidr_block", nic.Properties.Ipv6CidrBlock) - utils.SetPropWithNilCheck(network, "mac", nic.Properties.Mac) - if nic.Properties.Ips != nil && len(*nic.Properties.Ips) > 0 { - network["ips"] = *nic.Properties.Ips - } + utils.SetPropWithNilCheck(network, "dhcp", nic.Properties.Dhcp) + utils.SetPropWithNilCheck(network, "dhcpv6", nic.Properties.Dhcpv6.Get()) + utils.SetPropWithNilCheck(network, "firewall_active", nic.Properties.FirewallActive) + utils.SetPropWithNilCheck(network, "firewall_type", nic.Properties.FirewallType) + utils.SetPropWithNilCheck(network, "lan", nic.Properties.Lan) + utils.SetPropWithNilCheck(network, "name", nic.Properties.Name) + utils.SetPropWithNilCheck(network, "ips", nic.Properties.Ips) + utils.SetPropWithNilCheck(network, "ipv6_ips", nic.Properties.Ipv6Ips) + utils.SetPropWithNilCheck(network, "ipv6_cidr_block", nic.Properties.Ipv6CidrBlock.Get()) + utils.SetPropWithNilCheck(network, "mac", nic.Properties.Mac) + if len(nic.Properties.Ips) > 0 { + network["ips"] = nic.Properties.Ips } nsgIDs := make([]string, 0) if nic.Entities != nil && nic.Entities.Securitygroups != nil && nic.Entities.Securitygroups.Items != nil { - for _, group := range *nic.Entities.Securitygroups.Items { + for _, group := range nic.Entities.Securitygroups.Items { if group.Id != nil { id := *group.Id nsgIDs = append(nsgIDs, id) @@ -134,11 +133,11 @@ func SetNetworkProperties(nic ionoscloud.Nic) map[string]interface{} { func GetNicFromSchema(d *schema.ResourceData, path string) (ionoscloud.Nic, error) { nic := ionoscloud.Nic{ - Properties: &ionoscloud.NicProperties{}, + Properties: ionoscloud.NicProperties{}, } lanInt := int32(d.Get(path + "lan").(int)) - nic.Properties.Lan = &lanInt + nic.Properties.Lan = lanInt if v, ok := d.GetOk(path + "name"); ok { vStr := v.(string) @@ -148,7 +147,9 @@ func GetNicFromSchema(d *schema.ResourceData, path string) (ionoscloud.Nic, erro dhcp := d.Get(path + "dhcp").(bool) if dhcpv6, ok := d.GetOkExists(path + "dhcpv6"); ok { dhcpv6 := dhcpv6.(bool) - nic.Properties.Dhcpv6 = &dhcpv6 + dhcpv6NullableBool := ionoscloud.NullableBool{} + dhcpv6NullableBool.Set(&dhcpv6) + nic.Properties.Dhcpv6 = dhcpv6NullableBool } else { nic.Properties.SetDhcpv6Nil() } @@ -172,8 +173,8 @@ func GetNicFromSchema(d *schema.ResourceData, path string) (ionoscloud.Nic, erro ips = append(ips, ip) } } - if ips != nil && len(ips) > 0 { - nic.Properties.Ips = &ips + if len(ips) > 0 { + nic.Properties.Ips = ips } } } @@ -186,24 +187,26 @@ func GetNicFromSchema(d *schema.ResourceData, path string) (ionoscloud.Nic, erro return nic, err } if len(ipv6Ips) > 0 { - nic.Properties.Ipv6Ips = &ipv6Ips + nic.Properties.Ipv6Ips = ipv6Ips } } if v, ok := d.GetOk(path + "ipv6_cidr_block"); ok { ipv6Block := v.(string) - nic.Properties.Ipv6CidrBlock = &ipv6Block + ipv6BlockNulStr := ionoscloud.NullableString{} + ipv6BlockNulStr.Set(&ipv6Block) + nic.Properties.Ipv6CidrBlock = ipv6BlockNulStr } if flowLogs, ok := d.GetOk("flowlog"); ok { nic.Entities = &ionoscloud.NicEntities{ Flowlogs: &ionoscloud.FlowLogs{ - Items: &[]ionoscloud.FlowLog{}, + Items: []ionoscloud.FlowLog{}, }, } if flowLogList, ok := flowLogs.([]any); ok { for _, flowLogData := range flowLogList { if flowLog, ok := flowLogData.(map[string]any); ok { - *nic.Entities.Flowlogs.Items = append(*nic.Entities.Flowlogs.Items, cloudapiflowlog.GetFlowlogFromMap(flowLog)) + nic.Entities.Flowlogs.Items = append(nic.Entities.Flowlogs.Items, cloudapiflowlog.GetFlowlogFromMap(flowLog)) } } } @@ -234,81 +237,75 @@ func NicSetData(d *schema.ResourceData, nic *ionoscloud.Nic) error { d.SetId(*nic.Id) } - if nic.Properties != nil { - log.Printf("[INFO] LAN ON NIC: %d", nic.Properties.Lan) - if nic.Properties.Dhcp != nil { - if err := d.Set("dhcp", *nic.Properties.Dhcp); err != nil { - return fmt.Errorf("error setting dhcp %w", err) - } + log.Printf("[INFO] LAN ON NIC: %d", nic.Properties.Lan) + if nic.Properties.Dhcp != nil { + if err := d.Set("dhcp", *nic.Properties.Dhcp); err != nil { + return fmt.Errorf("error setting dhcp %w", err) } + } - if nic.Properties.Dhcpv6 != nil { - if err := d.Set("dhcpv6", *nic.Properties.Dhcpv6); err != nil { - return fmt.Errorf("error setting dhcpv6 %w", err) - } - } - if nic.Properties.Lan != nil { - if err := d.Set("lan", *nic.Properties.Lan); err != nil { - return fmt.Errorf("error setting lan %w", err) - } - } - if nic.Properties.Name != nil { - if err := d.Set("name", *nic.Properties.Name); err != nil { - return fmt.Errorf("error setting name %w", err) - } + if nic.Properties.Dhcpv6.IsSet() && nic.Properties.Dhcpv6.Get() != nil { + if err := d.Set("dhcpv6", *nic.Properties.Dhcpv6.Get()); err != nil { + return fmt.Errorf("error setting dhcpv6 %w", err) } - if nic.Properties.Ips != nil && len(*nic.Properties.Ips) > 0 { - if err := d.Set("ips", *nic.Properties.Ips); err != nil { - return fmt.Errorf("error setting ips %w", err) - } + } + if err := d.Set("lan", nic.Properties.Lan); err != nil { + return fmt.Errorf("error setting lan %w", err) + } + if nic.Properties.Name != nil { + if err := d.Set("name", *nic.Properties.Name); err != nil { + return fmt.Errorf("error setting name %w", err) } - // should not be checked for len, we want to set the empty slice anyway as the field is computed, and it will not be set by backend - // if ipv6_cidr_block is not set on the lan - if nic.Properties.Ipv6Ips != nil { - if err := d.Set("ipv6_ips", *nic.Properties.Ipv6Ips); err != nil { - return fmt.Errorf("error setting ipv6_ips %w", err) - } + } + if len(nic.Properties.Ips) > 0 { + if err := d.Set("ips", nic.Properties.Ips); err != nil { + return fmt.Errorf("error setting ips %w", err) } - if nic.Properties.Ipv6CidrBlock != nil { - if err := d.Set("ipv6_cidr_block", *nic.Properties.Ipv6CidrBlock); err != nil { - return fmt.Errorf("error setting ipv6_cidr_block %w", err) - } + } + if err := d.Set("ipv6_ips", nic.Properties.Ipv6Ips); err != nil { + return fmt.Errorf("error setting ipv6_ips %w", err) + } + + if nic.Properties.Ipv6CidrBlock.IsSet() && nic.Properties.Ipv6CidrBlock.Get() != nil { + if err := d.Set("ipv6_cidr_block", *nic.Properties.Ipv6CidrBlock.Get()); err != nil { + return fmt.Errorf("error setting ipv6_cidr_block %w", err) } - if nic.Properties.FirewallActive != nil { - if err := d.Set("firewall_active", *nic.Properties.FirewallActive); err != nil { - return fmt.Errorf("error setting firewall_active %w", err) - } + } + + if nic.Properties.FirewallActive != nil { + if err := d.Set("firewall_active", *nic.Properties.FirewallActive); err != nil { + return fmt.Errorf("error setting firewall_active %w", err) } - if nic.Properties.FirewallType != nil { - if err := d.Set("firewall_type", *nic.Properties.FirewallType); err != nil { - return fmt.Errorf("error setting firewall_type %w", err) - } + } + if nic.Properties.FirewallType != nil { + if err := d.Set("firewall_type", *nic.Properties.FirewallType); err != nil { + return fmt.Errorf("error setting firewall_type %w", err) } - if nic.Properties.Mac != nil { - if err := d.Set("mac", *nic.Properties.Mac); err != nil { - return fmt.Errorf("error setting mac %w", err) - } + } + if nic.Properties.Mac != nil { + if err := d.Set("mac", *nic.Properties.Mac); err != nil { + return fmt.Errorf("error setting mac %w", err) } - if nic.Properties.DeviceNumber != nil { - if err := d.Set("device_number", *nic.Properties.DeviceNumber); err != nil { - return fmt.Errorf("error setting device_number %w", err) - } + } + if nic.Properties.DeviceNumber != nil { + if err := d.Set("device_number", *nic.Properties.DeviceNumber); err != nil { + return fmt.Errorf("error setting device_number %w", err) } - if nic.Properties.PciSlot != nil { - if err := d.Set("pci_slot", *nic.Properties.PciSlot); err != nil { - return fmt.Errorf("error setting pci_slot %w", err) - } + } + if nic.Properties.PciSlot != nil { + if err := d.Set("pci_slot", *nic.Properties.PciSlot); err != nil { + return fmt.Errorf("error setting pci_slot %w", err) } - if nic.Entities != nil && nic.Entities.Securitygroups != nil && nic.Entities.Securitygroups.Items != nil { - if err := nsg.SetNSGInResourceData(d, nic.Entities.Securitygroups.Items); err != nil { - return err - } + } + if nic.Entities != nil && nic.Entities.Securitygroups != nil && nic.Entities.Securitygroups.Items != nil { + if err := nsg.SetNSGInResourceData(d, &nic.Entities.Securitygroups.Items); err != nil { + return err } } - if nic.Entities != nil && nic.Entities.Flowlogs != nil && nic.Entities.Flowlogs.Items != nil && len(*nic.Entities.Flowlogs.Items) > 0 { + if nic.Entities != nil && nic.Entities.Flowlogs != nil && nic.Entities.Flowlogs.Items != nil && len(nic.Entities.Flowlogs.Items) > 0 { var flowlogs []map[string]any - for _, flowLog := range *nic.Entities.Flowlogs.Items { + for _, flowLog := range nic.Entities.Flowlogs.Items { result := map[string]any{} result, err := utils.DecodeStructToMap(flowLog.Properties) if err != nil { diff --git a/services/cloudapi/cloudapiserver/server.go b/services/cloudapi/cloudapiserver/server.go index ffcd4442d..f431064f7 100644 --- a/services/cloudapi/cloudapiserver/server.go +++ b/services/cloudapi/cloudapiserver/server.go @@ -8,11 +8,12 @@ import ( "strings" "time" + "github.com/ionos-cloud/sdk-go-bundle/shared" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/cloudapi" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/utils" @@ -33,7 +34,7 @@ var ( // In this case, the Service will not be 'bound' to the state of the Server resource // The methods of this interface must not write to the state, since the Service will use a placeholder ResourceData reference type UnboundService interface { - Update(context.Context, string, string, ionoscloud.ServerProperties) (*ionoscloud.Server, *ionoscloud.APIResponse, error) + Update(context.Context, string, string, ionoscloud.ServerProperties) (*ionoscloud.Server, *shared.APIResponse, error) GetDefaultBootVolume(ctx context.Context, datacenterID, serverID string) (*ionoscloud.Volume, error) UpdateBootDevice(ctx context.Context, datacenterID, serverID, newBootDeviceID string) error PxeBoot(ctx context.Context, datacenterID, serverID string) error @@ -69,7 +70,7 @@ func (ss *Service) FindById(ctx context.Context, datacenterID, serverID string, return &server, nil } -func (ss *Service) Delete(ctx context.Context, datacenterID, serverID, ID string) (*ionoscloud.APIResponse, error) { +func (ss *Service) Delete(ctx context.Context, datacenterID, serverID, ID string) (*shared.APIResponse, error) { apiResponse, err := ss.Client.ServersApi.DatacentersServersDelete(ctx, datacenterID, serverID).Execute() apiResponse.LogInfo() if err != nil { @@ -81,7 +82,7 @@ func (ss *Service) Delete(ctx context.Context, datacenterID, serverID, ID string return apiResponse, nil } -func (ss *Service) Create(ctx context.Context, datacenterID string) (*ionoscloud.Server, *ionoscloud.APIResponse, error) { +func (ss *Service) Create(ctx context.Context, datacenterID string) (*ionoscloud.Server, *shared.APIResponse, error) { server, apiResponse, err := ss.Client.ServersApi.DatacentersServersPost(ctx, datacenterID).Execute() apiResponse.LogInfo() if err != nil { @@ -96,7 +97,7 @@ func (ss *Service) Create(ctx context.Context, datacenterID string) (*ionoscloud return &server, apiResponse, nil } -func (ss *Service) Update(ctx context.Context, datacenterID, serverID string, serverProperties ionoscloud.ServerProperties) (*ionoscloud.Server, *ionoscloud.APIResponse, error) { +func (ss *Service) Update(ctx context.Context, datacenterID, serverID string, serverProperties ionoscloud.ServerProperties) (*ionoscloud.Server, *shared.APIResponse, error) { updatedServer, apiResponse, err := ss.Client.ServersApi.DatacentersServersPatch(ctx, datacenterID, serverID).Server(serverProperties).Execute() apiResponse.LogInfo() if err != nil { @@ -108,7 +109,7 @@ func (ss *Service) Update(ctx context.Context, datacenterID, serverID string, se return &updatedServer, apiResponse, nil } -func (ss *Service) GetAttachedVolumes(ctx context.Context, datacenterID, serverID string) ([]*ionoscloud.Volume, *ionoscloud.APIResponse, error) { +func (ss *Service) GetAttachedVolumes(ctx context.Context, datacenterID, serverID string) ([]*ionoscloud.Volume, *shared.APIResponse, error) { attachedVolumeIds, apiResponse, err := ss.Client.ServersApi.DatacentersServersVolumesGet(ctx, datacenterID, serverID).Execute() apiResponse.LogInfo() @@ -116,7 +117,7 @@ func (ss *Service) GetAttachedVolumes(ctx context.Context, datacenterID, serverI return nil, apiResponse, fmt.Errorf("an error occurred while fetching attached volumes for server, dcId: %s, serverId: %s, Response: (%w)", datacenterID, serverID, err) } attachedVolumes := []*ionoscloud.Volume{} - for _, v := range *attachedVolumeIds.Items { + for _, v := range attachedVolumeIds.Items { volume, apiResponse, err := ss.Client.ServersApi.DatacentersServersVolumesFindById(ctx, datacenterID, serverID, *v.Id).Execute() if err != nil { return nil, apiResponse, err @@ -149,14 +150,11 @@ func (ss *Service) GetCurrentBootDeviceID(ctx context.Context, datacenterId, ser if err != nil { return "", "", err } - if server.Properties == nil { - return "", "", fmt.Errorf("server has no boot device because properties object was nil") - } if server.Properties.BootCdrom != nil { - return *server.Properties.BootCdrom.Id, constant.BootDeviceTypeCDROM, nil + return server.Properties.BootCdrom.Id, constant.BootDeviceTypeCDROM, nil } if server.Properties.BootVolume != nil { - return *server.Properties.BootVolume.Id, constant.BootDeviceTypeVolume, nil + return server.Properties.BootVolume.Id, constant.BootDeviceTypeVolume, nil } return "", "", ErrNoBootDevice } @@ -282,9 +280,6 @@ func (ss *Service) GetVmState(ctx context.Context, datacenterID, serverID string if err != nil { return "", err } - if server.Properties == nil { - return "", fmt.Errorf("got empty properties for datacenterID %s serverID %s", datacenterID, serverID) - } return *server.Properties.VmState, nil } @@ -293,9 +288,6 @@ func (ss *Service) GetServerType(ctx context.Context, datacenterID, serverID str if err != nil { return "", err } - if server.Properties == nil { - return "", fmt.Errorf("got empty properties for datacenterID %s serverID %s", datacenterID, serverID) - } return *server.Properties.Type, nil } diff --git a/services/cloudapi/flowlog/flowlog.go b/services/cloudapi/flowlog/flowlog.go index 45c1ec290..7589c529d 100644 --- a/services/cloudapi/flowlog/flowlog.go +++ b/services/cloudapi/flowlog/flowlog.go @@ -6,7 +6,8 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" + "github.com/ionos-cloud/sdk-go-bundle/shared" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/utils" ) @@ -89,7 +90,7 @@ func (fw *Service) CreateOrPatchForServer(ctx context.Context, dcId, srvID, nicI return fmt.Errorf("error occurred while creating flowlog in datacenter %s, server %s nic %s : %w", dcId, srvID, nicID, err) } } else { - _, _, err := fw.Client.FlowLogsApi.DatacentersServersNicsFlowlogsPatch(ctx, dcId, srvID, nicID, ID).Flowlog(*flowLog.Properties).Execute() + _, _, err := fw.Client.FlowLogsApi.DatacentersServersNicsFlowlogsPatch(ctx, dcId, srvID, nicID, ID).Flowlog(flowLog.Properties).Execute() if err != nil { return fmt.Errorf("error occurred while updating flowlog %s datacenter %s, server %s nic %s : %w", ID, dcId, srvID, nicID, err) } @@ -104,7 +105,7 @@ func (fw *Service) CreateOrPatchForNLB(ctx context.Context, dcId, nlbID, ID stri return fmt.Errorf("error occurred while creating flowlog in datacenter %s, nlb %s : %w", dcId, nlbID, err) } } else { - _, _, err := fw.Client.NetworkLoadBalancersApi.DatacentersNetworkloadbalancersFlowlogsPatch(ctx, dcId, nlbID, ID).NetworkLoadBalancerFlowLogProperties(*flowLog.Properties).Execute() + _, _, err := fw.Client.NetworkLoadBalancersApi.DatacentersNetworkloadbalancersFlowlogsPatch(ctx, dcId, nlbID, ID).NetworkLoadBalancerFlowLogProperties(flowLog.Properties).Execute() if err != nil { return fmt.Errorf("error occurred while updating flowlog %s datacenter %s, nlb %s : %w", ID, dcId, nlbID, err) } @@ -119,7 +120,7 @@ func (fw *Service) CreateOrPatchForALB(ctx context.Context, dcId, albID, ID stri return fmt.Errorf("error occurred while creating flowlog in datacenter %s, alb %s : %w", dcId, albID, err) } } else { - _, _, err := fw.Client.ApplicationLoadBalancersApi.DatacentersApplicationloadbalancersFlowlogsPatch(ctx, dcId, albID, ID).ApplicationLoadBalancerFlowLogProperties(*flowLog.Properties).Execute() + _, _, err := fw.Client.ApplicationLoadBalancersApi.DatacentersApplicationloadbalancersFlowlogsPatch(ctx, dcId, albID, ID).ApplicationLoadBalancerFlowLogProperties(flowLog.Properties).Execute() if err != nil { return fmt.Errorf("error occurred while updating flowlog %s, datacenter %s, alb %s : %w", ID, dcId, albID, err) } @@ -128,13 +129,13 @@ func (fw *Service) CreateOrPatchForALB(ctx context.Context, dcId, albID, ID stri } // GetFlowLogForALB - there can be only one flowlog per alb -func (fw *Service) GetFlowLogForALB(ctx context.Context, dcId, albID string, depth int32) (*ionoscloud.FlowLog, *ionoscloud.APIResponse, error) { +func (fw *Service) GetFlowLogForALB(ctx context.Context, dcId, albID string, depth int32) (*ionoscloud.FlowLog, *shared.APIResponse, error) { flowLogs, apiResponse, err := fw.Client.ApplicationLoadBalancersApi.DatacentersApplicationloadbalancersFlowlogsGet(ctx, dcId, albID).Depth(depth).Execute() if err != nil { return nil, apiResponse, fmt.Errorf("error occurred while finding datacenter %s, alb %s : %w", dcId, albID, err) } - if flowLogs.Items != nil && len(*flowLogs.Items) > 0 { - return &(*flowLogs.Items)[0], apiResponse, nil + if len(flowLogs.Items) > 0 { + return &(flowLogs.Items)[0], apiResponse, nil } return nil, apiResponse, nil } @@ -149,9 +150,9 @@ func (fw *Service) Delete(ctx context.Context, dcId string, srvID string, nicID, } func GetFlowlogFromMap(flowLogMap map[string]any) ionoscloud.FlowLog { flowlog := ionoscloud.NewFlowLog(*ionoscloud.NewFlowLogProperties("", "", "", "")) - *flowlog.Properties.Action = flowLogMap["action"].(string) - *flowlog.Properties.Bucket = flowLogMap["bucket"].(string) - *flowlog.Properties.Direction = flowLogMap["direction"].(string) - *flowlog.Properties.Name = flowLogMap["name"].(string) + flowlog.Properties.Action = flowLogMap["action"].(string) + flowlog.Properties.Bucket = flowLogMap["bucket"].(string) + flowlog.Properties.Direction = flowLogMap["direction"].(string) + flowlog.Properties.Name = flowLogMap["name"].(string) return *flowlog } diff --git a/services/cloudapi/nsg/nsg.go b/services/cloudapi/nsg/nsg.go index a2f09fd1e..22fe34ca9 100644 --- a/services/cloudapi/nsg/nsg.go +++ b/services/cloudapi/nsg/nsg.go @@ -7,7 +7,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" "github.com/ionos-cloud/terraform-provider-ionoscloud/v6/services/cloudapi" ) diff --git a/services/cloudapi/state.go b/services/cloudapi/state.go index 1d704a492..4a5ec167a 100644 --- a/services/cloudapi/state.go +++ b/services/cloudapi/state.go @@ -8,7 +8,7 @@ import ( "net/url" "time" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + "github.com/ionos-cloud/sdk-go-bundle/shared" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" @@ -80,7 +80,7 @@ func resourceStateRefreshFunc(meta interface{}, path string) retry.StateRefreshF } // WaitForStateChange tracks state change progress of a resource -func WaitForStateChange(ctx context.Context, meta interface{}, d *schema.ResourceData, apiResponse *ionoscloud.APIResponse, opTimeout string) error { +func WaitForStateChange(ctx context.Context, meta interface{}, d *schema.ResourceData, apiResponse *shared.APIResponse, opTimeout string) error { var err error var loc *url.URL diff --git a/utils/utils.go b/utils/utils.go index eadc0b3ce..3c1a5b5e4 100644 --- a/utils/utils.go +++ b/utils/utils.go @@ -14,7 +14,7 @@ import ( "strings" "time" - ionoscloud "github.com/ionos-cloud/sdk-go/v6" + ionoscloud "github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" @@ -310,10 +310,55 @@ func IsSnakeEqualToCamelCase(a, b string) bool { } func PointerEmptyToNil() mapstructure.DecodeHookFuncType { - return func(f reflect.Type, t reflect.Type, data interface{}) (interface{}, error) { - if f.Kind() == reflect.String && data == "" { - return nil, nil + return func(from reflect.Type, to reflect.Type, data interface{}) (interface{}, error) { + var b ionoscloud.NullableBool + var i ionoscloud.NullableInt32 + var s ionoscloud.NullableString + + if from.Kind() == reflect.String { + if to == reflect.TypeOf(s) { + if data == "" { + s.Unset() + return s, nil + } + + dataToSet := data.(string) + s.Set(&dataToSet) + return s, nil + // Some strings may represent numbers. + } else if to == reflect.TypeOf(i) { + if data == "" { + i.Unset() + return i, nil + } + + dataInt, _ := strconv.Atoi(data.(string)) + dataToSet := int32(dataInt) + i.Set(&dataToSet) + return i, nil + } + + if data == "" { + return nil, nil + } } + + if from.Kind() == reflect.Bool { + if to == reflect.TypeOf(b) { + dataToSet := data.(bool) + b.Set(&dataToSet) + return b, nil + } + } + + if from.Kind() == reflect.Int32 { + if to == reflect.TypeOf(i) { + dataToSet := data.(int32) + i.Set(&dataToSet) + return i, nil + } + } + return data, nil } } diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/.gitignore b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/.gitignore similarity index 97% rename from vendor/github.com/ionos-cloud/sdk-go/v6/.gitignore rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/.gitignore index 8a5a70956..daf913b1b 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/.gitignore +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/.gitignore @@ -6,7 +6,6 @@ # Folders _obj _test -.idea/ # Architecture specific extensions/prefixes *.[568vq] diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/.travis.yml b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/.travis.yml similarity index 100% rename from vendor/github.com/ionos-cloud/sdk-go/v6/.travis.yml rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/.travis.yml diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/README.md b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/README.md similarity index 86% rename from vendor/github.com/ionos-cloud/sdk-go/v6/README.md rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/README.md index 0b138b7e0..1c392a077 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/README.md +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/README.md @@ -1,18 +1,3 @@ -![CI](https://github.com/ionos-cloud/sdk-resources/workflows/%5B%20CI%20%5D%20CloudApi%20V6%20/%20Go/badge.svg) -[![Gitter](https://img.shields.io/gitter/room/ionos-cloud/sdk-general)](https://gitter.im/ionos-cloud/sdk-general) -[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=ionos-cloud_sdk-go&metric=alert_status)](https://sonarcloud.io/dashboard?id=ionos-cloud_sdk-go) -[![Bugs](https://sonarcloud.io/api/project_badges/measure?project=ionos-cloud_sdk-go&metric=bugs)](https://sonarcloud.io/dashboard?id=ionos-cloud_sdk-go) -[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=ionos-cloud_sdk-go&metric=sqale_rating)](https://sonarcloud.io/dashboard?id=ionos-cloud_sdk-go) -[![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=ionos-cloud_sdk-go&metric=reliability_rating)](https://sonarcloud.io/dashboard?id=ionos-cloud_sdk-go) -[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=ionos-cloud_sdk-go&metric=security_rating)](https://sonarcloud.io/dashboard?id=ionos-cloud_sdk-go) -[![Vulnerabilities](https://sonarcloud.io/api/project_badges/measure?project=ionos-cloud_sdk-go&metric=vulnerabilities)](https://sonarcloud.io/dashboard?id=ionos-cloud_sdk-go) -[![Release](https://img.shields.io/github/v/release/ionos-cloud/sdk-go.svg)](https://github.com/ionos-cloud/sdk-go/releases/latest) -[![Release Date](https://img.shields.io/github/release-date/ionos-cloud/sdk-go.svg)](https://github.com/ionos-cloud/sdk-go/releases/latest) -[![Go](https://img.shields.io/github/go-mod/go-version/ionos-cloud/sdk-go.svg)](https://github.com/ionos-cloud/sdk-go) - -![Alt text](.github/IONOS.CLOUD.BLU.svg?raw=true "Title") - - # Go API client for ionoscloud @@ -29,46 +14,33 @@ The API can be accessed within an instance running in IONOS Cloud or directly ov ### Use go get to retrieve the SDK to add it to your GOPATH workspace, or project's Go module dependencies. ```bash -go get github.com/ionos-cloud/sdk-go/v6 +go get github.com/ionos-cloud/cloud/ionoscloud.git ``` To update the SDK use go get -u to retrieve the latest version of the SDK. ```bash -go get -u github.com/ionos-cloud/sdk-go/v6 +go get -u github.com/ionos-cloud/cloud/ionoscloud.git ``` ### Go Modules If you are using Go modules, your go get will default to the latest tagged release version of the SDK. To get a specific release version of the SDK use @ in your go get command. -```bash -go get github.com/ionos-cloud/sdk-go/v6@v6.0.0 -``` + To get the latest SDK repository, use @latest. ```bash -go get github.com/ionos-cloud/sdk-go/v6@latest +go get github.com/ionos-cloud/cloud/ionoscloud@latest ``` -## API URLs - -All available server URLs are: - -- *https://api.ionos.com/cloudapi/v6* - No description provided - -By default, *https://api.ionos.com/cloudapi/v6* is used, however this can be overriden at authentication, either -by setting the `IONOS_API_URL` environment variable or by specifying the `hostUrl` parameter when -initializing the sdk client. - ## Environment Variables -| Environment Variable | Description | -|-------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `IONOS_USERNAME` | Specify the username used to login, to authenticate against the IONOS Cloud API | -| `IONOS_PASSWORD` | Specify the password used to login, to authenticate against the IONOS Cloud API | -| `IONOS_TOKEN` | Specify the token used to login, if a token is being used instead of username and password | -| `IONOS_API_URL` | Specify the API URL. It will overwrite the API endpoint default value. | -| `IONOS_LOG_LEVEL` | Specify the Log Level used to log messages. Possible values: Off, Debug, Trace | -| `IONOS_PINNED_CERT` | Specify the SHA-256 public fingerprint here, enables certificate pinning | -| `IONOS_CONTRACT_NUMBER` | Specify the contract number on which you wish to provision. Only valid for reseller accounts, for other types of accounts the header will be ignored | +| Environment Variable | Description | +|----------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `IONOS_USERNAME` | Specify the username used to login, to authenticate against the IONOS Cloud API | +| `IONOS_PASSWORD` | Specify the password used to login, to authenticate against the IONOS Cloud API | +| `IONOS_TOKEN` | Specify the token used to login, if a token is being used instead of username and password | +| `IONOS_API_URL` | Specify the API URL. It will overwrite the API endpoint default value `api.ionos.com`. Note: the host URL does not contain the `/cloudapi/v6` path, so it should _not_ be included in the `IONOS_API_URL` environment variable | +| `IONOS_LOG_LEVEL` | Specify the Log Level used to log messages. Possible values: Off, Debug, Trace | +| `IONOS_PINNED_CERT` | Specify the SHA-256 public fingerprint here, enables certificate pinning | -⚠️ **_Note: To overwrite the api endpoint, the environment variable `IONOS_API_URL` can be set, and used with `NewConfigurationFromEnv()` function._** +⚠️ **_Note: To overwrite the api endpoint - `api.ionos.com`, the environment variable `IONOS_API_URL` can be set, and used with `NewConfigurationFromEnv()` function._** ## Examples @@ -76,6 +48,14 @@ Examples for creating resources using the Go SDK can be found [here](examples/) ## Authentication +All available server URLs are: + +- *https://api.ionos.com/cloudapi/v6* - No description provided + +By default, *https://api.ionos.com/cloudapi/v6* is used, however this can be overriden at authentication, either +by setting the `IONOS_API_URL` environment variable or by specifying the `hostUrl` parameter when +initializing the sdk client. + ### Basic Authentication - **Type**: HTTP basic authentication @@ -86,58 +66,45 @@ Example import ( "context" "fmt" - "github.com/ionos-cloud/sdk-go/v6" + "github.com/ionos-cloud/sdk-go-bundle/shared" + ionoscloud "github.com/ionos-cloud/cloud/ionoscloud" "log" ) func basicAuthExample() error { - cfg := ionoscloud.NewConfiguration("username_here", "pwd_here", "", "hostUrl_here") - cfg.Debug = true + cfg := shared.NewConfiguration("username_here", "pwd_here", "", "hostUrl_here") + cfg.LogLevel = Trace apiClient := ionoscloud.NewAPIClient(cfg) - datacenters, _, err := apiClient.DataCentersApi.DatacentersGet(context.Background()).Depth(1).Execute() - if err != nil { - return fmt.Errorf("error retrieving datacenters %w", err) - } - if datacenters.HasItems() { - for _, dc := range *datacenters.GetItems() { - if dc.HasProperties() && dc.GetProperties().HasName() { - fmt.Println(*dc.GetProperties().GetName()) - } - } - } return nil } ``` ### Token Authentication There are 2 ways to generate your token: - ### Generate token using [sdk-go-auth](https://github.com/ionos-cloud/sdk-go-auth): + ### Generate token using sdk for [auth](https://github.com/ionos-cloud/products/auth): ```golang import ( "context" "fmt" - authApi "github.com/ionos-cloud/sdk-go-auth" - "github.com/ionos-cloud/sdk-go/v6" + "github.com/ionos-cloud/sdk-go-bundle/products/auth" + "github.com/ionos-cloud/sdk-go-bundle/shared" + ionoscloud "github.com/ionos-cloud/cloud/ionoscloud" "log" ) func TokenAuthExample() error { //note: to use NewConfigurationFromEnv(), you need to previously set IONOS_USERNAME and IONOS_PASSWORD as env variables - authClient := authApi.NewAPIClient(authApi.NewConfigurationFromEnv()) - jwt, _, err := authClient.TokensApi.TokensGenerate(context.Background()).Execute() + authClient := auth.NewAPIClient(authApi.NewConfigurationFromEnv()) + jwt, _, err := auth.TokensApi.TokensGenerate(context.Background()).Execute() if err != nil { return fmt.Errorf("error occurred while generating token (%w)", err) } if !jwt.HasToken() { return fmt.Errorf("could not generate token") } - cfg := ionoscloud.NewConfiguration("", "", *jwt.GetToken(), "hostUrl_here") - cfg.Debug = true + cfg := shared.NewConfiguration("", "", *jwt.GetToken(), "hostUrl_here") + cfg.LogLevel = Trace apiClient := ionoscloud.NewAPIClient(cfg) - datacenters, _, err := apiClient.DataCentersApi.DatacenterGet(context.Background()).Depth(1).Execute() - if err != nil { - return fmt.Errorf("error retrieving datacenters (%w)", err) - } return nil } ``` @@ -145,28 +112,25 @@ There are 2 ways to generate your token: Install ionosctl as explained [here](https://github.com/ionos-cloud/ionosctl) Run commands to login and generate your token. ```golang -ionosctl login -ionosctl token generate -export IONOS_TOKEN="insert_here_token_saved_from_generate_command" + ionosctl login + ionosctl token generate + export IONOS_TOKEN="insert_here_token_saved_from_generate_command" ``` Save the generated token and use it to authenticate: ```golang import ( "context" "fmt" - "github.com/ionos-cloud/sdk-go/v6" + "github.com/ionos-cloud/sdk-go-bundle/products/auth" + ionoscloud "github.com/ionos-cloud/cloud/ionoscloud" "log" ) func TokenAuthExample() error { //note: to use NewConfigurationFromEnv(), you need to previously set IONOS_TOKEN as env variables - authClient := authApi.NewAPIClient(authApi.NewConfigurationFromEnv()) - cfg.Debug = true + authClient := auth.NewAPIClient(authApi.NewConfigurationFromEnv()) + cfg.LogLevel = Trace apiClient := ionoscloud.NewAPIClient(cfg) - datacenters, _, err := apiClient.DataCenter6Api.DatacentersGet(context.Background()).Depth(1).Execute() - if err != nil { - return fmt.Errorf("error retrieving datacenters (%w)", err) - } return nil } ``` @@ -193,34 +157,6 @@ Many of the _List_ or _Get_ operations will accept an optional _depth_ argument. | 4 | Direct properties, children's properties, and descendants' properties are returned. | | 5 | Returns all available properties. | - -#### How to set Depth parameter: - -⚠️ **_Please use this parameter with caution. We recommend using the default value and raising its value only if it is needed._** - -* On the configuration level: -```go -configuration := ionoscloud.NewConfiguration("USERNAME", "PASSWORD", "TOKEN", "URL") -configuration.SetDepth(5) -``` -Using this method, the depth parameter will be set **on all the API calls**. - -* When calling a method: -```go -request := apiClient.DataCenterApi.DatacentersGet(context.Background()).Depth(1) -``` -Using this method, the depth parameter will be set **on the current API call**. - -* Using the default value: - -If the depth parameter is not set, it will have the default value from the API that can be found [here](https://api.ionos.com/cloudapi/v6/swagger.json). - -> Note: The priority for setting the depth parameter is: *set on function call > set on configuration level > set using the default value from the API* - -### Pretty - -The operations will also accept an optional _pretty_ argument. Setting this to a value of `true` or `false` controls whether the response is pretty-printed \(with indentation and new lines\). By default, the SDK sets the _pretty_ argument to `true`. - ### Changing the base URL Base URL for the HTTP operation can be changed by using the following function: @@ -231,9 +167,9 @@ requestProperties.SetURL("https://api.ionos.com/cloudapi/v6") ## Debugging -You can now inject any logger that implements Printf as a logger +You can inject any logger that implements Printf as a logger instead of using the default sdk logger. -There are now Loglevels that you can set: `Off`, `Debug` and `Trace`. +There are log levels that you can set: `Off`, `Debug` and `Trace`. `Off` - does not show any logs `Debug` - regular logs, no sensitive information `Trace` - we recommend you only set this field for debugging purposes. Disable it in your production environments because it can log sensitive data. @@ -242,45 +178,26 @@ There are now Loglevels that you can set: `Off`, `Debug` and `Trace`. ```golang package main -import "github.com/ionos-cloud/sdk-go/v6" -import "github.com/sirupsen/logrus" -func main() { - // create your configuration. replace username, password, token and url with correct values, or use NewConfigurationFromEnv() - // if you have set your env variables as explained above - cfg := ionoscloud.NewConfiguration("username", "password", "token", "hostUrl") - // enable request and response logging. this is the most verbose loglevel - cfg.LogLevel = Trace - // inject your own logger that implements Printf - cfg.Logger = logrus.New() - // create you api client with the configuration - apiClient := ionoscloud.NewAPIClient(cfg) -} -``` - -If you want to see the API call request and response messages, you need to set the Debug field in the Configuration struct: -⚠️ **_Note: the field `Debug` is now deprecated and will be replaced with `LogLevel` in the future. + import ( + ionoscloud "github.com/ionos-cloud/cloud/ionoscloud" + "github.com/ionos-cloud/sdk-go-bundle/shared" + "github.com/sirupsen/logrus" + ) -```golang -package main -import "github.com/ionos-cloud/sdk-go/v6" func main() { // create your configuration. replace username, password, token and url with correct values, or use NewConfigurationFromEnv() // if you have set your env variables as explained above - cfg := ionoscloud.NewConfiguration("username", "password", "token", "hostUrl") - // enable request and response logging - cfg.Debug = true + cfg := shared.NewConfiguration("username", "password", "token", "hostUrl") + // enable request and response logging. this is the most verbose loglevel + shared.SdkLogLevel = Trace + // inject your own logger that implements Printf + shared.SdkLogger = logrus.New() // create you api client with the configuration apiClient := ionoscloud.NewAPIClient(cfg) } ``` -⚠️ **_Note: We recommend you only set this field for debugging purposes. -Disable it in your production environments because it can log sensitive data. -It logs the full request and response without encryption, even for an HTTPS call. -Verbose request and response logging can also significantly impact your application's performance._** - - ## Documentation for API Endpoints All URIs are relative to *https://api.ionos.com/cloudapi/v6* @@ -309,14 +226,19 @@ ApplicationLoadBalancersApi | [**DatacentersApplicationloadbalancersGet**](docs/ ApplicationLoadBalancersApi | [**DatacentersApplicationloadbalancersPatch**](docs/api/ApplicationLoadBalancersApi.md#datacentersapplicationloadbalancerspatch) | **Patch** /datacenters/{datacenterId}/applicationloadbalancers/{applicationLoadBalancerId} | Partially Modify an Application Load Balancer by ID ApplicationLoadBalancersApi | [**DatacentersApplicationloadbalancersPost**](docs/api/ApplicationLoadBalancersApi.md#datacentersapplicationloadbalancerspost) | **Post** /datacenters/{datacenterId}/applicationloadbalancers | Create an Application Load Balancer ApplicationLoadBalancersApi | [**DatacentersApplicationloadbalancersPut**](docs/api/ApplicationLoadBalancersApi.md#datacentersapplicationloadbalancersput) | **Put** /datacenters/{datacenterId}/applicationloadbalancers/{applicationLoadBalancerId} | Modify an Application Load Balancer by ID -BackupUnitsApi | [**BackupunitsDelete**](docs/api/BackupUnitsApi.md#backupunitsdelete) | **Delete** /backupunits/{backupunitId} | Delete backup units -BackupUnitsApi | [**BackupunitsFindById**](docs/api/BackupUnitsApi.md#backupunitsfindbyid) | **Get** /backupunits/{backupunitId} | Retrieve backup units -BackupUnitsApi | [**BackupunitsGet**](docs/api/BackupUnitsApi.md#backupunitsget) | **Get** /backupunits | List backup units -BackupUnitsApi | [**BackupunitsPatch**](docs/api/BackupUnitsApi.md#backupunitspatch) | **Patch** /backupunits/{backupunitId} | Partially modify backup units -BackupUnitsApi | [**BackupunitsPost**](docs/api/BackupUnitsApi.md#backupunitspost) | **Post** /backupunits | Create backup units -BackupUnitsApi | [**BackupunitsPut**](docs/api/BackupUnitsApi.md#backupunitsput) | **Put** /backupunits/{backupunitId} | Modify backup units -BackupUnitsApi | [**BackupunitsSsourlGet**](docs/api/BackupUnitsApi.md#backupunitsssourlget) | **Get** /backupunits/{backupunitId}/ssourl | Retrieve BU single sign-on URLs +BackupServiceApi | [**BackupunitsDelete**](docs/api/BackupServiceApi.md#backupunitsdelete) | **Delete** /backupunits/{backupunitId} | Delete backup units +BackupServiceApi | [**BackupunitsFindById**](docs/api/BackupServiceApi.md#backupunitsfindbyid) | **Get** /backupunits/{backupunitId} | Retrieve backup units +BackupServiceApi | [**BackupunitsGet**](docs/api/BackupServiceApi.md#backupunitsget) | **Get** /backupunits | List backup units +BackupServiceApi | [**BackupunitsPatch**](docs/api/BackupServiceApi.md#backupunitspatch) | **Patch** /backupunits/{backupunitId} | Partially modify backup units +BackupServiceApi | [**BackupunitsPost**](docs/api/BackupServiceApi.md#backupunitspost) | **Post** /backupunits | Create backup units +BackupServiceApi | [**BackupunitsPut**](docs/api/BackupServiceApi.md#backupunitsput) | **Put** /backupunits/{backupunitId} | Modify backup units +BackupServiceApi | [**BackupunitsSsourlGet**](docs/api/BackupServiceApi.md#backupunitsssourlget) | **Get** /backupunits/{backupunitId}/ssourl | Retrieve BU single sign-on URLs ContractResourcesApi | [**ContractsGet**](docs/api/ContractResourcesApi.md#contractsget) | **Get** /contracts | Get Contract Information +CrossConnectsApi | [**PccsDelete**](docs/api/CrossConnectsApi.md#pccsdelete) | **Delete** /pccs/{pccId} | Delete Cross Connects +CrossConnectsApi | [**PccsFindById**](docs/api/CrossConnectsApi.md#pccsfindbyid) | **Get** /pccs/{pccId} | Retrieve a Cross Connect +CrossConnectsApi | [**PccsGet**](docs/api/CrossConnectsApi.md#pccsget) | **Get** /pccs | List Cross Connects +CrossConnectsApi | [**PccsPatch**](docs/api/CrossConnectsApi.md#pccspatch) | **Patch** /pccs/{pccId} | Partially modify a Cross Connects +CrossConnectsApi | [**PccsPost**](docs/api/CrossConnectsApi.md#pccspost) | **Post** /pccs | Create a Cross Connect DataCentersApi | [**DatacentersDelete**](docs/api/DataCentersApi.md#datacentersdelete) | **Delete** /datacenters/{datacenterId} | Delete data centers DataCentersApi | [**DatacentersFindById**](docs/api/DataCentersApi.md#datacentersfindbyid) | **Get** /datacenters/{datacenterId} | Retrieve data centers DataCentersApi | [**DatacentersGet**](docs/api/DataCentersApi.md#datacentersget) | **Get** /datacenters | List your data centers @@ -459,11 +381,6 @@ NetworkLoadBalancersApi | [**DatacentersNetworkloadbalancersGet**](docs/api/Netw NetworkLoadBalancersApi | [**DatacentersNetworkloadbalancersPatch**](docs/api/NetworkLoadBalancersApi.md#datacentersnetworkloadbalancerspatch) | **Patch** /datacenters/{datacenterId}/networkloadbalancers/{networkLoadBalancerId} | Partially modify Network Load Balancers NetworkLoadBalancersApi | [**DatacentersNetworkloadbalancersPost**](docs/api/NetworkLoadBalancersApi.md#datacentersnetworkloadbalancerspost) | **Post** /datacenters/{datacenterId}/networkloadbalancers | Create a Network Load Balancer NetworkLoadBalancersApi | [**DatacentersNetworkloadbalancersPut**](docs/api/NetworkLoadBalancersApi.md#datacentersnetworkloadbalancersput) | **Put** /datacenters/{datacenterId}/networkloadbalancers/{networkLoadBalancerId} | Modify Network Load Balancers -PrivateCrossConnectsApi | [**PccsDelete**](docs/api/PrivateCrossConnectsApi.md#pccsdelete) | **Delete** /pccs/{pccId} | Delete Private Cross-Connects -PrivateCrossConnectsApi | [**PccsFindById**](docs/api/PrivateCrossConnectsApi.md#pccsfindbyid) | **Get** /pccs/{pccId} | Retrieve a Cross Connect -PrivateCrossConnectsApi | [**PccsGet**](docs/api/PrivateCrossConnectsApi.md#pccsget) | **Get** /pccs | List Private Cross-Connects -PrivateCrossConnectsApi | [**PccsPatch**](docs/api/PrivateCrossConnectsApi.md#pccspatch) | **Patch** /pccs/{pccId} | Partially modify a Private Cross-Connects -PrivateCrossConnectsApi | [**PccsPost**](docs/api/PrivateCrossConnectsApi.md#pccspost) | **Post** /pccs | Create a Cross Connect RequestsApi | [**RequestsFindById**](docs/api/RequestsApi.md#requestsfindbyid) | **Get** /requests/{requestId} | Retrieve requests RequestsApi | [**RequestsGet**](docs/api/RequestsApi.md#requestsget) | **Get** /requests | List requests RequestsApi | [**RequestsStatusGet**](docs/api/RequestsApi.md#requestsstatusget) | **Get** /requests/{requestId}/status | Retrieve request status @@ -588,9 +505,9 @@ All URIs are relative to *https://api.ionos.com/cloudapi/v6* - [CpuArchitectureProperties](docs/models/CpuArchitectureProperties) - [CreateSnapshot](docs/models/CreateSnapshot) - [CreateSnapshotProperties](docs/models/CreateSnapshotProperties) - - [DataCenterEntities](docs/models/DataCenterEntities) - [Datacenter](docs/models/Datacenter) - [DatacenterElementMetadata](docs/models/DatacenterElementMetadata) + - [DatacenterEntities](docs/models/DatacenterEntities) - [DatacenterPost](docs/models/DatacenterPost) - [DatacenterProperties](docs/models/DatacenterProperties) - [DatacenterPropertiesPost](docs/models/DatacenterPropertiesPost) @@ -769,23 +686,3 @@ All URIs are relative to *https://api.ionos.com/cloudapi/v6* [[Back to API list]](#documentation-for-api-endpoints) [[Back to Model list]](#documentation-for-models) - - - -## 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: - -Deprecated in favor of ToPtr that uses generics - -* `PtrBool` -* `PtrInt` -* `PtrInt32` -* `PtrInt64` -* `PtrFloat` -* `PtrFloat32` -* `PtrFloat64` -* `PtrString` -* `PtrTime` diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/api_.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/api_.go similarity index 80% rename from vendor/github.com/ionos-cloud/sdk-go/v6/api_.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/api_.go index d858e2787..cdfadef5d 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/api_.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/api_.go @@ -13,6 +13,7 @@ package ionoscloud import ( _context "context" "fmt" + "github.com/ionos-cloud/sdk-go-bundle/shared" "io" _nethttp "net/http" _neturl "net/url" @@ -52,7 +53,7 @@ func (r ApiApiInfoGetRequest) XContractNumber(xContractNumber int32) ApiApiInfoG // Filters query parameters limit results to those containing a matching value for a specific property. func (r ApiApiInfoGetRequest) Filter(key string, value string) ApiApiInfoGetRequest { - filterKey := fmt.Sprintf(FilterQueryParam, key) + filterKey := fmt.Sprintf("filter.%s", key) r.filters[filterKey] = append(r.filters[filterKey], value) return r } @@ -69,7 +70,7 @@ func (r ApiApiInfoGetRequest) MaxResults(maxResults int32) ApiApiInfoGetRequest return r } -func (r ApiApiInfoGetRequest) Execute() (Info, *APIResponse, error) { +func (r ApiApiInfoGetRequest) Execute() (Info, *shared.APIResponse, error) { return r.ApiService.ApiInfoGetExecute(r) } @@ -91,7 +92,7 @@ func (a *DefaultApiService) ApiInfoGet(ctx _context.Context) ApiApiInfoGetReques * Execute executes the request * @return Info */ -func (a *DefaultApiService) ApiInfoGetExecute(r ApiApiInfoGetRequest) (Info, *APIResponse, error) { +func (a *DefaultApiService) ApiInfoGetExecute(r ApiApiInfoGetRequest) (Info, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -103,7 +104,9 @@ func (a *DefaultApiService) ApiInfoGetExecute(r ApiApiInfoGetRequest) (Info, *AP localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ApiInfoGet") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/" @@ -113,20 +116,10 @@ func (a *DefaultApiService) ApiInfoGetExecute(r ApiApiInfoGetRequest) (Info, *AP localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } if r.orderBy != nil { localVarQueryParams.Add("orderBy", parameterToString(*r.orderBy, "")) @@ -160,7 +153,7 @@ func (a *DefaultApiService) ApiInfoGetExecute(r ApiApiInfoGetRequest) (Info, *AP localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { @@ -169,11 +162,11 @@ func (a *DefaultApiService) ApiInfoGetExecute(r ApiApiInfoGetRequest) (Info, *AP localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "ApiInfoGet", } @@ -189,28 +182,26 @@ func (a *DefaultApiService) ApiInfoGetExecute(r ApiApiInfoGetRequest) (Info, *AP } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/api_application_load_balancers.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/api_application_load_balancers.go similarity index 80% rename from vendor/github.com/ionos-cloud/sdk-go/v6/api_application_load_balancers.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/api_application_load_balancers.go index 60f6409d4..017377c2b 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/api_application_load_balancers.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/api_application_load_balancers.go @@ -13,6 +13,7 @@ package ionoscloud import ( _context "context" "fmt" + "github.com/ionos-cloud/sdk-go-bundle/shared" "io" _nethttp "net/http" _neturl "net/url" @@ -50,7 +51,7 @@ func (r ApiDatacentersApplicationloadbalancersDeleteRequest) XContractNumber(xCo return r } -func (r ApiDatacentersApplicationloadbalancersDeleteRequest) Execute() (*APIResponse, error) { +func (r ApiDatacentersApplicationloadbalancersDeleteRequest) Execute() (*shared.APIResponse, error) { return r.ApiService.DatacentersApplicationloadbalancersDeleteExecute(r) } @@ -74,7 +75,7 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers /* * Execute executes the request */ -func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancersDeleteExecute(r ApiDatacentersApplicationloadbalancersDeleteRequest) (*APIResponse, error) { +func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancersDeleteExecute(r ApiDatacentersApplicationloadbalancersDeleteRequest) (*shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodDelete localVarPostBody interface{} @@ -85,32 +86,24 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApplicationLoadBalancersApiService.DatacentersApplicationloadbalancersDelete") if err != nil { - return nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/applicationloadbalancers/{applicationLoadBalancerId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"applicationLoadBalancerId"+"}", _neturl.PathEscape(parameterToString(r.applicationLoadBalancerId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"applicationLoadBalancerId"+"}", _neturl.PathEscape(parameterValueToString(r.applicationLoadBalancerId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -131,11 +124,11 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -154,11 +147,11 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersApplicationloadbalancersDelete", } @@ -174,18 +167,17 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarAPIResponse, newErr } @@ -215,7 +207,7 @@ func (r ApiDatacentersApplicationloadbalancersFindByApplicationLoadBalancerIdReq return r } -func (r ApiDatacentersApplicationloadbalancersFindByApplicationLoadBalancerIdRequest) Execute() (ApplicationLoadBalancer, *APIResponse, error) { +func (r ApiDatacentersApplicationloadbalancersFindByApplicationLoadBalancerIdRequest) Execute() (ApplicationLoadBalancer, *shared.APIResponse, error) { return r.ApiService.DatacentersApplicationloadbalancersFindByApplicationLoadBalancerIdExecute(r) } @@ -240,7 +232,7 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers * Execute executes the request * @return ApplicationLoadBalancer */ -func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancersFindByApplicationLoadBalancerIdExecute(r ApiDatacentersApplicationloadbalancersFindByApplicationLoadBalancerIdRequest) (ApplicationLoadBalancer, *APIResponse, error) { +func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancersFindByApplicationLoadBalancerIdExecute(r ApiDatacentersApplicationloadbalancersFindByApplicationLoadBalancerIdRequest) (ApplicationLoadBalancer, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -252,32 +244,24 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApplicationLoadBalancersApiService.DatacentersApplicationloadbalancersFindByApplicationLoadBalancerId") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/applicationloadbalancers/{applicationLoadBalancerId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"applicationLoadBalancerId"+"}", _neturl.PathEscape(parameterToString(r.applicationLoadBalancerId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"applicationLoadBalancerId"+"}", _neturl.PathEscape(parameterValueToString(r.applicationLoadBalancerId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -298,11 +282,11 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -321,11 +305,11 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersApplicationloadbalancersFindByApplicationLoadBalancerId", } @@ -341,28 +325,26 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -393,7 +375,7 @@ func (r ApiDatacentersApplicationloadbalancersFlowlogsDeleteRequest) XContractNu return r } -func (r ApiDatacentersApplicationloadbalancersFlowlogsDeleteRequest) Execute() (*APIResponse, error) { +func (r ApiDatacentersApplicationloadbalancersFlowlogsDeleteRequest) Execute() (*shared.APIResponse, error) { return r.ApiService.DatacentersApplicationloadbalancersFlowlogsDeleteExecute(r) } @@ -419,7 +401,7 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers /* * Execute executes the request */ -func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancersFlowlogsDeleteExecute(r ApiDatacentersApplicationloadbalancersFlowlogsDeleteRequest) (*APIResponse, error) { +func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancersFlowlogsDeleteExecute(r ApiDatacentersApplicationloadbalancersFlowlogsDeleteRequest) (*shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodDelete localVarPostBody interface{} @@ -430,33 +412,25 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApplicationLoadBalancersApiService.DatacentersApplicationloadbalancersFlowlogsDelete") if err != nil { - return nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/applicationloadbalancers/{applicationLoadBalancerId}/flowlogs/{flowLogId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"applicationLoadBalancerId"+"}", _neturl.PathEscape(parameterToString(r.applicationLoadBalancerId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"flowLogId"+"}", _neturl.PathEscape(parameterToString(r.flowLogId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"applicationLoadBalancerId"+"}", _neturl.PathEscape(parameterValueToString(r.applicationLoadBalancerId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"flowLogId"+"}", _neturl.PathEscape(parameterValueToString(r.flowLogId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -477,11 +451,11 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -500,11 +474,11 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersApplicationloadbalancersFlowlogsDelete", } @@ -520,18 +494,17 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarAPIResponse, newErr } @@ -562,7 +535,7 @@ func (r ApiDatacentersApplicationloadbalancersFlowlogsFindByFlowLogIdRequest) XC return r } -func (r ApiDatacentersApplicationloadbalancersFlowlogsFindByFlowLogIdRequest) Execute() (FlowLog, *APIResponse, error) { +func (r ApiDatacentersApplicationloadbalancersFlowlogsFindByFlowLogIdRequest) Execute() (FlowLog, *shared.APIResponse, error) { return r.ApiService.DatacentersApplicationloadbalancersFlowlogsFindByFlowLogIdExecute(r) } @@ -589,7 +562,7 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers * Execute executes the request * @return FlowLog */ -func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancersFlowlogsFindByFlowLogIdExecute(r ApiDatacentersApplicationloadbalancersFlowlogsFindByFlowLogIdRequest) (FlowLog, *APIResponse, error) { +func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancersFlowlogsFindByFlowLogIdExecute(r ApiDatacentersApplicationloadbalancersFlowlogsFindByFlowLogIdRequest) (FlowLog, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -601,33 +574,25 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApplicationLoadBalancersApiService.DatacentersApplicationloadbalancersFlowlogsFindByFlowLogId") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/applicationloadbalancers/{applicationLoadBalancerId}/flowlogs/{flowLogId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"applicationLoadBalancerId"+"}", _neturl.PathEscape(parameterToString(r.applicationLoadBalancerId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"flowLogId"+"}", _neturl.PathEscape(parameterToString(r.flowLogId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"applicationLoadBalancerId"+"}", _neturl.PathEscape(parameterValueToString(r.applicationLoadBalancerId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"flowLogId"+"}", _neturl.PathEscape(parameterValueToString(r.flowLogId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -648,11 +613,11 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -671,11 +636,11 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersApplicationloadbalancersFlowlogsFindByFlowLogId", } @@ -691,28 +656,26 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -747,7 +710,7 @@ func (r ApiDatacentersApplicationloadbalancersFlowlogsGetRequest) XContractNumbe // Filters query parameters limit results to those containing a matching value for a specific property. func (r ApiDatacentersApplicationloadbalancersFlowlogsGetRequest) Filter(key string, value string) ApiDatacentersApplicationloadbalancersFlowlogsGetRequest { - filterKey := fmt.Sprintf(FilterQueryParam, key) + filterKey := fmt.Sprintf("filter.%s", key) r.filters[filterKey] = append(r.filters[filterKey], value) return r } @@ -764,7 +727,7 @@ func (r ApiDatacentersApplicationloadbalancersFlowlogsGetRequest) MaxResults(max return r } -func (r ApiDatacentersApplicationloadbalancersFlowlogsGetRequest) Execute() (FlowLogs, *APIResponse, error) { +func (r ApiDatacentersApplicationloadbalancersFlowlogsGetRequest) Execute() (FlowLogs, *shared.APIResponse, error) { return r.ApiService.DatacentersApplicationloadbalancersFlowlogsGetExecute(r) } @@ -790,7 +753,7 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers * Execute executes the request * @return FlowLogs */ -func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancersFlowlogsGetExecute(r ApiDatacentersApplicationloadbalancersFlowlogsGetRequest) (FlowLogs, *APIResponse, error) { +func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancersFlowlogsGetExecute(r ApiDatacentersApplicationloadbalancersFlowlogsGetRequest) (FlowLogs, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -802,32 +765,24 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApplicationLoadBalancersApiService.DatacentersApplicationloadbalancersFlowlogsGet") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/applicationloadbalancers/{applicationLoadBalancerId}/flowlogs" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"applicationLoadBalancerId"+"}", _neturl.PathEscape(parameterToString(r.applicationLoadBalancerId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"applicationLoadBalancerId"+"}", _neturl.PathEscape(parameterValueToString(r.applicationLoadBalancerId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } if r.orderBy != nil { localVarQueryParams.Add("orderBy", parameterToString(*r.orderBy, "")) @@ -861,11 +816,11 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -884,11 +839,11 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersApplicationloadbalancersFlowlogsGet", } @@ -904,28 +859,26 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -961,7 +914,7 @@ func (r ApiDatacentersApplicationloadbalancersFlowlogsPatchRequest) XContractNum return r } -func (r ApiDatacentersApplicationloadbalancersFlowlogsPatchRequest) Execute() (FlowLog, *APIResponse, error) { +func (r ApiDatacentersApplicationloadbalancersFlowlogsPatchRequest) Execute() (FlowLog, *shared.APIResponse, error) { return r.ApiService.DatacentersApplicationloadbalancersFlowlogsPatchExecute(r) } @@ -988,7 +941,7 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers * Execute executes the request * @return FlowLog */ -func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancersFlowlogsPatchExecute(r ApiDatacentersApplicationloadbalancersFlowlogsPatchRequest) (FlowLog, *APIResponse, error) { +func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancersFlowlogsPatchExecute(r ApiDatacentersApplicationloadbalancersFlowlogsPatchRequest) (FlowLog, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPatch localVarPostBody interface{} @@ -1000,13 +953,15 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApplicationLoadBalancersApiService.DatacentersApplicationloadbalancersFlowlogsPatch") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/applicationloadbalancers/{applicationLoadBalancerId}/flowlogs/{flowLogId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"applicationLoadBalancerId"+"}", _neturl.PathEscape(parameterToString(r.applicationLoadBalancerId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"flowLogId"+"}", _neturl.PathEscape(parameterToString(r.flowLogId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"applicationLoadBalancerId"+"}", _neturl.PathEscape(parameterValueToString(r.applicationLoadBalancerId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"flowLogId"+"}", _neturl.PathEscape(parameterValueToString(r.flowLogId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -1016,20 +971,10 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -1050,13 +995,13 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.applicationLoadBalancerFlowLogProperties if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -1075,11 +1020,11 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersApplicationloadbalancersFlowlogsPatch", } @@ -1095,28 +1040,26 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -1151,7 +1094,7 @@ func (r ApiDatacentersApplicationloadbalancersFlowlogsPostRequest) XContractNumb return r } -func (r ApiDatacentersApplicationloadbalancersFlowlogsPostRequest) Execute() (FlowLog, *APIResponse, error) { +func (r ApiDatacentersApplicationloadbalancersFlowlogsPostRequest) Execute() (FlowLog, *shared.APIResponse, error) { return r.ApiService.DatacentersApplicationloadbalancersFlowlogsPostExecute(r) } @@ -1176,7 +1119,7 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers * Execute executes the request * @return FlowLog */ -func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancersFlowlogsPostExecute(r ApiDatacentersApplicationloadbalancersFlowlogsPostRequest) (FlowLog, *APIResponse, error) { +func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancersFlowlogsPostExecute(r ApiDatacentersApplicationloadbalancersFlowlogsPostRequest) (FlowLog, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -1188,12 +1131,14 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApplicationLoadBalancersApiService.DatacentersApplicationloadbalancersFlowlogsPost") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/applicationloadbalancers/{applicationLoadBalancerId}/flowlogs" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"applicationLoadBalancerId"+"}", _neturl.PathEscape(parameterToString(r.applicationLoadBalancerId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"applicationLoadBalancerId"+"}", _neturl.PathEscape(parameterValueToString(r.applicationLoadBalancerId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -1203,20 +1148,10 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -1237,13 +1172,13 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.applicationLoadBalancerFlowLog if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -1262,11 +1197,11 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersApplicationloadbalancersFlowlogsPost", } @@ -1282,28 +1217,26 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -1339,7 +1272,7 @@ func (r ApiDatacentersApplicationloadbalancersFlowlogsPutRequest) XContractNumbe return r } -func (r ApiDatacentersApplicationloadbalancersFlowlogsPutRequest) Execute() (FlowLog, *APIResponse, error) { +func (r ApiDatacentersApplicationloadbalancersFlowlogsPutRequest) Execute() (FlowLog, *shared.APIResponse, error) { return r.ApiService.DatacentersApplicationloadbalancersFlowlogsPutExecute(r) } @@ -1366,7 +1299,7 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers * Execute executes the request * @return FlowLog */ -func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancersFlowlogsPutExecute(r ApiDatacentersApplicationloadbalancersFlowlogsPutRequest) (FlowLog, *APIResponse, error) { +func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancersFlowlogsPutExecute(r ApiDatacentersApplicationloadbalancersFlowlogsPutRequest) (FlowLog, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPut localVarPostBody interface{} @@ -1378,13 +1311,15 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApplicationLoadBalancersApiService.DatacentersApplicationloadbalancersFlowlogsPut") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/applicationloadbalancers/{applicationLoadBalancerId}/flowlogs/{flowLogId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"applicationLoadBalancerId"+"}", _neturl.PathEscape(parameterToString(r.applicationLoadBalancerId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"flowLogId"+"}", _neturl.PathEscape(parameterToString(r.flowLogId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"applicationLoadBalancerId"+"}", _neturl.PathEscape(parameterValueToString(r.applicationLoadBalancerId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"flowLogId"+"}", _neturl.PathEscape(parameterValueToString(r.flowLogId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -1394,20 +1329,10 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -1428,13 +1353,13 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.applicationLoadBalancerFlowLog if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -1453,11 +1378,11 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersApplicationloadbalancersFlowlogsPut", } @@ -1473,28 +1398,26 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -1525,7 +1448,7 @@ func (r ApiDatacentersApplicationloadbalancersForwardingrulesDeleteRequest) XCon return r } -func (r ApiDatacentersApplicationloadbalancersForwardingrulesDeleteRequest) Execute() (*APIResponse, error) { +func (r ApiDatacentersApplicationloadbalancersForwardingrulesDeleteRequest) Execute() (*shared.APIResponse, error) { return r.ApiService.DatacentersApplicationloadbalancersForwardingrulesDeleteExecute(r) } @@ -1551,7 +1474,7 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers /* * Execute executes the request */ -func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancersForwardingrulesDeleteExecute(r ApiDatacentersApplicationloadbalancersForwardingrulesDeleteRequest) (*APIResponse, error) { +func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancersForwardingrulesDeleteExecute(r ApiDatacentersApplicationloadbalancersForwardingrulesDeleteRequest) (*shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodDelete localVarPostBody interface{} @@ -1562,33 +1485,25 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApplicationLoadBalancersApiService.DatacentersApplicationloadbalancersForwardingrulesDelete") if err != nil { - return nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/applicationloadbalancers/{applicationLoadBalancerId}/forwardingrules/{forwardingRuleId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"applicationLoadBalancerId"+"}", _neturl.PathEscape(parameterToString(r.applicationLoadBalancerId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"forwardingRuleId"+"}", _neturl.PathEscape(parameterToString(r.forwardingRuleId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"applicationLoadBalancerId"+"}", _neturl.PathEscape(parameterValueToString(r.applicationLoadBalancerId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"forwardingRuleId"+"}", _neturl.PathEscape(parameterValueToString(r.forwardingRuleId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -1609,11 +1524,11 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -1632,11 +1547,11 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersApplicationloadbalancersForwardingrulesDelete", } @@ -1652,18 +1567,17 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarAPIResponse, newErr } @@ -1694,7 +1608,7 @@ func (r ApiDatacentersApplicationloadbalancersForwardingrulesFindByForwardingRul return r } -func (r ApiDatacentersApplicationloadbalancersForwardingrulesFindByForwardingRuleIdRequest) Execute() (ApplicationLoadBalancerForwardingRule, *APIResponse, error) { +func (r ApiDatacentersApplicationloadbalancersForwardingrulesFindByForwardingRuleIdRequest) Execute() (ApplicationLoadBalancerForwardingRule, *shared.APIResponse, error) { return r.ApiService.DatacentersApplicationloadbalancersForwardingrulesFindByForwardingRuleIdExecute(r) } @@ -1721,7 +1635,7 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers * Execute executes the request * @return ApplicationLoadBalancerForwardingRule */ -func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancersForwardingrulesFindByForwardingRuleIdExecute(r ApiDatacentersApplicationloadbalancersForwardingrulesFindByForwardingRuleIdRequest) (ApplicationLoadBalancerForwardingRule, *APIResponse, error) { +func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancersForwardingrulesFindByForwardingRuleIdExecute(r ApiDatacentersApplicationloadbalancersForwardingrulesFindByForwardingRuleIdRequest) (ApplicationLoadBalancerForwardingRule, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -1733,33 +1647,25 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApplicationLoadBalancersApiService.DatacentersApplicationloadbalancersForwardingrulesFindByForwardingRuleId") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/applicationloadbalancers/{applicationLoadBalancerId}/forwardingrules/{forwardingRuleId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"applicationLoadBalancerId"+"}", _neturl.PathEscape(parameterToString(r.applicationLoadBalancerId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"forwardingRuleId"+"}", _neturl.PathEscape(parameterToString(r.forwardingRuleId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"applicationLoadBalancerId"+"}", _neturl.PathEscape(parameterValueToString(r.applicationLoadBalancerId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"forwardingRuleId"+"}", _neturl.PathEscape(parameterValueToString(r.forwardingRuleId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -1780,11 +1686,11 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -1803,11 +1709,11 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersApplicationloadbalancersForwardingrulesFindByForwardingRuleId", } @@ -1823,28 +1729,26 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -1879,7 +1783,7 @@ func (r ApiDatacentersApplicationloadbalancersForwardingrulesGetRequest) XContra // Filters query parameters limit results to those containing a matching value for a specific property. func (r ApiDatacentersApplicationloadbalancersForwardingrulesGetRequest) Filter(key string, value string) ApiDatacentersApplicationloadbalancersForwardingrulesGetRequest { - filterKey := fmt.Sprintf(FilterQueryParam, key) + filterKey := fmt.Sprintf("filter.%s", key) r.filters[filterKey] = append(r.filters[filterKey], value) return r } @@ -1896,7 +1800,7 @@ func (r ApiDatacentersApplicationloadbalancersForwardingrulesGetRequest) MaxResu return r } -func (r ApiDatacentersApplicationloadbalancersForwardingrulesGetRequest) Execute() (ApplicationLoadBalancerForwardingRules, *APIResponse, error) { +func (r ApiDatacentersApplicationloadbalancersForwardingrulesGetRequest) Execute() (ApplicationLoadBalancerForwardingRules, *shared.APIResponse, error) { return r.ApiService.DatacentersApplicationloadbalancersForwardingrulesGetExecute(r) } @@ -1922,7 +1826,7 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers * Execute executes the request * @return ApplicationLoadBalancerForwardingRules */ -func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancersForwardingrulesGetExecute(r ApiDatacentersApplicationloadbalancersForwardingrulesGetRequest) (ApplicationLoadBalancerForwardingRules, *APIResponse, error) { +func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancersForwardingrulesGetExecute(r ApiDatacentersApplicationloadbalancersForwardingrulesGetRequest) (ApplicationLoadBalancerForwardingRules, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -1934,32 +1838,24 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApplicationLoadBalancersApiService.DatacentersApplicationloadbalancersForwardingrulesGet") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/applicationloadbalancers/{applicationLoadBalancerId}/forwardingrules" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"applicationLoadBalancerId"+"}", _neturl.PathEscape(parameterToString(r.applicationLoadBalancerId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"applicationLoadBalancerId"+"}", _neturl.PathEscape(parameterValueToString(r.applicationLoadBalancerId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } if r.orderBy != nil { localVarQueryParams.Add("orderBy", parameterToString(*r.orderBy, "")) @@ -1993,11 +1889,11 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -2016,11 +1912,11 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersApplicationloadbalancersForwardingrulesGet", } @@ -2036,28 +1932,26 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -2093,7 +1987,7 @@ func (r ApiDatacentersApplicationloadbalancersForwardingrulesPatchRequest) XCont return r } -func (r ApiDatacentersApplicationloadbalancersForwardingrulesPatchRequest) Execute() (ApplicationLoadBalancerForwardingRule, *APIResponse, error) { +func (r ApiDatacentersApplicationloadbalancersForwardingrulesPatchRequest) Execute() (ApplicationLoadBalancerForwardingRule, *shared.APIResponse, error) { return r.ApiService.DatacentersApplicationloadbalancersForwardingrulesPatchExecute(r) } @@ -2120,7 +2014,7 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers * Execute executes the request * @return ApplicationLoadBalancerForwardingRule */ -func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancersForwardingrulesPatchExecute(r ApiDatacentersApplicationloadbalancersForwardingrulesPatchRequest) (ApplicationLoadBalancerForwardingRule, *APIResponse, error) { +func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancersForwardingrulesPatchExecute(r ApiDatacentersApplicationloadbalancersForwardingrulesPatchRequest) (ApplicationLoadBalancerForwardingRule, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPatch localVarPostBody interface{} @@ -2132,13 +2026,15 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApplicationLoadBalancersApiService.DatacentersApplicationloadbalancersForwardingrulesPatch") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/applicationloadbalancers/{applicationLoadBalancerId}/forwardingrules/{forwardingRuleId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"applicationLoadBalancerId"+"}", _neturl.PathEscape(parameterToString(r.applicationLoadBalancerId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"forwardingRuleId"+"}", _neturl.PathEscape(parameterToString(r.forwardingRuleId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"applicationLoadBalancerId"+"}", _neturl.PathEscape(parameterValueToString(r.applicationLoadBalancerId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"forwardingRuleId"+"}", _neturl.PathEscape(parameterValueToString(r.forwardingRuleId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -2148,20 +2044,10 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -2182,13 +2068,13 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.applicationLoadBalancerForwardingRuleProperties if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -2207,11 +2093,11 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersApplicationloadbalancersForwardingrulesPatch", } @@ -2227,28 +2113,26 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -2283,7 +2167,7 @@ func (r ApiDatacentersApplicationloadbalancersForwardingrulesPostRequest) XContr return r } -func (r ApiDatacentersApplicationloadbalancersForwardingrulesPostRequest) Execute() (ApplicationLoadBalancerForwardingRule, *APIResponse, error) { +func (r ApiDatacentersApplicationloadbalancersForwardingrulesPostRequest) Execute() (ApplicationLoadBalancerForwardingRule, *shared.APIResponse, error) { return r.ApiService.DatacentersApplicationloadbalancersForwardingrulesPostExecute(r) } @@ -2308,7 +2192,7 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers * Execute executes the request * @return ApplicationLoadBalancerForwardingRule */ -func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancersForwardingrulesPostExecute(r ApiDatacentersApplicationloadbalancersForwardingrulesPostRequest) (ApplicationLoadBalancerForwardingRule, *APIResponse, error) { +func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancersForwardingrulesPostExecute(r ApiDatacentersApplicationloadbalancersForwardingrulesPostRequest) (ApplicationLoadBalancerForwardingRule, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -2320,12 +2204,14 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApplicationLoadBalancersApiService.DatacentersApplicationloadbalancersForwardingrulesPost") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/applicationloadbalancers/{applicationLoadBalancerId}/forwardingrules" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"applicationLoadBalancerId"+"}", _neturl.PathEscape(parameterToString(r.applicationLoadBalancerId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"applicationLoadBalancerId"+"}", _neturl.PathEscape(parameterValueToString(r.applicationLoadBalancerId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -2335,20 +2221,10 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -2369,13 +2245,13 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.applicationLoadBalancerForwardingRule if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -2394,11 +2270,11 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersApplicationloadbalancersForwardingrulesPost", } @@ -2414,28 +2290,26 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -2471,7 +2345,7 @@ func (r ApiDatacentersApplicationloadbalancersForwardingrulesPutRequest) XContra return r } -func (r ApiDatacentersApplicationloadbalancersForwardingrulesPutRequest) Execute() (ApplicationLoadBalancerForwardingRule, *APIResponse, error) { +func (r ApiDatacentersApplicationloadbalancersForwardingrulesPutRequest) Execute() (ApplicationLoadBalancerForwardingRule, *shared.APIResponse, error) { return r.ApiService.DatacentersApplicationloadbalancersForwardingrulesPutExecute(r) } @@ -2498,7 +2372,7 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers * Execute executes the request * @return ApplicationLoadBalancerForwardingRule */ -func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancersForwardingrulesPutExecute(r ApiDatacentersApplicationloadbalancersForwardingrulesPutRequest) (ApplicationLoadBalancerForwardingRule, *APIResponse, error) { +func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancersForwardingrulesPutExecute(r ApiDatacentersApplicationloadbalancersForwardingrulesPutRequest) (ApplicationLoadBalancerForwardingRule, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPut localVarPostBody interface{} @@ -2510,13 +2384,15 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApplicationLoadBalancersApiService.DatacentersApplicationloadbalancersForwardingrulesPut") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/applicationloadbalancers/{applicationLoadBalancerId}/forwardingrules/{forwardingRuleId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"applicationLoadBalancerId"+"}", _neturl.PathEscape(parameterToString(r.applicationLoadBalancerId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"forwardingRuleId"+"}", _neturl.PathEscape(parameterToString(r.forwardingRuleId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"applicationLoadBalancerId"+"}", _neturl.PathEscape(parameterValueToString(r.applicationLoadBalancerId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"forwardingRuleId"+"}", _neturl.PathEscape(parameterValueToString(r.forwardingRuleId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -2526,20 +2402,10 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -2560,13 +2426,13 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.applicationLoadBalancerForwardingRule if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -2585,11 +2451,11 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersApplicationloadbalancersForwardingrulesPut", } @@ -2605,28 +2471,26 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -2670,7 +2534,7 @@ func (r ApiDatacentersApplicationloadbalancersGetRequest) Limit(limit int32) Api // Filters query parameters limit results to those containing a matching value for a specific property. func (r ApiDatacentersApplicationloadbalancersGetRequest) Filter(key string, value string) ApiDatacentersApplicationloadbalancersGetRequest { - filterKey := fmt.Sprintf(FilterQueryParam, key) + filterKey := fmt.Sprintf("filter.%s", key) r.filters[filterKey] = append(r.filters[filterKey], value) return r } @@ -2687,7 +2551,7 @@ func (r ApiDatacentersApplicationloadbalancersGetRequest) MaxResults(maxResults return r } -func (r ApiDatacentersApplicationloadbalancersGetRequest) Execute() (ApplicationLoadBalancers, *APIResponse, error) { +func (r ApiDatacentersApplicationloadbalancersGetRequest) Execute() (ApplicationLoadBalancers, *shared.APIResponse, error) { return r.ApiService.DatacentersApplicationloadbalancersGetExecute(r) } @@ -2711,7 +2575,7 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers * Execute executes the request * @return ApplicationLoadBalancers */ -func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancersGetExecute(r ApiDatacentersApplicationloadbalancersGetRequest) (ApplicationLoadBalancers, *APIResponse, error) { +func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancersGetExecute(r ApiDatacentersApplicationloadbalancersGetRequest) (ApplicationLoadBalancers, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -2723,47 +2587,29 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApplicationLoadBalancersApiService.DatacentersApplicationloadbalancersGet") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/applicationloadbalancers" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } if r.offset != nil { - localVarQueryParams.Add("offset", parameterToString(*r.offset, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("offset") - if defaultQueryParam == "" { - localVarQueryParams.Add("offset", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "offset", r.offset, "") } if r.limit != nil { - localVarQueryParams.Add("limit", parameterToString(*r.limit, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("limit") - if defaultQueryParam == "" { - localVarQueryParams.Add("limit", parameterToString(1000, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "") } if r.orderBy != nil { localVarQueryParams.Add("orderBy", parameterToString(*r.orderBy, "")) @@ -2797,11 +2643,11 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -2820,11 +2666,11 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersApplicationloadbalancersGet", } @@ -2840,28 +2686,26 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -2896,7 +2740,7 @@ func (r ApiDatacentersApplicationloadbalancersPatchRequest) XContractNumber(xCon return r } -func (r ApiDatacentersApplicationloadbalancersPatchRequest) Execute() (ApplicationLoadBalancer, *APIResponse, error) { +func (r ApiDatacentersApplicationloadbalancersPatchRequest) Execute() (ApplicationLoadBalancer, *shared.APIResponse, error) { return r.ApiService.DatacentersApplicationloadbalancersPatchExecute(r) } @@ -2921,7 +2765,7 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers * Execute executes the request * @return ApplicationLoadBalancer */ -func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancersPatchExecute(r ApiDatacentersApplicationloadbalancersPatchRequest) (ApplicationLoadBalancer, *APIResponse, error) { +func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancersPatchExecute(r ApiDatacentersApplicationloadbalancersPatchRequest) (ApplicationLoadBalancer, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPatch localVarPostBody interface{} @@ -2933,12 +2777,14 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApplicationLoadBalancersApiService.DatacentersApplicationloadbalancersPatch") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/applicationloadbalancers/{applicationLoadBalancerId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"applicationLoadBalancerId"+"}", _neturl.PathEscape(parameterToString(r.applicationLoadBalancerId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"applicationLoadBalancerId"+"}", _neturl.PathEscape(parameterValueToString(r.applicationLoadBalancerId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -2948,20 +2794,10 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -2982,13 +2818,13 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.applicationLoadBalancerProperties if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -3007,11 +2843,11 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersApplicationloadbalancersPatch", } @@ -3027,28 +2863,26 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -3082,7 +2916,7 @@ func (r ApiDatacentersApplicationloadbalancersPostRequest) XContractNumber(xCont return r } -func (r ApiDatacentersApplicationloadbalancersPostRequest) Execute() (ApplicationLoadBalancer, *APIResponse, error) { +func (r ApiDatacentersApplicationloadbalancersPostRequest) Execute() (ApplicationLoadBalancer, *shared.APIResponse, error) { return r.ApiService.DatacentersApplicationloadbalancersPostExecute(r) } @@ -3105,7 +2939,7 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers * Execute executes the request * @return ApplicationLoadBalancer */ -func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancersPostExecute(r ApiDatacentersApplicationloadbalancersPostRequest) (ApplicationLoadBalancer, *APIResponse, error) { +func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancersPostExecute(r ApiDatacentersApplicationloadbalancersPostRequest) (ApplicationLoadBalancer, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -3117,11 +2951,13 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApplicationLoadBalancersApiService.DatacentersApplicationloadbalancersPost") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/applicationloadbalancers" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -3131,20 +2967,10 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -3165,13 +2991,13 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.applicationLoadBalancer if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -3190,11 +3016,11 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersApplicationloadbalancersPost", } @@ -3210,28 +3036,26 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -3266,7 +3090,7 @@ func (r ApiDatacentersApplicationloadbalancersPutRequest) XContractNumber(xContr return r } -func (r ApiDatacentersApplicationloadbalancersPutRequest) Execute() (ApplicationLoadBalancer, *APIResponse, error) { +func (r ApiDatacentersApplicationloadbalancersPutRequest) Execute() (ApplicationLoadBalancer, *shared.APIResponse, error) { return r.ApiService.DatacentersApplicationloadbalancersPutExecute(r) } @@ -3291,7 +3115,7 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers * Execute executes the request * @return ApplicationLoadBalancer */ -func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancersPutExecute(r ApiDatacentersApplicationloadbalancersPutRequest) (ApplicationLoadBalancer, *APIResponse, error) { +func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancersPutExecute(r ApiDatacentersApplicationloadbalancersPutRequest) (ApplicationLoadBalancer, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPut localVarPostBody interface{} @@ -3303,12 +3127,14 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ApplicationLoadBalancersApiService.DatacentersApplicationloadbalancersPut") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/applicationloadbalancers/{applicationLoadBalancerId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"applicationLoadBalancerId"+"}", _neturl.PathEscape(parameterToString(r.applicationLoadBalancerId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"applicationLoadBalancerId"+"}", _neturl.PathEscape(parameterValueToString(r.applicationLoadBalancerId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -3318,20 +3144,10 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -3352,13 +3168,13 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.applicationLoadBalancer if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -3377,11 +3193,11 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersApplicationloadbalancersPut", } @@ -3397,28 +3213,26 @@ func (a *ApplicationLoadBalancersApiService) DatacentersApplicationloadbalancers } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/api_backup_units.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/api_backup_service.go similarity index 73% rename from vendor/github.com/ionos-cloud/sdk-go/v6/api_backup_units.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/api_backup_service.go index b97740000..927d3e5f7 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/api_backup_units.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/api_backup_service.go @@ -13,6 +13,7 @@ package ionoscloud import ( _context "context" "fmt" + "github.com/ionos-cloud/sdk-go-bundle/shared" "io" _nethttp "net/http" _neturl "net/url" @@ -24,12 +25,12 @@ var ( _ _context.Context ) -// BackupUnitsApiService BackupUnitsApi service -type BackupUnitsApiService service +// BackupServiceApiService BackupServiceApi service +type BackupServiceApiService service type ApiBackupunitsDeleteRequest struct { ctx _context.Context - ApiService *BackupUnitsApiService + ApiService *BackupServiceApiService backupunitId string pretty *bool depth *int32 @@ -49,7 +50,7 @@ func (r ApiBackupunitsDeleteRequest) XContractNumber(xContractNumber int32) ApiB return r } -func (r ApiBackupunitsDeleteRequest) Execute() (*APIResponse, error) { +func (r ApiBackupunitsDeleteRequest) Execute() (*shared.APIResponse, error) { return r.ApiService.BackupunitsDeleteExecute(r) } @@ -66,7 +67,7 @@ This process will delete: - @param backupunitId The unique ID of the backup unit. - @return ApiBackupunitsDeleteRequest */ -func (a *BackupUnitsApiService) BackupunitsDelete(ctx _context.Context, backupunitId string) ApiBackupunitsDeleteRequest { +func (a *BackupServiceApiService) BackupunitsDelete(ctx _context.Context, backupunitId string) ApiBackupunitsDeleteRequest { return ApiBackupunitsDeleteRequest{ ApiService: a, ctx: ctx, @@ -77,7 +78,7 @@ func (a *BackupUnitsApiService) BackupunitsDelete(ctx _context.Context, backupun /* * Execute executes the request */ -func (a *BackupUnitsApiService) BackupunitsDeleteExecute(r ApiBackupunitsDeleteRequest) (*APIResponse, error) { +func (a *BackupServiceApiService) BackupunitsDeleteExecute(r ApiBackupunitsDeleteRequest) (*shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodDelete localVarPostBody interface{} @@ -86,33 +87,25 @@ func (a *BackupUnitsApiService) BackupunitsDeleteExecute(r ApiBackupunitsDeleteR localVarFileBytes []byte ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BackupUnitsApiService.BackupunitsDelete") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BackupServiceApiService.BackupunitsDelete") if err != nil { - return nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return nil, gerr } localVarPath := localBasePath + "/backupunits/{backupunitId}" - localVarPath = strings.Replace(localVarPath, "{"+"backupunitId"+"}", _neturl.PathEscape(parameterToString(r.backupunitId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"backupunitId"+"}", _neturl.PathEscape(parameterValueToString(r.backupunitId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -133,11 +126,11 @@ func (a *BackupUnitsApiService) BackupunitsDeleteExecute(r ApiBackupunitsDeleteR localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -156,11 +149,11 @@ func (a *BackupUnitsApiService) BackupunitsDeleteExecute(r ApiBackupunitsDeleteR localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "BackupunitsDelete", } @@ -176,18 +169,17 @@ func (a *BackupUnitsApiService) BackupunitsDeleteExecute(r ApiBackupunitsDeleteR } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarAPIResponse, newErr } @@ -196,7 +188,7 @@ func (a *BackupUnitsApiService) BackupunitsDeleteExecute(r ApiBackupunitsDeleteR type ApiBackupunitsFindByIdRequest struct { ctx _context.Context - ApiService *BackupUnitsApiService + ApiService *BackupServiceApiService backupunitId string pretty *bool depth *int32 @@ -216,7 +208,7 @@ func (r ApiBackupunitsFindByIdRequest) XContractNumber(xContractNumber int32) Ap return r } -func (r ApiBackupunitsFindByIdRequest) Execute() (BackupUnit, *APIResponse, error) { +func (r ApiBackupunitsFindByIdRequest) Execute() (BackupUnit, *shared.APIResponse, error) { return r.ApiService.BackupunitsFindByIdExecute(r) } @@ -227,7 +219,7 @@ func (r ApiBackupunitsFindByIdRequest) Execute() (BackupUnit, *APIResponse, erro * @param backupunitId The unique ID of the backup unit. * @return ApiBackupunitsFindByIdRequest */ -func (a *BackupUnitsApiService) BackupunitsFindById(ctx _context.Context, backupunitId string) ApiBackupunitsFindByIdRequest { +func (a *BackupServiceApiService) BackupunitsFindById(ctx _context.Context, backupunitId string) ApiBackupunitsFindByIdRequest { return ApiBackupunitsFindByIdRequest{ ApiService: a, ctx: ctx, @@ -239,7 +231,7 @@ func (a *BackupUnitsApiService) BackupunitsFindById(ctx _context.Context, backup * Execute executes the request * @return BackupUnit */ -func (a *BackupUnitsApiService) BackupunitsFindByIdExecute(r ApiBackupunitsFindByIdRequest) (BackupUnit, *APIResponse, error) { +func (a *BackupServiceApiService) BackupunitsFindByIdExecute(r ApiBackupunitsFindByIdRequest) (BackupUnit, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -249,33 +241,25 @@ func (a *BackupUnitsApiService) BackupunitsFindByIdExecute(r ApiBackupunitsFindB localVarReturnValue BackupUnit ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BackupUnitsApiService.BackupunitsFindById") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BackupServiceApiService.BackupunitsFindById") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/backupunits/{backupunitId}" - localVarPath = strings.Replace(localVarPath, "{"+"backupunitId"+"}", _neturl.PathEscape(parameterToString(r.backupunitId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"backupunitId"+"}", _neturl.PathEscape(parameterValueToString(r.backupunitId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -296,11 +280,11 @@ func (a *BackupUnitsApiService) BackupunitsFindByIdExecute(r ApiBackupunitsFindB localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -319,11 +303,11 @@ func (a *BackupUnitsApiService) BackupunitsFindByIdExecute(r ApiBackupunitsFindB localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "BackupunitsFindById", } @@ -339,28 +323,26 @@ func (a *BackupUnitsApiService) BackupunitsFindByIdExecute(r ApiBackupunitsFindB } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -369,7 +351,7 @@ func (a *BackupUnitsApiService) BackupunitsFindByIdExecute(r ApiBackupunitsFindB type ApiBackupunitsGetRequest struct { ctx _context.Context - ApiService *BackupUnitsApiService + ApiService *BackupServiceApiService filters _neturl.Values orderBy *string maxResults *int32 @@ -393,7 +375,7 @@ func (r ApiBackupunitsGetRequest) XContractNumber(xContractNumber int32) ApiBack // Filters query parameters limit results to those containing a matching value for a specific property. func (r ApiBackupunitsGetRequest) Filter(key string, value string) ApiBackupunitsGetRequest { - filterKey := fmt.Sprintf(FilterQueryParam, key) + filterKey := fmt.Sprintf("filter.%s", key) r.filters[filterKey] = append(r.filters[filterKey], value) return r } @@ -410,7 +392,7 @@ func (r ApiBackupunitsGetRequest) MaxResults(maxResults int32) ApiBackupunitsGet return r } -func (r ApiBackupunitsGetRequest) Execute() (BackupUnits, *APIResponse, error) { +func (r ApiBackupunitsGetRequest) Execute() (BackupUnits, *shared.APIResponse, error) { return r.ApiService.BackupunitsGetExecute(r) } @@ -420,7 +402,7 @@ func (r ApiBackupunitsGetRequest) Execute() (BackupUnits, *APIResponse, error) { * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @return ApiBackupunitsGetRequest */ -func (a *BackupUnitsApiService) BackupunitsGet(ctx _context.Context) ApiBackupunitsGetRequest { +func (a *BackupServiceApiService) BackupunitsGet(ctx _context.Context) ApiBackupunitsGetRequest { return ApiBackupunitsGetRequest{ ApiService: a, ctx: ctx, @@ -432,7 +414,7 @@ func (a *BackupUnitsApiService) BackupunitsGet(ctx _context.Context) ApiBackupun * Execute executes the request * @return BackupUnits */ -func (a *BackupUnitsApiService) BackupunitsGetExecute(r ApiBackupunitsGetRequest) (BackupUnits, *APIResponse, error) { +func (a *BackupServiceApiService) BackupunitsGetExecute(r ApiBackupunitsGetRequest) (BackupUnits, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -442,9 +424,11 @@ func (a *BackupUnitsApiService) BackupunitsGetExecute(r ApiBackupunitsGetRequest localVarReturnValue BackupUnits ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BackupUnitsApiService.BackupunitsGet") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BackupServiceApiService.BackupunitsGet") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/backupunits" @@ -454,20 +438,10 @@ func (a *BackupUnitsApiService) BackupunitsGetExecute(r ApiBackupunitsGetRequest localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } if r.orderBy != nil { localVarQueryParams.Add("orderBy", parameterToString(*r.orderBy, "")) @@ -501,11 +475,11 @@ func (a *BackupUnitsApiService) BackupunitsGetExecute(r ApiBackupunitsGetRequest localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -524,11 +498,11 @@ func (a *BackupUnitsApiService) BackupunitsGetExecute(r ApiBackupunitsGetRequest localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "BackupunitsGet", } @@ -544,28 +518,26 @@ func (a *BackupUnitsApiService) BackupunitsGetExecute(r ApiBackupunitsGetRequest } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -574,7 +546,7 @@ func (a *BackupUnitsApiService) BackupunitsGetExecute(r ApiBackupunitsGetRequest type ApiBackupunitsPatchRequest struct { ctx _context.Context - ApiService *BackupUnitsApiService + ApiService *BackupServiceApiService backupunitId string backupUnit *BackupUnitProperties pretty *bool @@ -599,7 +571,7 @@ func (r ApiBackupunitsPatchRequest) XContractNumber(xContractNumber int32) ApiBa return r } -func (r ApiBackupunitsPatchRequest) Execute() (BackupUnit, *APIResponse, error) { +func (r ApiBackupunitsPatchRequest) Execute() (BackupUnit, *shared.APIResponse, error) { return r.ApiService.BackupunitsPatchExecute(r) } @@ -610,7 +582,7 @@ func (r ApiBackupunitsPatchRequest) Execute() (BackupUnit, *APIResponse, error) * @param backupunitId The unique ID of the backup unit. * @return ApiBackupunitsPatchRequest */ -func (a *BackupUnitsApiService) BackupunitsPatch(ctx _context.Context, backupunitId string) ApiBackupunitsPatchRequest { +func (a *BackupServiceApiService) BackupunitsPatch(ctx _context.Context, backupunitId string) ApiBackupunitsPatchRequest { return ApiBackupunitsPatchRequest{ ApiService: a, ctx: ctx, @@ -622,7 +594,7 @@ func (a *BackupUnitsApiService) BackupunitsPatch(ctx _context.Context, backupuni * Execute executes the request * @return BackupUnit */ -func (a *BackupUnitsApiService) BackupunitsPatchExecute(r ApiBackupunitsPatchRequest) (BackupUnit, *APIResponse, error) { +func (a *BackupServiceApiService) BackupunitsPatchExecute(r ApiBackupunitsPatchRequest) (BackupUnit, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPatch localVarPostBody interface{} @@ -632,13 +604,15 @@ func (a *BackupUnitsApiService) BackupunitsPatchExecute(r ApiBackupunitsPatchReq localVarReturnValue BackupUnit ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BackupUnitsApiService.BackupunitsPatch") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BackupServiceApiService.BackupunitsPatch") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/backupunits/{backupunitId}" - localVarPath = strings.Replace(localVarPath, "{"+"backupunitId"+"}", _neturl.PathEscape(parameterToString(r.backupunitId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"backupunitId"+"}", _neturl.PathEscape(parameterValueToString(r.backupunitId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -648,20 +622,10 @@ func (a *BackupUnitsApiService) BackupunitsPatchExecute(r ApiBackupunitsPatchReq } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -682,13 +646,13 @@ func (a *BackupUnitsApiService) BackupunitsPatchExecute(r ApiBackupunitsPatchReq localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.backupUnit if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -707,11 +671,11 @@ func (a *BackupUnitsApiService) BackupunitsPatchExecute(r ApiBackupunitsPatchReq localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "BackupunitsPatch", } @@ -727,28 +691,26 @@ func (a *BackupUnitsApiService) BackupunitsPatchExecute(r ApiBackupunitsPatchReq } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -757,7 +719,7 @@ func (a *BackupUnitsApiService) BackupunitsPatchExecute(r ApiBackupunitsPatchReq type ApiBackupunitsPostRequest struct { ctx _context.Context - ApiService *BackupUnitsApiService + ApiService *BackupServiceApiService backupUnit *BackupUnit pretty *bool depth *int32 @@ -781,7 +743,7 @@ func (r ApiBackupunitsPostRequest) XContractNumber(xContractNumber int32) ApiBac return r } -func (r ApiBackupunitsPostRequest) Execute() (BackupUnit, *APIResponse, error) { +func (r ApiBackupunitsPostRequest) Execute() (BackupUnit, *shared.APIResponse, error) { return r.ApiService.BackupunitsPostExecute(r) } @@ -791,7 +753,7 @@ func (r ApiBackupunitsPostRequest) Execute() (BackupUnit, *APIResponse, error) { * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @return ApiBackupunitsPostRequest */ -func (a *BackupUnitsApiService) BackupunitsPost(ctx _context.Context) ApiBackupunitsPostRequest { +func (a *BackupServiceApiService) BackupunitsPost(ctx _context.Context) ApiBackupunitsPostRequest { return ApiBackupunitsPostRequest{ ApiService: a, ctx: ctx, @@ -802,7 +764,7 @@ func (a *BackupUnitsApiService) BackupunitsPost(ctx _context.Context) ApiBackupu * Execute executes the request * @return BackupUnit */ -func (a *BackupUnitsApiService) BackupunitsPostExecute(r ApiBackupunitsPostRequest) (BackupUnit, *APIResponse, error) { +func (a *BackupServiceApiService) BackupunitsPostExecute(r ApiBackupunitsPostRequest) (BackupUnit, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -812,9 +774,11 @@ func (a *BackupUnitsApiService) BackupunitsPostExecute(r ApiBackupunitsPostReque localVarReturnValue BackupUnit ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BackupUnitsApiService.BackupunitsPost") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BackupServiceApiService.BackupunitsPost") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/backupunits" @@ -827,20 +791,10 @@ func (a *BackupUnitsApiService) BackupunitsPostExecute(r ApiBackupunitsPostReque } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -861,13 +815,13 @@ func (a *BackupUnitsApiService) BackupunitsPostExecute(r ApiBackupunitsPostReque localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.backupUnit if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -886,11 +840,11 @@ func (a *BackupUnitsApiService) BackupunitsPostExecute(r ApiBackupunitsPostReque localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "BackupunitsPost", } @@ -906,28 +860,26 @@ func (a *BackupUnitsApiService) BackupunitsPostExecute(r ApiBackupunitsPostReque } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -936,7 +888,7 @@ func (a *BackupUnitsApiService) BackupunitsPostExecute(r ApiBackupunitsPostReque type ApiBackupunitsPutRequest struct { ctx _context.Context - ApiService *BackupUnitsApiService + ApiService *BackupServiceApiService backupunitId string backupUnit *BackupUnit pretty *bool @@ -961,7 +913,7 @@ func (r ApiBackupunitsPutRequest) XContractNumber(xContractNumber int32) ApiBack return r } -func (r ApiBackupunitsPutRequest) Execute() (BackupUnit, *APIResponse, error) { +func (r ApiBackupunitsPutRequest) Execute() (BackupUnit, *shared.APIResponse, error) { return r.ApiService.BackupunitsPutExecute(r) } @@ -972,7 +924,7 @@ func (r ApiBackupunitsPutRequest) Execute() (BackupUnit, *APIResponse, error) { * @param backupunitId The unique ID of the backup unit. * @return ApiBackupunitsPutRequest */ -func (a *BackupUnitsApiService) BackupunitsPut(ctx _context.Context, backupunitId string) ApiBackupunitsPutRequest { +func (a *BackupServiceApiService) BackupunitsPut(ctx _context.Context, backupunitId string) ApiBackupunitsPutRequest { return ApiBackupunitsPutRequest{ ApiService: a, ctx: ctx, @@ -984,7 +936,7 @@ func (a *BackupUnitsApiService) BackupunitsPut(ctx _context.Context, backupunitI * Execute executes the request * @return BackupUnit */ -func (a *BackupUnitsApiService) BackupunitsPutExecute(r ApiBackupunitsPutRequest) (BackupUnit, *APIResponse, error) { +func (a *BackupServiceApiService) BackupunitsPutExecute(r ApiBackupunitsPutRequest) (BackupUnit, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPut localVarPostBody interface{} @@ -994,13 +946,15 @@ func (a *BackupUnitsApiService) BackupunitsPutExecute(r ApiBackupunitsPutRequest localVarReturnValue BackupUnit ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BackupUnitsApiService.BackupunitsPut") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BackupServiceApiService.BackupunitsPut") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/backupunits/{backupunitId}" - localVarPath = strings.Replace(localVarPath, "{"+"backupunitId"+"}", _neturl.PathEscape(parameterToString(r.backupunitId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"backupunitId"+"}", _neturl.PathEscape(parameterValueToString(r.backupunitId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -1010,20 +964,10 @@ func (a *BackupUnitsApiService) BackupunitsPutExecute(r ApiBackupunitsPutRequest } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -1044,13 +988,13 @@ func (a *BackupUnitsApiService) BackupunitsPutExecute(r ApiBackupunitsPutRequest localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.backupUnit if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -1069,11 +1013,11 @@ func (a *BackupUnitsApiService) BackupunitsPutExecute(r ApiBackupunitsPutRequest localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "BackupunitsPut", } @@ -1089,28 +1033,26 @@ func (a *BackupUnitsApiService) BackupunitsPutExecute(r ApiBackupunitsPutRequest } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -1119,7 +1061,7 @@ func (a *BackupUnitsApiService) BackupunitsPutExecute(r ApiBackupunitsPutRequest type ApiBackupunitsSsourlGetRequest struct { ctx _context.Context - ApiService *BackupUnitsApiService + ApiService *BackupServiceApiService filters _neturl.Values orderBy *string maxResults *int32 @@ -1139,7 +1081,7 @@ func (r ApiBackupunitsSsourlGetRequest) XContractNumber(xContractNumber int32) A // Filters query parameters limit results to those containing a matching value for a specific property. func (r ApiBackupunitsSsourlGetRequest) Filter(key string, value string) ApiBackupunitsSsourlGetRequest { - filterKey := fmt.Sprintf(FilterQueryParam, key) + filterKey := fmt.Sprintf("filter.%s", key) r.filters[filterKey] = append(r.filters[filterKey], value) return r } @@ -1156,7 +1098,7 @@ func (r ApiBackupunitsSsourlGetRequest) MaxResults(maxResults int32) ApiBackupun return r } -func (r ApiBackupunitsSsourlGetRequest) Execute() (BackupUnitSSO, *APIResponse, error) { +func (r ApiBackupunitsSsourlGetRequest) Execute() (BackupUnitSSO, *shared.APIResponse, error) { return r.ApiService.BackupunitsSsourlGetExecute(r) } @@ -1167,7 +1109,7 @@ func (r ApiBackupunitsSsourlGetRequest) Execute() (BackupUnitSSO, *APIResponse, * @param backupunitId The unique ID of the backup unit. * @return ApiBackupunitsSsourlGetRequest */ -func (a *BackupUnitsApiService) BackupunitsSsourlGet(ctx _context.Context, backupunitId string) ApiBackupunitsSsourlGetRequest { +func (a *BackupServiceApiService) BackupunitsSsourlGet(ctx _context.Context, backupunitId string) ApiBackupunitsSsourlGetRequest { return ApiBackupunitsSsourlGetRequest{ ApiService: a, ctx: ctx, @@ -1180,7 +1122,7 @@ func (a *BackupUnitsApiService) BackupunitsSsourlGet(ctx _context.Context, backu * Execute executes the request * @return BackupUnitSSO */ -func (a *BackupUnitsApiService) BackupunitsSsourlGetExecute(r ApiBackupunitsSsourlGetRequest) (BackupUnitSSO, *APIResponse, error) { +func (a *BackupServiceApiService) BackupunitsSsourlGetExecute(r ApiBackupunitsSsourlGetRequest) (BackupUnitSSO, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -1190,25 +1132,22 @@ func (a *BackupUnitsApiService) BackupunitsSsourlGetExecute(r ApiBackupunitsSsou localVarReturnValue BackupUnitSSO ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BackupUnitsApiService.BackupunitsSsourlGet") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BackupServiceApiService.BackupunitsSsourlGet") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/backupunits/{backupunitId}/ssourl" - localVarPath = strings.Replace(localVarPath, "{"+"backupunitId"+"}", _neturl.PathEscape(parameterToString(r.backupunitId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"backupunitId"+"}", _neturl.PathEscape(parameterValueToString(r.backupunitId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.orderBy != nil { localVarQueryParams.Add("orderBy", parameterToString(*r.orderBy, "")) @@ -1242,11 +1181,11 @@ func (a *BackupUnitsApiService) BackupunitsSsourlGetExecute(r ApiBackupunitsSsou localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -1265,11 +1204,11 @@ func (a *BackupUnitsApiService) BackupunitsSsourlGetExecute(r ApiBackupunitsSsou localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "BackupunitsSsourlGet", } @@ -1285,28 +1224,26 @@ func (a *BackupUnitsApiService) BackupunitsSsourlGetExecute(r ApiBackupunitsSsou } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/api_contract_resources.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/api_contract_resources.go similarity index 81% rename from vendor/github.com/ionos-cloud/sdk-go/v6/api_contract_resources.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/api_contract_resources.go index d962511e0..6aaaca43e 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/api_contract_resources.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/api_contract_resources.go @@ -13,6 +13,7 @@ package ionoscloud import ( _context "context" "fmt" + "github.com/ionos-cloud/sdk-go-bundle/shared" "io" _nethttp "net/http" _neturl "net/url" @@ -52,7 +53,7 @@ func (r ApiContractsGetRequest) XContractNumber(xContractNumber int32) ApiContra // Filters query parameters limit results to those containing a matching value for a specific property. func (r ApiContractsGetRequest) Filter(key string, value string) ApiContractsGetRequest { - filterKey := fmt.Sprintf(FilterQueryParam, key) + filterKey := fmt.Sprintf("filter.%s", key) r.filters[filterKey] = append(r.filters[filterKey], value) return r } @@ -69,7 +70,7 @@ func (r ApiContractsGetRequest) MaxResults(maxResults int32) ApiContractsGetRequ return r } -func (r ApiContractsGetRequest) Execute() (Contracts, *APIResponse, error) { +func (r ApiContractsGetRequest) Execute() (Contracts, *shared.APIResponse, error) { return r.ApiService.ContractsGetExecute(r) } @@ -91,7 +92,7 @@ func (a *ContractResourcesApiService) ContractsGet(ctx _context.Context) ApiCont * Execute executes the request * @return Contracts */ -func (a *ContractResourcesApiService) ContractsGetExecute(r ApiContractsGetRequest) (Contracts, *APIResponse, error) { +func (a *ContractResourcesApiService) ContractsGetExecute(r ApiContractsGetRequest) (Contracts, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -103,7 +104,9 @@ func (a *ContractResourcesApiService) ContractsGetExecute(r ApiContractsGetReque localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ContractResourcesApiService.ContractsGet") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/contracts" @@ -113,20 +116,10 @@ func (a *ContractResourcesApiService) ContractsGetExecute(r ApiContractsGetReque localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } if r.orderBy != nil { localVarQueryParams.Add("orderBy", parameterToString(*r.orderBy, "")) @@ -160,11 +153,11 @@ func (a *ContractResourcesApiService) ContractsGetExecute(r ApiContractsGetReque localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -183,11 +176,11 @@ func (a *ContractResourcesApiService) ContractsGetExecute(r ApiContractsGetReque localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "ContractsGet", } @@ -203,28 +196,26 @@ func (a *ContractResourcesApiService) ContractsGetExecute(r ApiContractsGetReque } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/api_private_cross_connects.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/api_cross_connects.go similarity index 70% rename from vendor/github.com/ionos-cloud/sdk-go/v6/api_private_cross_connects.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/api_cross_connects.go index fe6ed0135..29f475a66 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/api_private_cross_connects.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/api_cross_connects.go @@ -13,6 +13,7 @@ package ionoscloud import ( _context "context" "fmt" + "github.com/ionos-cloud/sdk-go-bundle/shared" "io" _nethttp "net/http" _neturl "net/url" @@ -24,12 +25,12 @@ var ( _ _context.Context ) -// PrivateCrossConnectsApiService PrivateCrossConnectsApi service -type PrivateCrossConnectsApiService service +// CrossConnectsApiService CrossConnectsApi service +type CrossConnectsApiService service type ApiPccsDeleteRequest struct { ctx _context.Context - ApiService *PrivateCrossConnectsApiService + ApiService *CrossConnectsApiService pccId string pretty *bool depth *int32 @@ -49,18 +50,18 @@ func (r ApiPccsDeleteRequest) XContractNumber(xContractNumber int32) ApiPccsDele return r } -func (r ApiPccsDeleteRequest) Execute() (*APIResponse, error) { +func (r ApiPccsDeleteRequest) Execute() (*shared.APIResponse, error) { return r.ApiService.PccsDeleteExecute(r) } /* - * PccsDelete Delete Private Cross-Connects + * PccsDelete Delete Cross Connects * Remove the specified Cross Connect. Cross connect can be deleted only if it is not connected to any LANs. For non administrator users a cross connect can be deleted only if you are granted access via the user groups you are member of. * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param pccId The unique ID of the Cross Connect. * @return ApiPccsDeleteRequest */ -func (a *PrivateCrossConnectsApiService) PccsDelete(ctx _context.Context, pccId string) ApiPccsDeleteRequest { +func (a *CrossConnectsApiService) PccsDelete(ctx _context.Context, pccId string) ApiPccsDeleteRequest { return ApiPccsDeleteRequest{ ApiService: a, ctx: ctx, @@ -71,7 +72,7 @@ func (a *PrivateCrossConnectsApiService) PccsDelete(ctx _context.Context, pccId /* * Execute executes the request */ -func (a *PrivateCrossConnectsApiService) PccsDeleteExecute(r ApiPccsDeleteRequest) (*APIResponse, error) { +func (a *CrossConnectsApiService) PccsDeleteExecute(r ApiPccsDeleteRequest) (*shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodDelete localVarPostBody interface{} @@ -80,33 +81,25 @@ func (a *PrivateCrossConnectsApiService) PccsDeleteExecute(r ApiPccsDeleteReques localVarFileBytes []byte ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PrivateCrossConnectsApiService.PccsDelete") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "CrossConnectsApiService.PccsDelete") if err != nil { - return nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return nil, gerr } localVarPath := localBasePath + "/pccs/{pccId}" - localVarPath = strings.Replace(localVarPath, "{"+"pccId"+"}", _neturl.PathEscape(parameterToString(r.pccId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pccId"+"}", _neturl.PathEscape(parameterValueToString(r.pccId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -127,11 +120,11 @@ func (a *PrivateCrossConnectsApiService) PccsDeleteExecute(r ApiPccsDeleteReques localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -150,11 +143,11 @@ func (a *PrivateCrossConnectsApiService) PccsDeleteExecute(r ApiPccsDeleteReques localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "PccsDelete", } @@ -170,18 +163,17 @@ func (a *PrivateCrossConnectsApiService) PccsDeleteExecute(r ApiPccsDeleteReques } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarAPIResponse, newErr } @@ -190,7 +182,7 @@ func (a *PrivateCrossConnectsApiService) PccsDeleteExecute(r ApiPccsDeleteReques type ApiPccsFindByIdRequest struct { ctx _context.Context - ApiService *PrivateCrossConnectsApiService + ApiService *CrossConnectsApiService pccId string pretty *bool depth *int32 @@ -210,18 +202,18 @@ func (r ApiPccsFindByIdRequest) XContractNumber(xContractNumber int32) ApiPccsFi return r } -func (r ApiPccsFindByIdRequest) Execute() (PrivateCrossConnect, *APIResponse, error) { +func (r ApiPccsFindByIdRequest) Execute() (PrivateCrossConnect, *shared.APIResponse, error) { return r.ApiService.PccsFindByIdExecute(r) } /* * PccsFindById Retrieve a Cross Connect - * Retrieve a Cross Connect by the resource ID. Cross Connect ID is in the response body when the Cross Connect is created and in the list of Private Cross-Connects, returned by GET. For contract owner and administrators all Private Cross-Connects in your contract can be retrieved. For non administrator users it only returns the cross connects you are granted access via the user groups you are member of. + * Retrieve a Cross Connect by the resource ID. Cross Connect ID is in the response body when the Cross Connect is created and in the list of Cross Connects, returned by GET. For contract owner and administrators all cross connects in your contract can be retrieved. For non administrator users it only returns the cross connects you are granted access via the user groups you are member of. * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param pccId The unique ID of the Cross Connect. * @return ApiPccsFindByIdRequest */ -func (a *PrivateCrossConnectsApiService) PccsFindById(ctx _context.Context, pccId string) ApiPccsFindByIdRequest { +func (a *CrossConnectsApiService) PccsFindById(ctx _context.Context, pccId string) ApiPccsFindByIdRequest { return ApiPccsFindByIdRequest{ ApiService: a, ctx: ctx, @@ -233,7 +225,7 @@ func (a *PrivateCrossConnectsApiService) PccsFindById(ctx _context.Context, pccI * Execute executes the request * @return PrivateCrossConnect */ -func (a *PrivateCrossConnectsApiService) PccsFindByIdExecute(r ApiPccsFindByIdRequest) (PrivateCrossConnect, *APIResponse, error) { +func (a *CrossConnectsApiService) PccsFindByIdExecute(r ApiPccsFindByIdRequest) (PrivateCrossConnect, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -243,33 +235,25 @@ func (a *PrivateCrossConnectsApiService) PccsFindByIdExecute(r ApiPccsFindByIdRe localVarReturnValue PrivateCrossConnect ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PrivateCrossConnectsApiService.PccsFindById") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "CrossConnectsApiService.PccsFindById") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/pccs/{pccId}" - localVarPath = strings.Replace(localVarPath, "{"+"pccId"+"}", _neturl.PathEscape(parameterToString(r.pccId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pccId"+"}", _neturl.PathEscape(parameterValueToString(r.pccId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -290,11 +274,11 @@ func (a *PrivateCrossConnectsApiService) PccsFindByIdExecute(r ApiPccsFindByIdRe localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -313,11 +297,11 @@ func (a *PrivateCrossConnectsApiService) PccsFindByIdExecute(r ApiPccsFindByIdRe localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "PccsFindById", } @@ -333,28 +317,26 @@ func (a *PrivateCrossConnectsApiService) PccsFindByIdExecute(r ApiPccsFindByIdRe } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -363,7 +345,7 @@ func (a *PrivateCrossConnectsApiService) PccsFindByIdExecute(r ApiPccsFindByIdRe type ApiPccsGetRequest struct { ctx _context.Context - ApiService *PrivateCrossConnectsApiService + ApiService *CrossConnectsApiService filters _neturl.Values orderBy *string maxResults *int32 @@ -387,7 +369,7 @@ func (r ApiPccsGetRequest) XContractNumber(xContractNumber int32) ApiPccsGetRequ // Filters query parameters limit results to those containing a matching value for a specific property. func (r ApiPccsGetRequest) Filter(key string, value string) ApiPccsGetRequest { - filterKey := fmt.Sprintf(FilterQueryParam, key) + filterKey := fmt.Sprintf("filter.%s", key) r.filters[filterKey] = append(r.filters[filterKey], value) return r } @@ -404,17 +386,17 @@ func (r ApiPccsGetRequest) MaxResults(maxResults int32) ApiPccsGetRequest { return r } -func (r ApiPccsGetRequest) Execute() (PrivateCrossConnects, *APIResponse, error) { +func (r ApiPccsGetRequest) Execute() (PrivateCrossConnects, *shared.APIResponse, error) { return r.ApiService.PccsGetExecute(r) } /* - * PccsGet List Private Cross-Connects - * List all Private Cross-Connects. For contract owner and administrators it returns all Private Cross-Connects in your contract. For non administrator users it only returns the Private Cross-Connects you are granted access via the user groups you are member of. + * PccsGet List Cross Connects + * List all Cross Connects. For contract owner and administrators it returns all cross connects in your contract. For non administrator users it only returns the cross connects you are granted access via the user groups you are member of. * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @return ApiPccsGetRequest */ -func (a *PrivateCrossConnectsApiService) PccsGet(ctx _context.Context) ApiPccsGetRequest { +func (a *CrossConnectsApiService) PccsGet(ctx _context.Context) ApiPccsGetRequest { return ApiPccsGetRequest{ ApiService: a, ctx: ctx, @@ -426,7 +408,7 @@ func (a *PrivateCrossConnectsApiService) PccsGet(ctx _context.Context) ApiPccsGe * Execute executes the request * @return PrivateCrossConnects */ -func (a *PrivateCrossConnectsApiService) PccsGetExecute(r ApiPccsGetRequest) (PrivateCrossConnects, *APIResponse, error) { +func (a *CrossConnectsApiService) PccsGetExecute(r ApiPccsGetRequest) (PrivateCrossConnects, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -436,9 +418,11 @@ func (a *PrivateCrossConnectsApiService) PccsGetExecute(r ApiPccsGetRequest) (Pr localVarReturnValue PrivateCrossConnects ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PrivateCrossConnectsApiService.PccsGet") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "CrossConnectsApiService.PccsGet") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/pccs" @@ -448,20 +432,10 @@ func (a *PrivateCrossConnectsApiService) PccsGetExecute(r ApiPccsGetRequest) (Pr localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } if r.orderBy != nil { localVarQueryParams.Add("orderBy", parameterToString(*r.orderBy, "")) @@ -495,11 +469,11 @@ func (a *PrivateCrossConnectsApiService) PccsGetExecute(r ApiPccsGetRequest) (Pr localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -518,11 +492,11 @@ func (a *PrivateCrossConnectsApiService) PccsGetExecute(r ApiPccsGetRequest) (Pr localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "PccsGet", } @@ -538,28 +512,26 @@ func (a *PrivateCrossConnectsApiService) PccsGetExecute(r ApiPccsGetRequest) (Pr } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -568,7 +540,7 @@ func (a *PrivateCrossConnectsApiService) PccsGetExecute(r ApiPccsGetRequest) (Pr type ApiPccsPatchRequest struct { ctx _context.Context - ApiService *PrivateCrossConnectsApiService + ApiService *CrossConnectsApiService pccId string pcc *PrivateCrossConnectProperties pretty *bool @@ -593,18 +565,18 @@ func (r ApiPccsPatchRequest) XContractNumber(xContractNumber int32) ApiPccsPatch return r } -func (r ApiPccsPatchRequest) Execute() (PrivateCrossConnect, *APIResponse, error) { +func (r ApiPccsPatchRequest) Execute() (PrivateCrossConnect, *shared.APIResponse, error) { return r.ApiService.PccsPatchExecute(r) } /* - * PccsPatch Partially modify a Private Cross-Connects - * Update the properties of the specified Cross Connect.For non administrator users you can only update the Private Cross-Connects you are granted access via the user groups you are member of + * PccsPatch Partially modify a Cross Connects + * Update the properties of the specified Cross Connect.For non administrator users you can only update the cross connects you are granted access via the user groups you are member of * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param pccId The unique ID of the Cross Connect. * @return ApiPccsPatchRequest */ -func (a *PrivateCrossConnectsApiService) PccsPatch(ctx _context.Context, pccId string) ApiPccsPatchRequest { +func (a *CrossConnectsApiService) PccsPatch(ctx _context.Context, pccId string) ApiPccsPatchRequest { return ApiPccsPatchRequest{ ApiService: a, ctx: ctx, @@ -616,7 +588,7 @@ func (a *PrivateCrossConnectsApiService) PccsPatch(ctx _context.Context, pccId s * Execute executes the request * @return PrivateCrossConnect */ -func (a *PrivateCrossConnectsApiService) PccsPatchExecute(r ApiPccsPatchRequest) (PrivateCrossConnect, *APIResponse, error) { +func (a *CrossConnectsApiService) PccsPatchExecute(r ApiPccsPatchRequest) (PrivateCrossConnect, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPatch localVarPostBody interface{} @@ -626,13 +598,15 @@ func (a *PrivateCrossConnectsApiService) PccsPatchExecute(r ApiPccsPatchRequest) localVarReturnValue PrivateCrossConnect ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PrivateCrossConnectsApiService.PccsPatch") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "CrossConnectsApiService.PccsPatch") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/pccs/{pccId}" - localVarPath = strings.Replace(localVarPath, "{"+"pccId"+"}", _neturl.PathEscape(parameterToString(r.pccId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"pccId"+"}", _neturl.PathEscape(parameterValueToString(r.pccId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -642,20 +616,10 @@ func (a *PrivateCrossConnectsApiService) PccsPatchExecute(r ApiPccsPatchRequest) } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -676,13 +640,13 @@ func (a *PrivateCrossConnectsApiService) PccsPatchExecute(r ApiPccsPatchRequest) localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.pcc if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -701,11 +665,11 @@ func (a *PrivateCrossConnectsApiService) PccsPatchExecute(r ApiPccsPatchRequest) localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "PccsPatch", } @@ -721,28 +685,26 @@ func (a *PrivateCrossConnectsApiService) PccsPatchExecute(r ApiPccsPatchRequest) } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -751,7 +713,7 @@ func (a *PrivateCrossConnectsApiService) PccsPatchExecute(r ApiPccsPatchRequest) type ApiPccsPostRequest struct { ctx _context.Context - ApiService *PrivateCrossConnectsApiService + ApiService *CrossConnectsApiService pcc *PrivateCrossConnect pretty *bool depth *int32 @@ -775,7 +737,7 @@ func (r ApiPccsPostRequest) XContractNumber(xContractNumber int32) ApiPccsPostRe return r } -func (r ApiPccsPostRequest) Execute() (PrivateCrossConnect, *APIResponse, error) { +func (r ApiPccsPostRequest) Execute() (PrivateCrossConnect, *shared.APIResponse, error) { return r.ApiService.PccsPostExecute(r) } @@ -785,7 +747,7 @@ func (r ApiPccsPostRequest) Execute() (PrivateCrossConnect, *APIResponse, error) * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @return ApiPccsPostRequest */ -func (a *PrivateCrossConnectsApiService) PccsPost(ctx _context.Context) ApiPccsPostRequest { +func (a *CrossConnectsApiService) PccsPost(ctx _context.Context) ApiPccsPostRequest { return ApiPccsPostRequest{ ApiService: a, ctx: ctx, @@ -796,7 +758,7 @@ func (a *PrivateCrossConnectsApiService) PccsPost(ctx _context.Context) ApiPccsP * Execute executes the request * @return PrivateCrossConnect */ -func (a *PrivateCrossConnectsApiService) PccsPostExecute(r ApiPccsPostRequest) (PrivateCrossConnect, *APIResponse, error) { +func (a *CrossConnectsApiService) PccsPostExecute(r ApiPccsPostRequest) (PrivateCrossConnect, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -806,9 +768,11 @@ func (a *PrivateCrossConnectsApiService) PccsPostExecute(r ApiPccsPostRequest) ( localVarReturnValue PrivateCrossConnect ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PrivateCrossConnectsApiService.PccsPost") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "CrossConnectsApiService.PccsPost") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/pccs" @@ -821,20 +785,10 @@ func (a *PrivateCrossConnectsApiService) PccsPostExecute(r ApiPccsPostRequest) ( } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -855,13 +809,13 @@ func (a *PrivateCrossConnectsApiService) PccsPostExecute(r ApiPccsPostRequest) ( localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.pcc if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -880,11 +834,11 @@ func (a *PrivateCrossConnectsApiService) PccsPostExecute(r ApiPccsPostRequest) ( localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "PccsPost", } @@ -900,28 +854,26 @@ func (a *PrivateCrossConnectsApiService) PccsPostExecute(r ApiPccsPostRequest) ( } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/api_data_centers.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/api_data_centers.go similarity index 76% rename from vendor/github.com/ionos-cloud/sdk-go/v6/api_data_centers.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/api_data_centers.go index fb5ddafda..f75ccb9bf 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/api_data_centers.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/api_data_centers.go @@ -13,6 +13,7 @@ package ionoscloud import ( _context "context" "fmt" + "github.com/ionos-cloud/sdk-go-bundle/shared" "io" _nethttp "net/http" _neturl "net/url" @@ -49,7 +50,7 @@ func (r ApiDatacentersDeleteRequest) XContractNumber(xContractNumber int32) ApiD return r } -func (r ApiDatacentersDeleteRequest) Execute() (*APIResponse, error) { +func (r ApiDatacentersDeleteRequest) Execute() (*shared.APIResponse, error) { return r.ApiService.DatacentersDeleteExecute(r) } @@ -71,7 +72,7 @@ func (a *DataCentersApiService) DatacentersDelete(ctx _context.Context, datacent /* * Execute executes the request */ -func (a *DataCentersApiService) DatacentersDeleteExecute(r ApiDatacentersDeleteRequest) (*APIResponse, error) { +func (a *DataCentersApiService) DatacentersDeleteExecute(r ApiDatacentersDeleteRequest) (*shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodDelete localVarPostBody interface{} @@ -82,31 +83,23 @@ func (a *DataCentersApiService) DatacentersDeleteExecute(r ApiDatacentersDeleteR localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DataCentersApiService.DatacentersDelete") if err != nil { - return nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -127,11 +120,11 @@ func (a *DataCentersApiService) DatacentersDeleteExecute(r ApiDatacentersDeleteR localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -150,11 +143,11 @@ func (a *DataCentersApiService) DatacentersDeleteExecute(r ApiDatacentersDeleteR localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersDelete", } @@ -170,18 +163,17 @@ func (a *DataCentersApiService) DatacentersDeleteExecute(r ApiDatacentersDeleteR } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarAPIResponse, newErr } @@ -210,7 +202,7 @@ func (r ApiDatacentersFindByIdRequest) XContractNumber(xContractNumber int32) Ap return r } -func (r ApiDatacentersFindByIdRequest) Execute() (Datacenter, *APIResponse, error) { +func (r ApiDatacentersFindByIdRequest) Execute() (Datacenter, *shared.APIResponse, error) { return r.ApiService.DatacentersFindByIdExecute(r) } @@ -233,7 +225,7 @@ func (a *DataCentersApiService) DatacentersFindById(ctx _context.Context, datace * Execute executes the request * @return Datacenter */ -func (a *DataCentersApiService) DatacentersFindByIdExecute(r ApiDatacentersFindByIdRequest) (Datacenter, *APIResponse, error) { +func (a *DataCentersApiService) DatacentersFindByIdExecute(r ApiDatacentersFindByIdRequest) (Datacenter, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -245,31 +237,23 @@ func (a *DataCentersApiService) DatacentersFindByIdExecute(r ApiDatacentersFindB localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DataCentersApiService.DatacentersFindById") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -290,11 +274,11 @@ func (a *DataCentersApiService) DatacentersFindByIdExecute(r ApiDatacentersFindB localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -313,11 +297,11 @@ func (a *DataCentersApiService) DatacentersFindByIdExecute(r ApiDatacentersFindB localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersFindById", } @@ -333,28 +317,26 @@ func (a *DataCentersApiService) DatacentersFindByIdExecute(r ApiDatacentersFindB } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -397,7 +379,7 @@ func (r ApiDatacentersGetRequest) Limit(limit int32) ApiDatacentersGetRequest { // Filters query parameters limit results to those containing a matching value for a specific property. func (r ApiDatacentersGetRequest) Filter(key string, value string) ApiDatacentersGetRequest { - filterKey := fmt.Sprintf(FilterQueryParam, key) + filterKey := fmt.Sprintf("filter.%s", key) r.filters[filterKey] = append(r.filters[filterKey], value) return r } @@ -414,7 +396,7 @@ func (r ApiDatacentersGetRequest) MaxResults(maxResults int32) ApiDatacentersGet return r } -func (r ApiDatacentersGetRequest) Execute() (Datacenters, *APIResponse, error) { +func (r ApiDatacentersGetRequest) Execute() (Datacenters, *shared.APIResponse, error) { return r.ApiService.DatacentersGetExecute(r) } @@ -436,7 +418,7 @@ func (a *DataCentersApiService) DatacentersGet(ctx _context.Context) ApiDatacent * Execute executes the request * @return Datacenters */ -func (a *DataCentersApiService) DatacentersGetExecute(r ApiDatacentersGetRequest) (Datacenters, *APIResponse, error) { +func (a *DataCentersApiService) DatacentersGetExecute(r ApiDatacentersGetRequest) (Datacenters, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -448,7 +430,9 @@ func (a *DataCentersApiService) DatacentersGetExecute(r ApiDatacentersGetRequest localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DataCentersApiService.DatacentersGet") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters" @@ -458,36 +442,16 @@ func (a *DataCentersApiService) DatacentersGetExecute(r ApiDatacentersGetRequest localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } if r.offset != nil { - localVarQueryParams.Add("offset", parameterToString(*r.offset, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("offset") - if defaultQueryParam == "" { - localVarQueryParams.Add("offset", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "offset", r.offset, "") } if r.limit != nil { - localVarQueryParams.Add("limit", parameterToString(*r.limit, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("limit") - if defaultQueryParam == "" { - localVarQueryParams.Add("limit", parameterToString(1000, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "") } if r.orderBy != nil { localVarQueryParams.Add("orderBy", parameterToString(*r.orderBy, "")) @@ -521,11 +485,11 @@ func (a *DataCentersApiService) DatacentersGetExecute(r ApiDatacentersGetRequest localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -544,11 +508,11 @@ func (a *DataCentersApiService) DatacentersGetExecute(r ApiDatacentersGetRequest localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersGet", } @@ -564,28 +528,26 @@ func (a *DataCentersApiService) DatacentersGetExecute(r ApiDatacentersGetRequest } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -619,7 +581,7 @@ func (r ApiDatacentersPatchRequest) XContractNumber(xContractNumber int32) ApiDa return r } -func (r ApiDatacentersPatchRequest) Execute() (Datacenter, *APIResponse, error) { +func (r ApiDatacentersPatchRequest) Execute() (Datacenter, *shared.APIResponse, error) { return r.ApiService.DatacentersPatchExecute(r) } @@ -642,7 +604,7 @@ func (a *DataCentersApiService) DatacentersPatch(ctx _context.Context, datacente * Execute executes the request * @return Datacenter */ -func (a *DataCentersApiService) DatacentersPatchExecute(r ApiDatacentersPatchRequest) (Datacenter, *APIResponse, error) { +func (a *DataCentersApiService) DatacentersPatchExecute(r ApiDatacentersPatchRequest) (Datacenter, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPatch localVarPostBody interface{} @@ -654,11 +616,13 @@ func (a *DataCentersApiService) DatacentersPatchExecute(r ApiDatacentersPatchReq localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DataCentersApiService.DatacentersPatch") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -668,20 +632,10 @@ func (a *DataCentersApiService) DatacentersPatchExecute(r ApiDatacentersPatchReq } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -702,13 +656,13 @@ func (a *DataCentersApiService) DatacentersPatchExecute(r ApiDatacentersPatchReq localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.datacenter if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -727,11 +681,11 @@ func (a *DataCentersApiService) DatacentersPatchExecute(r ApiDatacentersPatchReq localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersPatch", } @@ -747,28 +701,26 @@ func (a *DataCentersApiService) DatacentersPatchExecute(r ApiDatacentersPatchReq } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -801,7 +753,7 @@ func (r ApiDatacentersPostRequest) XContractNumber(xContractNumber int32) ApiDat return r } -func (r ApiDatacentersPostRequest) Execute() (Datacenter, *APIResponse, error) { +func (r ApiDatacentersPostRequest) Execute() (Datacenter, *shared.APIResponse, error) { return r.ApiService.DatacentersPostExecute(r) } @@ -824,7 +776,7 @@ func (a *DataCentersApiService) DatacentersPost(ctx _context.Context) ApiDatacen * Execute executes the request * @return Datacenter */ -func (a *DataCentersApiService) DatacentersPostExecute(r ApiDatacentersPostRequest) (Datacenter, *APIResponse, error) { +func (a *DataCentersApiService) DatacentersPostExecute(r ApiDatacentersPostRequest) (Datacenter, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -836,7 +788,9 @@ func (a *DataCentersApiService) DatacentersPostExecute(r ApiDatacentersPostReque localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DataCentersApiService.DatacentersPost") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters" @@ -849,20 +803,10 @@ func (a *DataCentersApiService) DatacentersPostExecute(r ApiDatacentersPostReque } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -883,13 +827,13 @@ func (a *DataCentersApiService) DatacentersPostExecute(r ApiDatacentersPostReque localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.datacenter if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -908,11 +852,11 @@ func (a *DataCentersApiService) DatacentersPostExecute(r ApiDatacentersPostReque localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersPost", } @@ -928,28 +872,26 @@ func (a *DataCentersApiService) DatacentersPostExecute(r ApiDatacentersPostReque } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -983,7 +925,7 @@ func (r ApiDatacentersPutRequest) XContractNumber(xContractNumber int32) ApiData return r } -func (r ApiDatacentersPutRequest) Execute() (Datacenter, *APIResponse, error) { +func (r ApiDatacentersPutRequest) Execute() (Datacenter, *shared.APIResponse, error) { return r.ApiService.DatacentersPutExecute(r) } @@ -1006,7 +948,7 @@ func (a *DataCentersApiService) DatacentersPut(ctx _context.Context, datacenterI * Execute executes the request * @return Datacenter */ -func (a *DataCentersApiService) DatacentersPutExecute(r ApiDatacentersPutRequest) (Datacenter, *APIResponse, error) { +func (a *DataCentersApiService) DatacentersPutExecute(r ApiDatacentersPutRequest) (Datacenter, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPut localVarPostBody interface{} @@ -1018,11 +960,13 @@ func (a *DataCentersApiService) DatacentersPutExecute(r ApiDatacentersPutRequest localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DataCentersApiService.DatacentersPut") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -1032,20 +976,10 @@ func (a *DataCentersApiService) DatacentersPutExecute(r ApiDatacentersPutRequest } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -1066,13 +1000,13 @@ func (a *DataCentersApiService) DatacentersPutExecute(r ApiDatacentersPutRequest localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.datacenter if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -1091,11 +1025,11 @@ func (a *DataCentersApiService) DatacentersPutExecute(r ApiDatacentersPutRequest localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersPut", } @@ -1111,28 +1045,26 @@ func (a *DataCentersApiService) DatacentersPutExecute(r ApiDatacentersPutRequest } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/api_firewall_rules.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/api_firewall_rules.go similarity index 78% rename from vendor/github.com/ionos-cloud/sdk-go/v6/api_firewall_rules.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/api_firewall_rules.go index ca532a992..9a1874c31 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/api_firewall_rules.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/api_firewall_rules.go @@ -13,6 +13,7 @@ package ionoscloud import ( _context "context" "fmt" + "github.com/ionos-cloud/sdk-go-bundle/shared" "io" _nethttp "net/http" _neturl "net/url" @@ -52,7 +53,7 @@ func (r ApiDatacentersServersNicsFirewallrulesDeleteRequest) XContractNumber(xCo return r } -func (r ApiDatacentersServersNicsFirewallrulesDeleteRequest) Execute() (*APIResponse, error) { +func (r ApiDatacentersServersNicsFirewallrulesDeleteRequest) Execute() (*shared.APIResponse, error) { return r.ApiService.DatacentersServersNicsFirewallrulesDeleteExecute(r) } @@ -80,7 +81,7 @@ func (a *FirewallRulesApiService) DatacentersServersNicsFirewallrulesDelete(ctx /* * Execute executes the request */ -func (a *FirewallRulesApiService) DatacentersServersNicsFirewallrulesDeleteExecute(r ApiDatacentersServersNicsFirewallrulesDeleteRequest) (*APIResponse, error) { +func (a *FirewallRulesApiService) DatacentersServersNicsFirewallrulesDeleteExecute(r ApiDatacentersServersNicsFirewallrulesDeleteRequest) (*shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodDelete localVarPostBody interface{} @@ -91,34 +92,26 @@ func (a *FirewallRulesApiService) DatacentersServersNicsFirewallrulesDeleteExecu localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FirewallRulesApiService.DatacentersServersNicsFirewallrulesDelete") if err != nil { - return nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/servers/{serverId}/nics/{nicId}/firewallrules/{firewallruleId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterToString(r.serverId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"nicId"+"}", _neturl.PathEscape(parameterToString(r.nicId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"firewallruleId"+"}", _neturl.PathEscape(parameterToString(r.firewallruleId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterValueToString(r.serverId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nicId"+"}", _neturl.PathEscape(parameterValueToString(r.nicId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"firewallruleId"+"}", _neturl.PathEscape(parameterValueToString(r.firewallruleId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -139,11 +132,11 @@ func (a *FirewallRulesApiService) DatacentersServersNicsFirewallrulesDeleteExecu localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -162,11 +155,11 @@ func (a *FirewallRulesApiService) DatacentersServersNicsFirewallrulesDeleteExecu localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersServersNicsFirewallrulesDelete", } @@ -182,18 +175,17 @@ func (a *FirewallRulesApiService) DatacentersServersNicsFirewallrulesDeleteExecu } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarAPIResponse, newErr } @@ -225,7 +217,7 @@ func (r ApiDatacentersServersNicsFirewallrulesFindByIdRequest) XContractNumber(x return r } -func (r ApiDatacentersServersNicsFirewallrulesFindByIdRequest) Execute() (FirewallRule, *APIResponse, error) { +func (r ApiDatacentersServersNicsFirewallrulesFindByIdRequest) Execute() (FirewallRule, *shared.APIResponse, error) { return r.ApiService.DatacentersServersNicsFirewallrulesFindByIdExecute(r) } @@ -254,7 +246,7 @@ func (a *FirewallRulesApiService) DatacentersServersNicsFirewallrulesFindById(ct * Execute executes the request * @return FirewallRule */ -func (a *FirewallRulesApiService) DatacentersServersNicsFirewallrulesFindByIdExecute(r ApiDatacentersServersNicsFirewallrulesFindByIdRequest) (FirewallRule, *APIResponse, error) { +func (a *FirewallRulesApiService) DatacentersServersNicsFirewallrulesFindByIdExecute(r ApiDatacentersServersNicsFirewallrulesFindByIdRequest) (FirewallRule, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -266,34 +258,26 @@ func (a *FirewallRulesApiService) DatacentersServersNicsFirewallrulesFindByIdExe localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FirewallRulesApiService.DatacentersServersNicsFirewallrulesFindById") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/servers/{serverId}/nics/{nicId}/firewallrules/{firewallruleId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterToString(r.serverId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"nicId"+"}", _neturl.PathEscape(parameterToString(r.nicId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"firewallruleId"+"}", _neturl.PathEscape(parameterToString(r.firewallruleId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterValueToString(r.serverId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nicId"+"}", _neturl.PathEscape(parameterValueToString(r.nicId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"firewallruleId"+"}", _neturl.PathEscape(parameterValueToString(r.firewallruleId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -314,11 +298,11 @@ func (a *FirewallRulesApiService) DatacentersServersNicsFirewallrulesFindByIdExe localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -337,11 +321,11 @@ func (a *FirewallRulesApiService) DatacentersServersNicsFirewallrulesFindByIdExe localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersServersNicsFirewallrulesFindById", } @@ -357,28 +341,26 @@ func (a *FirewallRulesApiService) DatacentersServersNicsFirewallrulesFindByIdExe } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -424,7 +406,7 @@ func (r ApiDatacentersServersNicsFirewallrulesGetRequest) Limit(limit int32) Api // Filters query parameters limit results to those containing a matching value for a specific property. func (r ApiDatacentersServersNicsFirewallrulesGetRequest) Filter(key string, value string) ApiDatacentersServersNicsFirewallrulesGetRequest { - filterKey := fmt.Sprintf(FilterQueryParam, key) + filterKey := fmt.Sprintf("filter.%s", key) r.filters[filterKey] = append(r.filters[filterKey], value) return r } @@ -441,7 +423,7 @@ func (r ApiDatacentersServersNicsFirewallrulesGetRequest) MaxResults(maxResults return r } -func (r ApiDatacentersServersNicsFirewallrulesGetRequest) Execute() (FirewallRules, *APIResponse, error) { +func (r ApiDatacentersServersNicsFirewallrulesGetRequest) Execute() (FirewallRules, *shared.APIResponse, error) { return r.ApiService.DatacentersServersNicsFirewallrulesGetExecute(r) } @@ -469,7 +451,7 @@ func (a *FirewallRulesApiService) DatacentersServersNicsFirewallrulesGet(ctx _co * Execute executes the request * @return FirewallRules */ -func (a *FirewallRulesApiService) DatacentersServersNicsFirewallrulesGetExecute(r ApiDatacentersServersNicsFirewallrulesGetRequest) (FirewallRules, *APIResponse, error) { +func (a *FirewallRulesApiService) DatacentersServersNicsFirewallrulesGetExecute(r ApiDatacentersServersNicsFirewallrulesGetRequest) (FirewallRules, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -481,49 +463,31 @@ func (a *FirewallRulesApiService) DatacentersServersNicsFirewallrulesGetExecute( localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FirewallRulesApiService.DatacentersServersNicsFirewallrulesGet") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/servers/{serverId}/nics/{nicId}/firewallrules" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterToString(r.serverId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"nicId"+"}", _neturl.PathEscape(parameterToString(r.nicId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterValueToString(r.serverId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nicId"+"}", _neturl.PathEscape(parameterValueToString(r.nicId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } if r.offset != nil { - localVarQueryParams.Add("offset", parameterToString(*r.offset, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("offset") - if defaultQueryParam == "" { - localVarQueryParams.Add("offset", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "offset", r.offset, "") } if r.limit != nil { - localVarQueryParams.Add("limit", parameterToString(*r.limit, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("limit") - if defaultQueryParam == "" { - localVarQueryParams.Add("limit", parameterToString(1000, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "") } if r.orderBy != nil { localVarQueryParams.Add("orderBy", parameterToString(*r.orderBy, "")) @@ -557,11 +521,11 @@ func (a *FirewallRulesApiService) DatacentersServersNicsFirewallrulesGetExecute( localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -580,11 +544,11 @@ func (a *FirewallRulesApiService) DatacentersServersNicsFirewallrulesGetExecute( localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersServersNicsFirewallrulesGet", } @@ -600,28 +564,26 @@ func (a *FirewallRulesApiService) DatacentersServersNicsFirewallrulesGetExecute( } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -658,7 +620,7 @@ func (r ApiDatacentersServersNicsFirewallrulesPatchRequest) XContractNumber(xCon return r } -func (r ApiDatacentersServersNicsFirewallrulesPatchRequest) Execute() (FirewallRule, *APIResponse, error) { +func (r ApiDatacentersServersNicsFirewallrulesPatchRequest) Execute() (FirewallRule, *shared.APIResponse, error) { return r.ApiService.DatacentersServersNicsFirewallrulesPatchExecute(r) } @@ -687,7 +649,7 @@ func (a *FirewallRulesApiService) DatacentersServersNicsFirewallrulesPatch(ctx _ * Execute executes the request * @return FirewallRule */ -func (a *FirewallRulesApiService) DatacentersServersNicsFirewallrulesPatchExecute(r ApiDatacentersServersNicsFirewallrulesPatchRequest) (FirewallRule, *APIResponse, error) { +func (a *FirewallRulesApiService) DatacentersServersNicsFirewallrulesPatchExecute(r ApiDatacentersServersNicsFirewallrulesPatchRequest) (FirewallRule, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPatch localVarPostBody interface{} @@ -699,14 +661,16 @@ func (a *FirewallRulesApiService) DatacentersServersNicsFirewallrulesPatchExecut localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FirewallRulesApiService.DatacentersServersNicsFirewallrulesPatch") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/servers/{serverId}/nics/{nicId}/firewallrules/{firewallruleId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterToString(r.serverId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"nicId"+"}", _neturl.PathEscape(parameterToString(r.nicId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"firewallruleId"+"}", _neturl.PathEscape(parameterToString(r.firewallruleId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterValueToString(r.serverId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nicId"+"}", _neturl.PathEscape(parameterValueToString(r.nicId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"firewallruleId"+"}", _neturl.PathEscape(parameterValueToString(r.firewallruleId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -716,20 +680,10 @@ func (a *FirewallRulesApiService) DatacentersServersNicsFirewallrulesPatchExecut } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -750,13 +704,13 @@ func (a *FirewallRulesApiService) DatacentersServersNicsFirewallrulesPatchExecut localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.firewallrule if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -775,11 +729,11 @@ func (a *FirewallRulesApiService) DatacentersServersNicsFirewallrulesPatchExecut localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersServersNicsFirewallrulesPatch", } @@ -795,28 +749,26 @@ func (a *FirewallRulesApiService) DatacentersServersNicsFirewallrulesPatchExecut } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -852,7 +804,7 @@ func (r ApiDatacentersServersNicsFirewallrulesPostRequest) XContractNumber(xCont return r } -func (r ApiDatacentersServersNicsFirewallrulesPostRequest) Execute() (FirewallRule, *APIResponse, error) { +func (r ApiDatacentersServersNicsFirewallrulesPostRequest) Execute() (FirewallRule, *shared.APIResponse, error) { return r.ApiService.DatacentersServersNicsFirewallrulesPostExecute(r) } @@ -879,7 +831,7 @@ func (a *FirewallRulesApiService) DatacentersServersNicsFirewallrulesPost(ctx _c * Execute executes the request * @return FirewallRule */ -func (a *FirewallRulesApiService) DatacentersServersNicsFirewallrulesPostExecute(r ApiDatacentersServersNicsFirewallrulesPostRequest) (FirewallRule, *APIResponse, error) { +func (a *FirewallRulesApiService) DatacentersServersNicsFirewallrulesPostExecute(r ApiDatacentersServersNicsFirewallrulesPostRequest) (FirewallRule, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -891,13 +843,15 @@ func (a *FirewallRulesApiService) DatacentersServersNicsFirewallrulesPostExecute localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FirewallRulesApiService.DatacentersServersNicsFirewallrulesPost") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/servers/{serverId}/nics/{nicId}/firewallrules" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterToString(r.serverId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"nicId"+"}", _neturl.PathEscape(parameterToString(r.nicId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterValueToString(r.serverId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nicId"+"}", _neturl.PathEscape(parameterValueToString(r.nicId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -907,20 +861,10 @@ func (a *FirewallRulesApiService) DatacentersServersNicsFirewallrulesPostExecute } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -941,13 +885,13 @@ func (a *FirewallRulesApiService) DatacentersServersNicsFirewallrulesPostExecute localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.firewallrule if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -966,11 +910,11 @@ func (a *FirewallRulesApiService) DatacentersServersNicsFirewallrulesPostExecute localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersServersNicsFirewallrulesPost", } @@ -986,28 +930,26 @@ func (a *FirewallRulesApiService) DatacentersServersNicsFirewallrulesPostExecute } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -1044,7 +986,7 @@ func (r ApiDatacentersServersNicsFirewallrulesPutRequest) XContractNumber(xContr return r } -func (r ApiDatacentersServersNicsFirewallrulesPutRequest) Execute() (FirewallRule, *APIResponse, error) { +func (r ApiDatacentersServersNicsFirewallrulesPutRequest) Execute() (FirewallRule, *shared.APIResponse, error) { return r.ApiService.DatacentersServersNicsFirewallrulesPutExecute(r) } @@ -1073,7 +1015,7 @@ func (a *FirewallRulesApiService) DatacentersServersNicsFirewallrulesPut(ctx _co * Execute executes the request * @return FirewallRule */ -func (a *FirewallRulesApiService) DatacentersServersNicsFirewallrulesPutExecute(r ApiDatacentersServersNicsFirewallrulesPutRequest) (FirewallRule, *APIResponse, error) { +func (a *FirewallRulesApiService) DatacentersServersNicsFirewallrulesPutExecute(r ApiDatacentersServersNicsFirewallrulesPutRequest) (FirewallRule, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPut localVarPostBody interface{} @@ -1085,14 +1027,16 @@ func (a *FirewallRulesApiService) DatacentersServersNicsFirewallrulesPutExecute( localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FirewallRulesApiService.DatacentersServersNicsFirewallrulesPut") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/servers/{serverId}/nics/{nicId}/firewallrules/{firewallruleId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterToString(r.serverId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"nicId"+"}", _neturl.PathEscape(parameterToString(r.nicId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"firewallruleId"+"}", _neturl.PathEscape(parameterToString(r.firewallruleId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterValueToString(r.serverId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nicId"+"}", _neturl.PathEscape(parameterValueToString(r.nicId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"firewallruleId"+"}", _neturl.PathEscape(parameterValueToString(r.firewallruleId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -1102,20 +1046,10 @@ func (a *FirewallRulesApiService) DatacentersServersNicsFirewallrulesPutExecute( } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -1136,13 +1070,13 @@ func (a *FirewallRulesApiService) DatacentersServersNicsFirewallrulesPutExecute( localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.firewallrule if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -1161,11 +1095,11 @@ func (a *FirewallRulesApiService) DatacentersServersNicsFirewallrulesPutExecute( localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersServersNicsFirewallrulesPut", } @@ -1181,28 +1115,26 @@ func (a *FirewallRulesApiService) DatacentersServersNicsFirewallrulesPutExecute( } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/api_flow_logs.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/api_flow_logs.go similarity index 78% rename from vendor/github.com/ionos-cloud/sdk-go/v6/api_flow_logs.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/api_flow_logs.go index b37bfc2b1..f09a7f2db 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/api_flow_logs.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/api_flow_logs.go @@ -13,6 +13,7 @@ package ionoscloud import ( _context "context" "fmt" + "github.com/ionos-cloud/sdk-go-bundle/shared" "io" _nethttp "net/http" _neturl "net/url" @@ -47,7 +48,7 @@ func (r ApiDatacentersServersNicsFlowlogsDeleteRequest) Depth(depth int32) ApiDa return r } -func (r ApiDatacentersServersNicsFlowlogsDeleteRequest) Execute() (*APIResponse, error) { +func (r ApiDatacentersServersNicsFlowlogsDeleteRequest) Execute() (*shared.APIResponse, error) { return r.ApiService.DatacentersServersNicsFlowlogsDeleteExecute(r) } @@ -75,7 +76,7 @@ func (a *FlowLogsApiService) DatacentersServersNicsFlowlogsDelete(ctx _context.C /* * Execute executes the request */ -func (a *FlowLogsApiService) DatacentersServersNicsFlowlogsDeleteExecute(r ApiDatacentersServersNicsFlowlogsDeleteRequest) (*APIResponse, error) { +func (a *FlowLogsApiService) DatacentersServersNicsFlowlogsDeleteExecute(r ApiDatacentersServersNicsFlowlogsDeleteRequest) (*shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodDelete localVarPostBody interface{} @@ -86,34 +87,26 @@ func (a *FlowLogsApiService) DatacentersServersNicsFlowlogsDeleteExecute(r ApiDa localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FlowLogsApiService.DatacentersServersNicsFlowlogsDelete") if err != nil { - return nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/servers/{serverId}/nics/{nicId}/flowlogs/{flowlogId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterToString(r.serverId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"nicId"+"}", _neturl.PathEscape(parameterToString(r.nicId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"flowlogId"+"}", _neturl.PathEscape(parameterToString(r.flowlogId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterValueToString(r.serverId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nicId"+"}", _neturl.PathEscape(parameterValueToString(r.nicId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"flowlogId"+"}", _neturl.PathEscape(parameterValueToString(r.flowlogId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -135,7 +128,7 @@ func (a *FlowLogsApiService) DatacentersServersNicsFlowlogsDeleteExecute(r ApiDa } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -154,11 +147,11 @@ func (a *FlowLogsApiService) DatacentersServersNicsFlowlogsDeleteExecute(r ApiDa localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersServersNicsFlowlogsDelete", } @@ -174,18 +167,17 @@ func (a *FlowLogsApiService) DatacentersServersNicsFlowlogsDeleteExecute(r ApiDa } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarAPIResponse, newErr } @@ -212,7 +204,7 @@ func (r ApiDatacentersServersNicsFlowlogsFindByIdRequest) Depth(depth int32) Api return r } -func (r ApiDatacentersServersNicsFlowlogsFindByIdRequest) Execute() (FlowLog, *APIResponse, error) { +func (r ApiDatacentersServersNicsFlowlogsFindByIdRequest) Execute() (FlowLog, *shared.APIResponse, error) { return r.ApiService.DatacentersServersNicsFlowlogsFindByIdExecute(r) } @@ -241,7 +233,7 @@ func (a *FlowLogsApiService) DatacentersServersNicsFlowlogsFindById(ctx _context * Execute executes the request * @return FlowLog */ -func (a *FlowLogsApiService) DatacentersServersNicsFlowlogsFindByIdExecute(r ApiDatacentersServersNicsFlowlogsFindByIdRequest) (FlowLog, *APIResponse, error) { +func (a *FlowLogsApiService) DatacentersServersNicsFlowlogsFindByIdExecute(r ApiDatacentersServersNicsFlowlogsFindByIdRequest) (FlowLog, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -253,34 +245,26 @@ func (a *FlowLogsApiService) DatacentersServersNicsFlowlogsFindByIdExecute(r Api localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FlowLogsApiService.DatacentersServersNicsFlowlogsFindById") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/servers/{serverId}/nics/{nicId}/flowlogs/{flowlogId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterToString(r.serverId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"nicId"+"}", _neturl.PathEscape(parameterToString(r.nicId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"flowlogId"+"}", _neturl.PathEscape(parameterToString(r.flowlogId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterValueToString(r.serverId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nicId"+"}", _neturl.PathEscape(parameterValueToString(r.nicId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"flowlogId"+"}", _neturl.PathEscape(parameterValueToString(r.flowlogId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -302,7 +286,7 @@ func (a *FlowLogsApiService) DatacentersServersNicsFlowlogsFindByIdExecute(r Api } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -321,11 +305,11 @@ func (a *FlowLogsApiService) DatacentersServersNicsFlowlogsFindByIdExecute(r Api localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersServersNicsFlowlogsFindById", } @@ -341,28 +325,26 @@ func (a *FlowLogsApiService) DatacentersServersNicsFlowlogsFindByIdExecute(r Api } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -403,7 +385,7 @@ func (r ApiDatacentersServersNicsFlowlogsGetRequest) Limit(limit int32) ApiDatac // Filters query parameters limit results to those containing a matching value for a specific property. func (r ApiDatacentersServersNicsFlowlogsGetRequest) Filter(key string, value string) ApiDatacentersServersNicsFlowlogsGetRequest { - filterKey := fmt.Sprintf(FilterQueryParam, key) + filterKey := fmt.Sprintf("filter.%s", key) r.filters[filterKey] = append(r.filters[filterKey], value) return r } @@ -420,7 +402,7 @@ func (r ApiDatacentersServersNicsFlowlogsGetRequest) MaxResults(maxResults int32 return r } -func (r ApiDatacentersServersNicsFlowlogsGetRequest) Execute() (FlowLogs, *APIResponse, error) { +func (r ApiDatacentersServersNicsFlowlogsGetRequest) Execute() (FlowLogs, *shared.APIResponse, error) { return r.ApiService.DatacentersServersNicsFlowlogsGetExecute(r) } @@ -448,7 +430,7 @@ func (a *FlowLogsApiService) DatacentersServersNicsFlowlogsGet(ctx _context.Cont * Execute executes the request * @return FlowLogs */ -func (a *FlowLogsApiService) DatacentersServersNicsFlowlogsGetExecute(r ApiDatacentersServersNicsFlowlogsGetRequest) (FlowLogs, *APIResponse, error) { +func (a *FlowLogsApiService) DatacentersServersNicsFlowlogsGetExecute(r ApiDatacentersServersNicsFlowlogsGetRequest) (FlowLogs, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -460,49 +442,31 @@ func (a *FlowLogsApiService) DatacentersServersNicsFlowlogsGetExecute(r ApiDatac localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FlowLogsApiService.DatacentersServersNicsFlowlogsGet") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/servers/{serverId}/nics/{nicId}/flowlogs" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterToString(r.serverId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"nicId"+"}", _neturl.PathEscape(parameterToString(r.nicId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterValueToString(r.serverId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nicId"+"}", _neturl.PathEscape(parameterValueToString(r.nicId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } if r.offset != nil { - localVarQueryParams.Add("offset", parameterToString(*r.offset, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("offset") - if defaultQueryParam == "" { - localVarQueryParams.Add("offset", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "offset", r.offset, "") } if r.limit != nil { - localVarQueryParams.Add("limit", parameterToString(*r.limit, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("limit") - if defaultQueryParam == "" { - localVarQueryParams.Add("limit", parameterToString(1000, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "") } if r.orderBy != nil { localVarQueryParams.Add("orderBy", parameterToString(*r.orderBy, "")) @@ -537,7 +501,7 @@ func (a *FlowLogsApiService) DatacentersServersNicsFlowlogsGetExecute(r ApiDatac } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -556,11 +520,11 @@ func (a *FlowLogsApiService) DatacentersServersNicsFlowlogsGetExecute(r ApiDatac localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersServersNicsFlowlogsGet", } @@ -576,28 +540,26 @@ func (a *FlowLogsApiService) DatacentersServersNicsFlowlogsGetExecute(r ApiDatac } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -629,7 +591,7 @@ func (r ApiDatacentersServersNicsFlowlogsPatchRequest) Depth(depth int32) ApiDat return r } -func (r ApiDatacentersServersNicsFlowlogsPatchRequest) Execute() (FlowLog, *APIResponse, error) { +func (r ApiDatacentersServersNicsFlowlogsPatchRequest) Execute() (FlowLog, *shared.APIResponse, error) { return r.ApiService.DatacentersServersNicsFlowlogsPatchExecute(r) } @@ -658,7 +620,7 @@ func (a *FlowLogsApiService) DatacentersServersNicsFlowlogsPatch(ctx _context.Co * Execute executes the request * @return FlowLog */ -func (a *FlowLogsApiService) DatacentersServersNicsFlowlogsPatchExecute(r ApiDatacentersServersNicsFlowlogsPatchRequest) (FlowLog, *APIResponse, error) { +func (a *FlowLogsApiService) DatacentersServersNicsFlowlogsPatchExecute(r ApiDatacentersServersNicsFlowlogsPatchRequest) (FlowLog, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPatch localVarPostBody interface{} @@ -670,14 +632,16 @@ func (a *FlowLogsApiService) DatacentersServersNicsFlowlogsPatchExecute(r ApiDat localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FlowLogsApiService.DatacentersServersNicsFlowlogsPatch") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/servers/{serverId}/nics/{nicId}/flowlogs/{flowlogId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterToString(r.serverId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"nicId"+"}", _neturl.PathEscape(parameterToString(r.nicId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"flowlogId"+"}", _neturl.PathEscape(parameterToString(r.flowlogId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterValueToString(r.serverId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nicId"+"}", _neturl.PathEscape(parameterValueToString(r.nicId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"flowlogId"+"}", _neturl.PathEscape(parameterValueToString(r.flowlogId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -687,20 +651,10 @@ func (a *FlowLogsApiService) DatacentersServersNicsFlowlogsPatchExecute(r ApiDat } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -724,7 +678,7 @@ func (a *FlowLogsApiService) DatacentersServersNicsFlowlogsPatchExecute(r ApiDat localVarPostBody = r.flowlog if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -743,11 +697,11 @@ func (a *FlowLogsApiService) DatacentersServersNicsFlowlogsPatchExecute(r ApiDat localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersServersNicsFlowlogsPatch", } @@ -763,28 +717,26 @@ func (a *FlowLogsApiService) DatacentersServersNicsFlowlogsPatchExecute(r ApiDat } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -815,7 +767,7 @@ func (r ApiDatacentersServersNicsFlowlogsPostRequest) Depth(depth int32) ApiData return r } -func (r ApiDatacentersServersNicsFlowlogsPostRequest) Execute() (FlowLog, *APIResponse, error) { +func (r ApiDatacentersServersNicsFlowlogsPostRequest) Execute() (FlowLog, *shared.APIResponse, error) { return r.ApiService.DatacentersServersNicsFlowlogsPostExecute(r) } @@ -842,7 +794,7 @@ func (a *FlowLogsApiService) DatacentersServersNicsFlowlogsPost(ctx _context.Con * Execute executes the request * @return FlowLog */ -func (a *FlowLogsApiService) DatacentersServersNicsFlowlogsPostExecute(r ApiDatacentersServersNicsFlowlogsPostRequest) (FlowLog, *APIResponse, error) { +func (a *FlowLogsApiService) DatacentersServersNicsFlowlogsPostExecute(r ApiDatacentersServersNicsFlowlogsPostRequest) (FlowLog, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -854,13 +806,15 @@ func (a *FlowLogsApiService) DatacentersServersNicsFlowlogsPostExecute(r ApiData localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FlowLogsApiService.DatacentersServersNicsFlowlogsPost") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/servers/{serverId}/nics/{nicId}/flowlogs" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterToString(r.serverId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"nicId"+"}", _neturl.PathEscape(parameterToString(r.nicId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterValueToString(r.serverId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nicId"+"}", _neturl.PathEscape(parameterValueToString(r.nicId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -870,20 +824,10 @@ func (a *FlowLogsApiService) DatacentersServersNicsFlowlogsPostExecute(r ApiData } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -907,7 +851,7 @@ func (a *FlowLogsApiService) DatacentersServersNicsFlowlogsPostExecute(r ApiData localVarPostBody = r.flowlog if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -926,11 +870,11 @@ func (a *FlowLogsApiService) DatacentersServersNicsFlowlogsPostExecute(r ApiData localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersServersNicsFlowlogsPost", } @@ -946,28 +890,26 @@ func (a *FlowLogsApiService) DatacentersServersNicsFlowlogsPostExecute(r ApiData } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -999,7 +941,7 @@ func (r ApiDatacentersServersNicsFlowlogsPutRequest) Depth(depth int32) ApiDatac return r } -func (r ApiDatacentersServersNicsFlowlogsPutRequest) Execute() (FlowLog, *APIResponse, error) { +func (r ApiDatacentersServersNicsFlowlogsPutRequest) Execute() (FlowLog, *shared.APIResponse, error) { return r.ApiService.DatacentersServersNicsFlowlogsPutExecute(r) } @@ -1028,7 +970,7 @@ func (a *FlowLogsApiService) DatacentersServersNicsFlowlogsPut(ctx _context.Cont * Execute executes the request * @return FlowLog */ -func (a *FlowLogsApiService) DatacentersServersNicsFlowlogsPutExecute(r ApiDatacentersServersNicsFlowlogsPutRequest) (FlowLog, *APIResponse, error) { +func (a *FlowLogsApiService) DatacentersServersNicsFlowlogsPutExecute(r ApiDatacentersServersNicsFlowlogsPutRequest) (FlowLog, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPut localVarPostBody interface{} @@ -1040,14 +982,16 @@ func (a *FlowLogsApiService) DatacentersServersNicsFlowlogsPutExecute(r ApiDatac localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FlowLogsApiService.DatacentersServersNicsFlowlogsPut") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/servers/{serverId}/nics/{nicId}/flowlogs/{flowlogId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterToString(r.serverId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"nicId"+"}", _neturl.PathEscape(parameterToString(r.nicId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"flowlogId"+"}", _neturl.PathEscape(parameterToString(r.flowlogId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterValueToString(r.serverId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nicId"+"}", _neturl.PathEscape(parameterValueToString(r.nicId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"flowlogId"+"}", _neturl.PathEscape(parameterValueToString(r.flowlogId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -1057,20 +1001,10 @@ func (a *FlowLogsApiService) DatacentersServersNicsFlowlogsPutExecute(r ApiDatac } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -1094,7 +1028,7 @@ func (a *FlowLogsApiService) DatacentersServersNicsFlowlogsPutExecute(r ApiDatac localVarPostBody = r.flowlog if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -1113,11 +1047,11 @@ func (a *FlowLogsApiService) DatacentersServersNicsFlowlogsPutExecute(r ApiDatac localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersServersNicsFlowlogsPut", } @@ -1133,28 +1067,26 @@ func (a *FlowLogsApiService) DatacentersServersNicsFlowlogsPutExecute(r ApiDatac } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/api_images.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/api_images.go similarity index 76% rename from vendor/github.com/ionos-cloud/sdk-go/v6/api_images.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/api_images.go index 75d57a896..d367cc5c1 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/api_images.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/api_images.go @@ -13,6 +13,7 @@ package ionoscloud import ( _context "context" "fmt" + "github.com/ionos-cloud/sdk-go-bundle/shared" "io" _nethttp "net/http" _neturl "net/url" @@ -49,7 +50,7 @@ func (r ApiImagesDeleteRequest) XContractNumber(xContractNumber int32) ApiImages return r } -func (r ApiImagesDeleteRequest) Execute() (*APIResponse, error) { +func (r ApiImagesDeleteRequest) Execute() (*shared.APIResponse, error) { return r.ApiService.ImagesDeleteExecute(r) } @@ -71,7 +72,7 @@ func (a *ImagesApiService) ImagesDelete(ctx _context.Context, imageId string) Ap /* * Execute executes the request */ -func (a *ImagesApiService) ImagesDeleteExecute(r ApiImagesDeleteRequest) (*APIResponse, error) { +func (a *ImagesApiService) ImagesDeleteExecute(r ApiImagesDeleteRequest) (*shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodDelete localVarPostBody interface{} @@ -82,31 +83,23 @@ func (a *ImagesApiService) ImagesDeleteExecute(r ApiImagesDeleteRequest) (*APIRe localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ImagesApiService.ImagesDelete") if err != nil { - return nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return nil, gerr } localVarPath := localBasePath + "/images/{imageId}" - localVarPath = strings.Replace(localVarPath, "{"+"imageId"+"}", _neturl.PathEscape(parameterToString(r.imageId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"imageId"+"}", _neturl.PathEscape(parameterValueToString(r.imageId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -127,11 +120,11 @@ func (a *ImagesApiService) ImagesDeleteExecute(r ApiImagesDeleteRequest) (*APIRe localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -150,11 +143,11 @@ func (a *ImagesApiService) ImagesDeleteExecute(r ApiImagesDeleteRequest) (*APIRe localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "ImagesDelete", } @@ -170,18 +163,17 @@ func (a *ImagesApiService) ImagesDeleteExecute(r ApiImagesDeleteRequest) (*APIRe } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarAPIResponse, newErr } @@ -210,7 +202,7 @@ func (r ApiImagesFindByIdRequest) XContractNumber(xContractNumber int32) ApiImag return r } -func (r ApiImagesFindByIdRequest) Execute() (Image, *APIResponse, error) { +func (r ApiImagesFindByIdRequest) Execute() (Image, *shared.APIResponse, error) { return r.ApiService.ImagesFindByIdExecute(r) } @@ -233,7 +225,7 @@ func (a *ImagesApiService) ImagesFindById(ctx _context.Context, imageId string) * Execute executes the request * @return Image */ -func (a *ImagesApiService) ImagesFindByIdExecute(r ApiImagesFindByIdRequest) (Image, *APIResponse, error) { +func (a *ImagesApiService) ImagesFindByIdExecute(r ApiImagesFindByIdRequest) (Image, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -245,31 +237,23 @@ func (a *ImagesApiService) ImagesFindByIdExecute(r ApiImagesFindByIdRequest) (Im localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ImagesApiService.ImagesFindById") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/images/{imageId}" - localVarPath = strings.Replace(localVarPath, "{"+"imageId"+"}", _neturl.PathEscape(parameterToString(r.imageId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"imageId"+"}", _neturl.PathEscape(parameterValueToString(r.imageId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -290,11 +274,11 @@ func (a *ImagesApiService) ImagesFindByIdExecute(r ApiImagesFindByIdRequest) (Im localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -313,11 +297,11 @@ func (a *ImagesApiService) ImagesFindByIdExecute(r ApiImagesFindByIdRequest) (Im localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "ImagesFindById", } @@ -333,28 +317,26 @@ func (a *ImagesApiService) ImagesFindByIdExecute(r ApiImagesFindByIdRequest) (Im } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -387,7 +369,7 @@ func (r ApiImagesGetRequest) XContractNumber(xContractNumber int32) ApiImagesGet // Filters query parameters limit results to those containing a matching value for a specific property. func (r ApiImagesGetRequest) Filter(key string, value string) ApiImagesGetRequest { - filterKey := fmt.Sprintf(FilterQueryParam, key) + filterKey := fmt.Sprintf("filter.%s", key) r.filters[filterKey] = append(r.filters[filterKey], value) return r } @@ -404,13 +386,13 @@ func (r ApiImagesGetRequest) MaxResults(maxResults int32) ApiImagesGetRequest { return r } -func (r ApiImagesGetRequest) Execute() (Images, *APIResponse, error) { +func (r ApiImagesGetRequest) Execute() (Images, *shared.APIResponse, error) { return r.ApiService.ImagesGetExecute(r) } /* * ImagesGet List images - * List all the images within the data center. + * List all the images in the current contract. * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @return ApiImagesGetRequest */ @@ -426,7 +408,7 @@ func (a *ImagesApiService) ImagesGet(ctx _context.Context) ApiImagesGetRequest { * Execute executes the request * @return Images */ -func (a *ImagesApiService) ImagesGetExecute(r ApiImagesGetRequest) (Images, *APIResponse, error) { +func (a *ImagesApiService) ImagesGetExecute(r ApiImagesGetRequest) (Images, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -438,7 +420,9 @@ func (a *ImagesApiService) ImagesGetExecute(r ApiImagesGetRequest) (Images, *API localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ImagesApiService.ImagesGet") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/images" @@ -448,20 +432,10 @@ func (a *ImagesApiService) ImagesGetExecute(r ApiImagesGetRequest) (Images, *API localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } if r.orderBy != nil { localVarQueryParams.Add("orderBy", parameterToString(*r.orderBy, "")) @@ -495,11 +469,11 @@ func (a *ImagesApiService) ImagesGetExecute(r ApiImagesGetRequest) (Images, *API localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -518,11 +492,11 @@ func (a *ImagesApiService) ImagesGetExecute(r ApiImagesGetRequest) (Images, *API localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "ImagesGet", } @@ -538,28 +512,26 @@ func (a *ImagesApiService) ImagesGetExecute(r ApiImagesGetRequest) (Images, *API } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -593,7 +565,7 @@ func (r ApiImagesPatchRequest) XContractNumber(xContractNumber int32) ApiImagesP return r } -func (r ApiImagesPatchRequest) Execute() (Image, *APIResponse, error) { +func (r ApiImagesPatchRequest) Execute() (Image, *shared.APIResponse, error) { return r.ApiService.ImagesPatchExecute(r) } @@ -616,7 +588,7 @@ func (a *ImagesApiService) ImagesPatch(ctx _context.Context, imageId string) Api * Execute executes the request * @return Image */ -func (a *ImagesApiService) ImagesPatchExecute(r ApiImagesPatchRequest) (Image, *APIResponse, error) { +func (a *ImagesApiService) ImagesPatchExecute(r ApiImagesPatchRequest) (Image, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPatch localVarPostBody interface{} @@ -628,11 +600,13 @@ func (a *ImagesApiService) ImagesPatchExecute(r ApiImagesPatchRequest) (Image, * localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ImagesApiService.ImagesPatch") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/images/{imageId}" - localVarPath = strings.Replace(localVarPath, "{"+"imageId"+"}", _neturl.PathEscape(parameterToString(r.imageId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"imageId"+"}", _neturl.PathEscape(parameterValueToString(r.imageId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -642,20 +616,10 @@ func (a *ImagesApiService) ImagesPatchExecute(r ApiImagesPatchRequest) (Image, * } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -676,13 +640,13 @@ func (a *ImagesApiService) ImagesPatchExecute(r ApiImagesPatchRequest) (Image, * localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.image if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -701,11 +665,11 @@ func (a *ImagesApiService) ImagesPatchExecute(r ApiImagesPatchRequest) (Image, * localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "ImagesPatch", } @@ -721,28 +685,26 @@ func (a *ImagesApiService) ImagesPatchExecute(r ApiImagesPatchRequest) (Image, * } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -776,7 +738,7 @@ func (r ApiImagesPutRequest) XContractNumber(xContractNumber int32) ApiImagesPut return r } -func (r ApiImagesPutRequest) Execute() (Image, *APIResponse, error) { +func (r ApiImagesPutRequest) Execute() (Image, *shared.APIResponse, error) { return r.ApiService.ImagesPutExecute(r) } @@ -799,7 +761,7 @@ func (a *ImagesApiService) ImagesPut(ctx _context.Context, imageId string) ApiIm * Execute executes the request * @return Image */ -func (a *ImagesApiService) ImagesPutExecute(r ApiImagesPutRequest) (Image, *APIResponse, error) { +func (a *ImagesApiService) ImagesPutExecute(r ApiImagesPutRequest) (Image, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPut localVarPostBody interface{} @@ -811,11 +773,13 @@ func (a *ImagesApiService) ImagesPutExecute(r ApiImagesPutRequest) (Image, *APIR localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ImagesApiService.ImagesPut") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/images/{imageId}" - localVarPath = strings.Replace(localVarPath, "{"+"imageId"+"}", _neturl.PathEscape(parameterToString(r.imageId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"imageId"+"}", _neturl.PathEscape(parameterValueToString(r.imageId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -825,20 +789,10 @@ func (a *ImagesApiService) ImagesPutExecute(r ApiImagesPutRequest) (Image, *APIR } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -859,13 +813,13 @@ func (a *ImagesApiService) ImagesPutExecute(r ApiImagesPutRequest) (Image, *APIR localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.image if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -884,11 +838,11 @@ func (a *ImagesApiService) ImagesPutExecute(r ApiImagesPutRequest) (Image, *APIR localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "ImagesPut", } @@ -904,28 +858,26 @@ func (a *ImagesApiService) ImagesPutExecute(r ApiImagesPutRequest) (Image, *APIR } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/api_ip_blocks.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/api_ip_blocks.go similarity index 76% rename from vendor/github.com/ionos-cloud/sdk-go/v6/api_ip_blocks.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/api_ip_blocks.go index 2d6c00363..27f039556 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/api_ip_blocks.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/api_ip_blocks.go @@ -13,6 +13,7 @@ package ionoscloud import ( _context "context" "fmt" + "github.com/ionos-cloud/sdk-go-bundle/shared" "io" _nethttp "net/http" _neturl "net/url" @@ -49,7 +50,7 @@ func (r ApiIpblocksDeleteRequest) XContractNumber(xContractNumber int32) ApiIpbl return r } -func (r ApiIpblocksDeleteRequest) Execute() (*APIResponse, error) { +func (r ApiIpblocksDeleteRequest) Execute() (*shared.APIResponse, error) { return r.ApiService.IpblocksDeleteExecute(r) } @@ -71,7 +72,7 @@ func (a *IPBlocksApiService) IpblocksDelete(ctx _context.Context, ipblockId stri /* * Execute executes the request */ -func (a *IPBlocksApiService) IpblocksDeleteExecute(r ApiIpblocksDeleteRequest) (*APIResponse, error) { +func (a *IPBlocksApiService) IpblocksDeleteExecute(r ApiIpblocksDeleteRequest) (*shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodDelete localVarPostBody interface{} @@ -82,31 +83,23 @@ func (a *IPBlocksApiService) IpblocksDeleteExecute(r ApiIpblocksDeleteRequest) ( localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "IPBlocksApiService.IpblocksDelete") if err != nil { - return nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return nil, gerr } localVarPath := localBasePath + "/ipblocks/{ipblockId}" - localVarPath = strings.Replace(localVarPath, "{"+"ipblockId"+"}", _neturl.PathEscape(parameterToString(r.ipblockId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"ipblockId"+"}", _neturl.PathEscape(parameterValueToString(r.ipblockId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -127,11 +120,11 @@ func (a *IPBlocksApiService) IpblocksDeleteExecute(r ApiIpblocksDeleteRequest) ( localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -150,11 +143,11 @@ func (a *IPBlocksApiService) IpblocksDeleteExecute(r ApiIpblocksDeleteRequest) ( localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "IpblocksDelete", } @@ -170,18 +163,17 @@ func (a *IPBlocksApiService) IpblocksDeleteExecute(r ApiIpblocksDeleteRequest) ( } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarAPIResponse, newErr } @@ -210,7 +202,7 @@ func (r ApiIpblocksFindByIdRequest) XContractNumber(xContractNumber int32) ApiIp return r } -func (r ApiIpblocksFindByIdRequest) Execute() (IpBlock, *APIResponse, error) { +func (r ApiIpblocksFindByIdRequest) Execute() (IpBlock, *shared.APIResponse, error) { return r.ApiService.IpblocksFindByIdExecute(r) } @@ -233,7 +225,7 @@ func (a *IPBlocksApiService) IpblocksFindById(ctx _context.Context, ipblockId st * Execute executes the request * @return IpBlock */ -func (a *IPBlocksApiService) IpblocksFindByIdExecute(r ApiIpblocksFindByIdRequest) (IpBlock, *APIResponse, error) { +func (a *IPBlocksApiService) IpblocksFindByIdExecute(r ApiIpblocksFindByIdRequest) (IpBlock, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -245,31 +237,23 @@ func (a *IPBlocksApiService) IpblocksFindByIdExecute(r ApiIpblocksFindByIdReques localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "IPBlocksApiService.IpblocksFindById") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/ipblocks/{ipblockId}" - localVarPath = strings.Replace(localVarPath, "{"+"ipblockId"+"}", _neturl.PathEscape(parameterToString(r.ipblockId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"ipblockId"+"}", _neturl.PathEscape(parameterValueToString(r.ipblockId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -290,11 +274,11 @@ func (a *IPBlocksApiService) IpblocksFindByIdExecute(r ApiIpblocksFindByIdReques localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -313,11 +297,11 @@ func (a *IPBlocksApiService) IpblocksFindByIdExecute(r ApiIpblocksFindByIdReques localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "IpblocksFindById", } @@ -333,28 +317,26 @@ func (a *IPBlocksApiService) IpblocksFindByIdExecute(r ApiIpblocksFindByIdReques } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -397,7 +379,7 @@ func (r ApiIpblocksGetRequest) Limit(limit int32) ApiIpblocksGetRequest { // Filters query parameters limit results to those containing a matching value for a specific property. func (r ApiIpblocksGetRequest) Filter(key string, value string) ApiIpblocksGetRequest { - filterKey := fmt.Sprintf(FilterQueryParam, key) + filterKey := fmt.Sprintf("filter.%s", key) r.filters[filterKey] = append(r.filters[filterKey], value) return r } @@ -414,7 +396,7 @@ func (r ApiIpblocksGetRequest) MaxResults(maxResults int32) ApiIpblocksGetReques return r } -func (r ApiIpblocksGetRequest) Execute() (IpBlocks, *APIResponse, error) { +func (r ApiIpblocksGetRequest) Execute() (IpBlocks, *shared.APIResponse, error) { return r.ApiService.IpblocksGetExecute(r) } @@ -436,7 +418,7 @@ func (a *IPBlocksApiService) IpblocksGet(ctx _context.Context) ApiIpblocksGetReq * Execute executes the request * @return IpBlocks */ -func (a *IPBlocksApiService) IpblocksGetExecute(r ApiIpblocksGetRequest) (IpBlocks, *APIResponse, error) { +func (a *IPBlocksApiService) IpblocksGetExecute(r ApiIpblocksGetRequest) (IpBlocks, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -448,7 +430,9 @@ func (a *IPBlocksApiService) IpblocksGetExecute(r ApiIpblocksGetRequest) (IpBloc localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "IPBlocksApiService.IpblocksGet") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/ipblocks" @@ -458,36 +442,16 @@ func (a *IPBlocksApiService) IpblocksGetExecute(r ApiIpblocksGetRequest) (IpBloc localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } if r.offset != nil { - localVarQueryParams.Add("offset", parameterToString(*r.offset, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("offset") - if defaultQueryParam == "" { - localVarQueryParams.Add("offset", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "offset", r.offset, "") } if r.limit != nil { - localVarQueryParams.Add("limit", parameterToString(*r.limit, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("limit") - if defaultQueryParam == "" { - localVarQueryParams.Add("limit", parameterToString(100, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "") } if r.orderBy != nil { localVarQueryParams.Add("orderBy", parameterToString(*r.orderBy, "")) @@ -521,11 +485,11 @@ func (a *IPBlocksApiService) IpblocksGetExecute(r ApiIpblocksGetRequest) (IpBloc localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -544,11 +508,11 @@ func (a *IPBlocksApiService) IpblocksGetExecute(r ApiIpblocksGetRequest) (IpBloc localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "IpblocksGet", } @@ -564,28 +528,26 @@ func (a *IPBlocksApiService) IpblocksGetExecute(r ApiIpblocksGetRequest) (IpBloc } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -619,7 +581,7 @@ func (r ApiIpblocksPatchRequest) XContractNumber(xContractNumber int32) ApiIpblo return r } -func (r ApiIpblocksPatchRequest) Execute() (IpBlock, *APIResponse, error) { +func (r ApiIpblocksPatchRequest) Execute() (IpBlock, *shared.APIResponse, error) { return r.ApiService.IpblocksPatchExecute(r) } @@ -642,7 +604,7 @@ func (a *IPBlocksApiService) IpblocksPatch(ctx _context.Context, ipblockId strin * Execute executes the request * @return IpBlock */ -func (a *IPBlocksApiService) IpblocksPatchExecute(r ApiIpblocksPatchRequest) (IpBlock, *APIResponse, error) { +func (a *IPBlocksApiService) IpblocksPatchExecute(r ApiIpblocksPatchRequest) (IpBlock, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPatch localVarPostBody interface{} @@ -654,11 +616,13 @@ func (a *IPBlocksApiService) IpblocksPatchExecute(r ApiIpblocksPatchRequest) (Ip localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "IPBlocksApiService.IpblocksPatch") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/ipblocks/{ipblockId}" - localVarPath = strings.Replace(localVarPath, "{"+"ipblockId"+"}", _neturl.PathEscape(parameterToString(r.ipblockId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"ipblockId"+"}", _neturl.PathEscape(parameterValueToString(r.ipblockId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -668,20 +632,10 @@ func (a *IPBlocksApiService) IpblocksPatchExecute(r ApiIpblocksPatchRequest) (Ip } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -702,13 +656,13 @@ func (a *IPBlocksApiService) IpblocksPatchExecute(r ApiIpblocksPatchRequest) (Ip localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.ipblock if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -727,11 +681,11 @@ func (a *IPBlocksApiService) IpblocksPatchExecute(r ApiIpblocksPatchRequest) (Ip localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "IpblocksPatch", } @@ -747,28 +701,26 @@ func (a *IPBlocksApiService) IpblocksPatchExecute(r ApiIpblocksPatchRequest) (Ip } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -801,7 +753,7 @@ func (r ApiIpblocksPostRequest) XContractNumber(xContractNumber int32) ApiIpbloc return r } -func (r ApiIpblocksPostRequest) Execute() (IpBlock, *APIResponse, error) { +func (r ApiIpblocksPostRequest) Execute() (IpBlock, *shared.APIResponse, error) { return r.ApiService.IpblocksPostExecute(r) } @@ -822,7 +774,7 @@ func (a *IPBlocksApiService) IpblocksPost(ctx _context.Context) ApiIpblocksPostR * Execute executes the request * @return IpBlock */ -func (a *IPBlocksApiService) IpblocksPostExecute(r ApiIpblocksPostRequest) (IpBlock, *APIResponse, error) { +func (a *IPBlocksApiService) IpblocksPostExecute(r ApiIpblocksPostRequest) (IpBlock, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -834,7 +786,9 @@ func (a *IPBlocksApiService) IpblocksPostExecute(r ApiIpblocksPostRequest) (IpBl localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "IPBlocksApiService.IpblocksPost") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/ipblocks" @@ -847,20 +801,10 @@ func (a *IPBlocksApiService) IpblocksPostExecute(r ApiIpblocksPostRequest) (IpBl } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -881,13 +825,13 @@ func (a *IPBlocksApiService) IpblocksPostExecute(r ApiIpblocksPostRequest) (IpBl localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.ipblock if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -906,11 +850,11 @@ func (a *IPBlocksApiService) IpblocksPostExecute(r ApiIpblocksPostRequest) (IpBl localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "IpblocksPost", } @@ -926,28 +870,26 @@ func (a *IPBlocksApiService) IpblocksPostExecute(r ApiIpblocksPostRequest) (IpBl } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -981,7 +923,7 @@ func (r ApiIpblocksPutRequest) XContractNumber(xContractNumber int32) ApiIpblock return r } -func (r ApiIpblocksPutRequest) Execute() (IpBlock, *APIResponse, error) { +func (r ApiIpblocksPutRequest) Execute() (IpBlock, *shared.APIResponse, error) { return r.ApiService.IpblocksPutExecute(r) } @@ -1004,7 +946,7 @@ func (a *IPBlocksApiService) IpblocksPut(ctx _context.Context, ipblockId string) * Execute executes the request * @return IpBlock */ -func (a *IPBlocksApiService) IpblocksPutExecute(r ApiIpblocksPutRequest) (IpBlock, *APIResponse, error) { +func (a *IPBlocksApiService) IpblocksPutExecute(r ApiIpblocksPutRequest) (IpBlock, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPut localVarPostBody interface{} @@ -1016,11 +958,13 @@ func (a *IPBlocksApiService) IpblocksPutExecute(r ApiIpblocksPutRequest) (IpBloc localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "IPBlocksApiService.IpblocksPut") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/ipblocks/{ipblockId}" - localVarPath = strings.Replace(localVarPath, "{"+"ipblockId"+"}", _neturl.PathEscape(parameterToString(r.ipblockId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"ipblockId"+"}", _neturl.PathEscape(parameterValueToString(r.ipblockId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -1030,20 +974,10 @@ func (a *IPBlocksApiService) IpblocksPutExecute(r ApiIpblocksPutRequest) (IpBloc } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -1064,13 +998,13 @@ func (a *IPBlocksApiService) IpblocksPutExecute(r ApiIpblocksPutRequest) (IpBloc localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.ipblock if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -1089,11 +1023,11 @@ func (a *IPBlocksApiService) IpblocksPutExecute(r ApiIpblocksPutRequest) (IpBloc localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "IpblocksPut", } @@ -1109,28 +1043,26 @@ func (a *IPBlocksApiService) IpblocksPutExecute(r ApiIpblocksPutRequest) (IpBloc } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/api_kubernetes.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/api_kubernetes.go similarity index 78% rename from vendor/github.com/ionos-cloud/sdk-go/v6/api_kubernetes.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/api_kubernetes.go index a0aadc697..7e17b701a 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/api_kubernetes.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/api_kubernetes.go @@ -13,6 +13,7 @@ package ionoscloud import ( _context "context" "fmt" + "github.com/ionos-cloud/sdk-go-bundle/shared" "io" _nethttp "net/http" _neturl "net/url" @@ -49,7 +50,7 @@ func (r ApiK8sDeleteRequest) XContractNumber(xContractNumber int32) ApiK8sDelete return r } -func (r ApiK8sDeleteRequest) Execute() (*APIResponse, error) { +func (r ApiK8sDeleteRequest) Execute() (*shared.APIResponse, error) { return r.ApiService.K8sDeleteExecute(r) } @@ -71,7 +72,7 @@ func (a *KubernetesApiService) K8sDelete(ctx _context.Context, k8sClusterId stri /* * Execute executes the request */ -func (a *KubernetesApiService) K8sDeleteExecute(r ApiK8sDeleteRequest) (*APIResponse, error) { +func (a *KubernetesApiService) K8sDeleteExecute(r ApiK8sDeleteRequest) (*shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodDelete localVarPostBody interface{} @@ -82,31 +83,23 @@ func (a *KubernetesApiService) K8sDeleteExecute(r ApiK8sDeleteRequest) (*APIResp localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "KubernetesApiService.K8sDelete") if err != nil { - return nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return nil, gerr } localVarPath := localBasePath + "/k8s/{k8sClusterId}" - localVarPath = strings.Replace(localVarPath, "{"+"k8sClusterId"+"}", _neturl.PathEscape(parameterToString(r.k8sClusterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"k8sClusterId"+"}", _neturl.PathEscape(parameterValueToString(r.k8sClusterId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -127,11 +120,11 @@ func (a *KubernetesApiService) K8sDeleteExecute(r ApiK8sDeleteRequest) (*APIResp localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -150,11 +143,11 @@ func (a *KubernetesApiService) K8sDeleteExecute(r ApiK8sDeleteRequest) (*APIResp localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "K8sDelete", } @@ -170,18 +163,17 @@ func (a *KubernetesApiService) K8sDeleteExecute(r ApiK8sDeleteRequest) (*APIResp } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarAPIResponse, newErr } @@ -210,7 +202,7 @@ func (r ApiK8sFindByClusterIdRequest) XContractNumber(xContractNumber int32) Api return r } -func (r ApiK8sFindByClusterIdRequest) Execute() (KubernetesCluster, *APIResponse, error) { +func (r ApiK8sFindByClusterIdRequest) Execute() (KubernetesCluster, *shared.APIResponse, error) { return r.ApiService.K8sFindByClusterIdExecute(r) } @@ -233,7 +225,7 @@ func (a *KubernetesApiService) K8sFindByClusterId(ctx _context.Context, k8sClust * Execute executes the request * @return KubernetesCluster */ -func (a *KubernetesApiService) K8sFindByClusterIdExecute(r ApiK8sFindByClusterIdRequest) (KubernetesCluster, *APIResponse, error) { +func (a *KubernetesApiService) K8sFindByClusterIdExecute(r ApiK8sFindByClusterIdRequest) (KubernetesCluster, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -245,31 +237,23 @@ func (a *KubernetesApiService) K8sFindByClusterIdExecute(r ApiK8sFindByClusterId localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "KubernetesApiService.K8sFindByClusterId") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/k8s/{k8sClusterId}" - localVarPath = strings.Replace(localVarPath, "{"+"k8sClusterId"+"}", _neturl.PathEscape(parameterToString(r.k8sClusterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"k8sClusterId"+"}", _neturl.PathEscape(parameterValueToString(r.k8sClusterId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -290,11 +274,11 @@ func (a *KubernetesApiService) K8sFindByClusterIdExecute(r ApiK8sFindByClusterId localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -313,11 +297,11 @@ func (a *KubernetesApiService) K8sFindByClusterIdExecute(r ApiK8sFindByClusterId localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "K8sFindByClusterId", } @@ -333,28 +317,26 @@ func (a *KubernetesApiService) K8sFindByClusterIdExecute(r ApiK8sFindByClusterId } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -387,7 +369,7 @@ func (r ApiK8sGetRequest) XContractNumber(xContractNumber int32) ApiK8sGetReques // Filters query parameters limit results to those containing a matching value for a specific property. func (r ApiK8sGetRequest) Filter(key string, value string) ApiK8sGetRequest { - filterKey := fmt.Sprintf(FilterQueryParam, key) + filterKey := fmt.Sprintf("filter.%s", key) r.filters[filterKey] = append(r.filters[filterKey], value) return r } @@ -404,7 +386,7 @@ func (r ApiK8sGetRequest) MaxResults(maxResults int32) ApiK8sGetRequest { return r } -func (r ApiK8sGetRequest) Execute() (KubernetesClusters, *APIResponse, error) { +func (r ApiK8sGetRequest) Execute() (KubernetesClusters, *shared.APIResponse, error) { return r.ApiService.K8sGetExecute(r) } @@ -426,7 +408,7 @@ func (a *KubernetesApiService) K8sGet(ctx _context.Context) ApiK8sGetRequest { * Execute executes the request * @return KubernetesClusters */ -func (a *KubernetesApiService) K8sGetExecute(r ApiK8sGetRequest) (KubernetesClusters, *APIResponse, error) { +func (a *KubernetesApiService) K8sGetExecute(r ApiK8sGetRequest) (KubernetesClusters, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -438,7 +420,9 @@ func (a *KubernetesApiService) K8sGetExecute(r ApiK8sGetRequest) (KubernetesClus localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "KubernetesApiService.K8sGet") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/k8s" @@ -448,20 +432,10 @@ func (a *KubernetesApiService) K8sGetExecute(r ApiK8sGetRequest) (KubernetesClus localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } if r.orderBy != nil { localVarQueryParams.Add("orderBy", parameterToString(*r.orderBy, "")) @@ -495,11 +469,11 @@ func (a *KubernetesApiService) K8sGetExecute(r ApiK8sGetRequest) (KubernetesClus localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -518,11 +492,11 @@ func (a *KubernetesApiService) K8sGetExecute(r ApiK8sGetRequest) (KubernetesClus localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "K8sGet", } @@ -538,28 +512,26 @@ func (a *KubernetesApiService) K8sGetExecute(r ApiK8sGetRequest) (KubernetesClus } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -593,7 +565,7 @@ func (r ApiK8sKubeconfigGetRequest) XContractNumber(xContractNumber int32) ApiK8 // Filters query parameters limit results to those containing a matching value for a specific property. func (r ApiK8sKubeconfigGetRequest) Filter(key string, value string) ApiK8sKubeconfigGetRequest { - filterKey := fmt.Sprintf(FilterQueryParam, key) + filterKey := fmt.Sprintf("filter.%s", key) r.filters[filterKey] = append(r.filters[filterKey], value) return r } @@ -610,7 +582,7 @@ func (r ApiK8sKubeconfigGetRequest) MaxResults(maxResults int32) ApiK8sKubeconfi return r } -func (r ApiK8sKubeconfigGetRequest) Execute() (string, *APIResponse, error) { +func (r ApiK8sKubeconfigGetRequest) Execute() (string, *shared.APIResponse, error) { return r.ApiService.K8sKubeconfigGetExecute(r) } @@ -634,7 +606,7 @@ func (a *KubernetesApiService) K8sKubeconfigGet(ctx _context.Context, k8sCluster * Execute executes the request * @return string */ -func (a *KubernetesApiService) K8sKubeconfigGetExecute(r ApiK8sKubeconfigGetRequest) (string, *APIResponse, error) { +func (a *KubernetesApiService) K8sKubeconfigGetExecute(r ApiK8sKubeconfigGetRequest) (string, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -646,31 +618,23 @@ func (a *KubernetesApiService) K8sKubeconfigGetExecute(r ApiK8sKubeconfigGetRequ localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "KubernetesApiService.K8sKubeconfigGet") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/k8s/{k8sClusterId}/kubeconfig" - localVarPath = strings.Replace(localVarPath, "{"+"k8sClusterId"+"}", _neturl.PathEscape(parameterToString(r.k8sClusterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"k8sClusterId"+"}", _neturl.PathEscape(parameterValueToString(r.k8sClusterId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } if r.orderBy != nil { localVarQueryParams.Add("orderBy", parameterToString(*r.orderBy, "")) @@ -704,11 +668,11 @@ func (a *KubernetesApiService) K8sKubeconfigGetExecute(r ApiK8sKubeconfigGetRequ localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -727,11 +691,11 @@ func (a *KubernetesApiService) K8sKubeconfigGetExecute(r ApiK8sKubeconfigGetRequ localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "K8sKubeconfigGet", } @@ -747,28 +711,26 @@ func (a *KubernetesApiService) K8sKubeconfigGetExecute(r ApiK8sKubeconfigGetRequ } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -798,7 +760,7 @@ func (r ApiK8sNodepoolsDeleteRequest) XContractNumber(xContractNumber int32) Api return r } -func (r ApiK8sNodepoolsDeleteRequest) Execute() (*APIResponse, error) { +func (r ApiK8sNodepoolsDeleteRequest) Execute() (*shared.APIResponse, error) { return r.ApiService.K8sNodepoolsDeleteExecute(r) } @@ -822,7 +784,7 @@ func (a *KubernetesApiService) K8sNodepoolsDelete(ctx _context.Context, k8sClust /* * Execute executes the request */ -func (a *KubernetesApiService) K8sNodepoolsDeleteExecute(r ApiK8sNodepoolsDeleteRequest) (*APIResponse, error) { +func (a *KubernetesApiService) K8sNodepoolsDeleteExecute(r ApiK8sNodepoolsDeleteRequest) (*shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodDelete localVarPostBody interface{} @@ -833,32 +795,24 @@ func (a *KubernetesApiService) K8sNodepoolsDeleteExecute(r ApiK8sNodepoolsDelete localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "KubernetesApiService.K8sNodepoolsDelete") if err != nil { - return nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return nil, gerr } localVarPath := localBasePath + "/k8s/{k8sClusterId}/nodepools/{nodepoolId}" - localVarPath = strings.Replace(localVarPath, "{"+"k8sClusterId"+"}", _neturl.PathEscape(parameterToString(r.k8sClusterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"nodepoolId"+"}", _neturl.PathEscape(parameterToString(r.nodepoolId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"k8sClusterId"+"}", _neturl.PathEscape(parameterValueToString(r.k8sClusterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nodepoolId"+"}", _neturl.PathEscape(parameterValueToString(r.nodepoolId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -879,11 +833,11 @@ func (a *KubernetesApiService) K8sNodepoolsDeleteExecute(r ApiK8sNodepoolsDelete localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -902,11 +856,11 @@ func (a *KubernetesApiService) K8sNodepoolsDeleteExecute(r ApiK8sNodepoolsDelete localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "K8sNodepoolsDelete", } @@ -922,18 +876,17 @@ func (a *KubernetesApiService) K8sNodepoolsDeleteExecute(r ApiK8sNodepoolsDelete } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarAPIResponse, newErr } @@ -963,7 +916,7 @@ func (r ApiK8sNodepoolsFindByIdRequest) XContractNumber(xContractNumber int32) A return r } -func (r ApiK8sNodepoolsFindByIdRequest) Execute() (KubernetesNodePool, *APIResponse, error) { +func (r ApiK8sNodepoolsFindByIdRequest) Execute() (KubernetesNodePool, *shared.APIResponse, error) { return r.ApiService.K8sNodepoolsFindByIdExecute(r) } @@ -988,7 +941,7 @@ func (a *KubernetesApiService) K8sNodepoolsFindById(ctx _context.Context, k8sClu * Execute executes the request * @return KubernetesNodePool */ -func (a *KubernetesApiService) K8sNodepoolsFindByIdExecute(r ApiK8sNodepoolsFindByIdRequest) (KubernetesNodePool, *APIResponse, error) { +func (a *KubernetesApiService) K8sNodepoolsFindByIdExecute(r ApiK8sNodepoolsFindByIdRequest) (KubernetesNodePool, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -1000,32 +953,24 @@ func (a *KubernetesApiService) K8sNodepoolsFindByIdExecute(r ApiK8sNodepoolsFind localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "KubernetesApiService.K8sNodepoolsFindById") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/k8s/{k8sClusterId}/nodepools/{nodepoolId}" - localVarPath = strings.Replace(localVarPath, "{"+"k8sClusterId"+"}", _neturl.PathEscape(parameterToString(r.k8sClusterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"nodepoolId"+"}", _neturl.PathEscape(parameterToString(r.nodepoolId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"k8sClusterId"+"}", _neturl.PathEscape(parameterValueToString(r.k8sClusterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nodepoolId"+"}", _neturl.PathEscape(parameterValueToString(r.nodepoolId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -1046,11 +991,11 @@ func (a *KubernetesApiService) K8sNodepoolsFindByIdExecute(r ApiK8sNodepoolsFind localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -1069,11 +1014,11 @@ func (a *KubernetesApiService) K8sNodepoolsFindByIdExecute(r ApiK8sNodepoolsFind localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "K8sNodepoolsFindById", } @@ -1089,28 +1034,26 @@ func (a *KubernetesApiService) K8sNodepoolsFindByIdExecute(r ApiK8sNodepoolsFind } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -1144,7 +1087,7 @@ func (r ApiK8sNodepoolsGetRequest) XContractNumber(xContractNumber int32) ApiK8s // Filters query parameters limit results to those containing a matching value for a specific property. func (r ApiK8sNodepoolsGetRequest) Filter(key string, value string) ApiK8sNodepoolsGetRequest { - filterKey := fmt.Sprintf(FilterQueryParam, key) + filterKey := fmt.Sprintf("filter.%s", key) r.filters[filterKey] = append(r.filters[filterKey], value) return r } @@ -1161,7 +1104,7 @@ func (r ApiK8sNodepoolsGetRequest) MaxResults(maxResults int32) ApiK8sNodepoolsG return r } -func (r ApiK8sNodepoolsGetRequest) Execute() (KubernetesNodePools, *APIResponse, error) { +func (r ApiK8sNodepoolsGetRequest) Execute() (KubernetesNodePools, *shared.APIResponse, error) { return r.ApiService.K8sNodepoolsGetExecute(r) } @@ -1185,7 +1128,7 @@ func (a *KubernetesApiService) K8sNodepoolsGet(ctx _context.Context, k8sClusterI * Execute executes the request * @return KubernetesNodePools */ -func (a *KubernetesApiService) K8sNodepoolsGetExecute(r ApiK8sNodepoolsGetRequest) (KubernetesNodePools, *APIResponse, error) { +func (a *KubernetesApiService) K8sNodepoolsGetExecute(r ApiK8sNodepoolsGetRequest) (KubernetesNodePools, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -1197,31 +1140,23 @@ func (a *KubernetesApiService) K8sNodepoolsGetExecute(r ApiK8sNodepoolsGetReques localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "KubernetesApiService.K8sNodepoolsGet") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/k8s/{k8sClusterId}/nodepools" - localVarPath = strings.Replace(localVarPath, "{"+"k8sClusterId"+"}", _neturl.PathEscape(parameterToString(r.k8sClusterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"k8sClusterId"+"}", _neturl.PathEscape(parameterValueToString(r.k8sClusterId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } if r.orderBy != nil { localVarQueryParams.Add("orderBy", parameterToString(*r.orderBy, "")) @@ -1255,11 +1190,11 @@ func (a *KubernetesApiService) K8sNodepoolsGetExecute(r ApiK8sNodepoolsGetReques localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -1278,11 +1213,11 @@ func (a *KubernetesApiService) K8sNodepoolsGetExecute(r ApiK8sNodepoolsGetReques localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "K8sNodepoolsGet", } @@ -1298,28 +1233,26 @@ func (a *KubernetesApiService) K8sNodepoolsGetExecute(r ApiK8sNodepoolsGetReques } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -1350,7 +1283,7 @@ func (r ApiK8sNodepoolsNodesDeleteRequest) XContractNumber(xContractNumber int32 return r } -func (r ApiK8sNodepoolsNodesDeleteRequest) Execute() (*APIResponse, error) { +func (r ApiK8sNodepoolsNodesDeleteRequest) Execute() (*shared.APIResponse, error) { return r.ApiService.K8sNodepoolsNodesDeleteExecute(r) } @@ -1376,7 +1309,7 @@ func (a *KubernetesApiService) K8sNodepoolsNodesDelete(ctx _context.Context, k8s /* * Execute executes the request */ -func (a *KubernetesApiService) K8sNodepoolsNodesDeleteExecute(r ApiK8sNodepoolsNodesDeleteRequest) (*APIResponse, error) { +func (a *KubernetesApiService) K8sNodepoolsNodesDeleteExecute(r ApiK8sNodepoolsNodesDeleteRequest) (*shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodDelete localVarPostBody interface{} @@ -1387,33 +1320,25 @@ func (a *KubernetesApiService) K8sNodepoolsNodesDeleteExecute(r ApiK8sNodepoolsN localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "KubernetesApiService.K8sNodepoolsNodesDelete") if err != nil { - return nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return nil, gerr } localVarPath := localBasePath + "/k8s/{k8sClusterId}/nodepools/{nodepoolId}/nodes/{nodeId}" - localVarPath = strings.Replace(localVarPath, "{"+"k8sClusterId"+"}", _neturl.PathEscape(parameterToString(r.k8sClusterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"nodepoolId"+"}", _neturl.PathEscape(parameterToString(r.nodepoolId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"nodeId"+"}", _neturl.PathEscape(parameterToString(r.nodeId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"k8sClusterId"+"}", _neturl.PathEscape(parameterValueToString(r.k8sClusterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nodepoolId"+"}", _neturl.PathEscape(parameterValueToString(r.nodepoolId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nodeId"+"}", _neturl.PathEscape(parameterValueToString(r.nodeId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -1434,11 +1359,11 @@ func (a *KubernetesApiService) K8sNodepoolsNodesDeleteExecute(r ApiK8sNodepoolsN localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -1457,11 +1382,11 @@ func (a *KubernetesApiService) K8sNodepoolsNodesDeleteExecute(r ApiK8sNodepoolsN localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "K8sNodepoolsNodesDelete", } @@ -1477,18 +1402,17 @@ func (a *KubernetesApiService) K8sNodepoolsNodesDeleteExecute(r ApiK8sNodepoolsN } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarAPIResponse, newErr } @@ -1519,7 +1443,7 @@ func (r ApiK8sNodepoolsNodesFindByIdRequest) XContractNumber(xContractNumber int return r } -func (r ApiK8sNodepoolsNodesFindByIdRequest) Execute() (KubernetesNode, *APIResponse, error) { +func (r ApiK8sNodepoolsNodesFindByIdRequest) Execute() (KubernetesNode, *shared.APIResponse, error) { return r.ApiService.K8sNodepoolsNodesFindByIdExecute(r) } @@ -1546,7 +1470,7 @@ func (a *KubernetesApiService) K8sNodepoolsNodesFindById(ctx _context.Context, k * Execute executes the request * @return KubernetesNode */ -func (a *KubernetesApiService) K8sNodepoolsNodesFindByIdExecute(r ApiK8sNodepoolsNodesFindByIdRequest) (KubernetesNode, *APIResponse, error) { +func (a *KubernetesApiService) K8sNodepoolsNodesFindByIdExecute(r ApiK8sNodepoolsNodesFindByIdRequest) (KubernetesNode, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -1558,33 +1482,25 @@ func (a *KubernetesApiService) K8sNodepoolsNodesFindByIdExecute(r ApiK8sNodepool localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "KubernetesApiService.K8sNodepoolsNodesFindById") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/k8s/{k8sClusterId}/nodepools/{nodepoolId}/nodes/{nodeId}" - localVarPath = strings.Replace(localVarPath, "{"+"k8sClusterId"+"}", _neturl.PathEscape(parameterToString(r.k8sClusterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"nodepoolId"+"}", _neturl.PathEscape(parameterToString(r.nodepoolId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"nodeId"+"}", _neturl.PathEscape(parameterToString(r.nodeId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"k8sClusterId"+"}", _neturl.PathEscape(parameterValueToString(r.k8sClusterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nodepoolId"+"}", _neturl.PathEscape(parameterValueToString(r.nodepoolId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nodeId"+"}", _neturl.PathEscape(parameterValueToString(r.nodeId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -1605,11 +1521,11 @@ func (a *KubernetesApiService) K8sNodepoolsNodesFindByIdExecute(r ApiK8sNodepool localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -1628,11 +1544,11 @@ func (a *KubernetesApiService) K8sNodepoolsNodesFindByIdExecute(r ApiK8sNodepool localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "K8sNodepoolsNodesFindById", } @@ -1648,28 +1564,26 @@ func (a *KubernetesApiService) K8sNodepoolsNodesFindByIdExecute(r ApiK8sNodepool } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -1704,7 +1618,7 @@ func (r ApiK8sNodepoolsNodesGetRequest) XContractNumber(xContractNumber int32) A // Filters query parameters limit results to those containing a matching value for a specific property. func (r ApiK8sNodepoolsNodesGetRequest) Filter(key string, value string) ApiK8sNodepoolsNodesGetRequest { - filterKey := fmt.Sprintf(FilterQueryParam, key) + filterKey := fmt.Sprintf("filter.%s", key) r.filters[filterKey] = append(r.filters[filterKey], value) return r } @@ -1721,7 +1635,7 @@ func (r ApiK8sNodepoolsNodesGetRequest) MaxResults(maxResults int32) ApiK8sNodep return r } -func (r ApiK8sNodepoolsNodesGetRequest) Execute() (KubernetesNodes, *APIResponse, error) { +func (r ApiK8sNodepoolsNodesGetRequest) Execute() (KubernetesNodes, *shared.APIResponse, error) { return r.ApiService.K8sNodepoolsNodesGetExecute(r) } @@ -1747,7 +1661,7 @@ func (a *KubernetesApiService) K8sNodepoolsNodesGet(ctx _context.Context, k8sClu * Execute executes the request * @return KubernetesNodes */ -func (a *KubernetesApiService) K8sNodepoolsNodesGetExecute(r ApiK8sNodepoolsNodesGetRequest) (KubernetesNodes, *APIResponse, error) { +func (a *KubernetesApiService) K8sNodepoolsNodesGetExecute(r ApiK8sNodepoolsNodesGetRequest) (KubernetesNodes, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -1759,32 +1673,24 @@ func (a *KubernetesApiService) K8sNodepoolsNodesGetExecute(r ApiK8sNodepoolsNode localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "KubernetesApiService.K8sNodepoolsNodesGet") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/k8s/{k8sClusterId}/nodepools/{nodepoolId}/nodes" - localVarPath = strings.Replace(localVarPath, "{"+"k8sClusterId"+"}", _neturl.PathEscape(parameterToString(r.k8sClusterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"nodepoolId"+"}", _neturl.PathEscape(parameterToString(r.nodepoolId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"k8sClusterId"+"}", _neturl.PathEscape(parameterValueToString(r.k8sClusterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nodepoolId"+"}", _neturl.PathEscape(parameterValueToString(r.nodepoolId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } if r.orderBy != nil { localVarQueryParams.Add("orderBy", parameterToString(*r.orderBy, "")) @@ -1818,11 +1724,11 @@ func (a *KubernetesApiService) K8sNodepoolsNodesGetExecute(r ApiK8sNodepoolsNode localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -1841,11 +1747,11 @@ func (a *KubernetesApiService) K8sNodepoolsNodesGetExecute(r ApiK8sNodepoolsNode localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "K8sNodepoolsNodesGet", } @@ -1861,28 +1767,26 @@ func (a *KubernetesApiService) K8sNodepoolsNodesGetExecute(r ApiK8sNodepoolsNode } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -1913,7 +1817,7 @@ func (r ApiK8sNodepoolsNodesReplacePostRequest) XContractNumber(xContractNumber return r } -func (r ApiK8sNodepoolsNodesReplacePostRequest) Execute() (*APIResponse, error) { +func (r ApiK8sNodepoolsNodesReplacePostRequest) Execute() (*shared.APIResponse, error) { return r.ApiService.K8sNodepoolsNodesReplacePostExecute(r) } @@ -1941,7 +1845,7 @@ func (a *KubernetesApiService) K8sNodepoolsNodesReplacePost(ctx _context.Context /* * Execute executes the request */ -func (a *KubernetesApiService) K8sNodepoolsNodesReplacePostExecute(r ApiK8sNodepoolsNodesReplacePostRequest) (*APIResponse, error) { +func (a *KubernetesApiService) K8sNodepoolsNodesReplacePostExecute(r ApiK8sNodepoolsNodesReplacePostRequest) (*shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -1952,33 +1856,25 @@ func (a *KubernetesApiService) K8sNodepoolsNodesReplacePostExecute(r ApiK8sNodep localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "KubernetesApiService.K8sNodepoolsNodesReplacePost") if err != nil { - return nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return nil, gerr } localVarPath := localBasePath + "/k8s/{k8sClusterId}/nodepools/{nodepoolId}/nodes/{nodeId}/replace" - localVarPath = strings.Replace(localVarPath, "{"+"k8sClusterId"+"}", _neturl.PathEscape(parameterToString(r.k8sClusterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"nodepoolId"+"}", _neturl.PathEscape(parameterToString(r.nodepoolId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"nodeId"+"}", _neturl.PathEscape(parameterToString(r.nodeId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"k8sClusterId"+"}", _neturl.PathEscape(parameterValueToString(r.k8sClusterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nodepoolId"+"}", _neturl.PathEscape(parameterValueToString(r.nodepoolId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nodeId"+"}", _neturl.PathEscape(parameterValueToString(r.nodeId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -1999,11 +1895,11 @@ func (a *KubernetesApiService) K8sNodepoolsNodesReplacePostExecute(r ApiK8sNodep localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -2022,11 +1918,11 @@ func (a *KubernetesApiService) K8sNodepoolsNodesReplacePostExecute(r ApiK8sNodep localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "K8sNodepoolsNodesReplacePost", } @@ -2042,18 +1938,17 @@ func (a *KubernetesApiService) K8sNodepoolsNodesReplacePostExecute(r ApiK8sNodep } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarAPIResponse, newErr } @@ -2087,7 +1982,7 @@ func (r ApiK8sNodepoolsPostRequest) XContractNumber(xContractNumber int32) ApiK8 return r } -func (r ApiK8sNodepoolsPostRequest) Execute() (KubernetesNodePool, *APIResponse, error) { +func (r ApiK8sNodepoolsPostRequest) Execute() (KubernetesNodePool, *shared.APIResponse, error) { return r.ApiService.K8sNodepoolsPostExecute(r) } @@ -2110,7 +2005,7 @@ func (a *KubernetesApiService) K8sNodepoolsPost(ctx _context.Context, k8sCluster * Execute executes the request * @return KubernetesNodePool */ -func (a *KubernetesApiService) K8sNodepoolsPostExecute(r ApiK8sNodepoolsPostRequest) (KubernetesNodePool, *APIResponse, error) { +func (a *KubernetesApiService) K8sNodepoolsPostExecute(r ApiK8sNodepoolsPostRequest) (KubernetesNodePool, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -2122,11 +2017,13 @@ func (a *KubernetesApiService) K8sNodepoolsPostExecute(r ApiK8sNodepoolsPostRequ localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "KubernetesApiService.K8sNodepoolsPost") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/k8s/{k8sClusterId}/nodepools" - localVarPath = strings.Replace(localVarPath, "{"+"k8sClusterId"+"}", _neturl.PathEscape(parameterToString(r.k8sClusterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"k8sClusterId"+"}", _neturl.PathEscape(parameterValueToString(r.k8sClusterId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -2136,20 +2033,10 @@ func (a *KubernetesApiService) K8sNodepoolsPostExecute(r ApiK8sNodepoolsPostRequ } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -2170,13 +2057,13 @@ func (a *KubernetesApiService) K8sNodepoolsPostExecute(r ApiK8sNodepoolsPostRequ localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.kubernetesNodePool if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -2195,11 +2082,11 @@ func (a *KubernetesApiService) K8sNodepoolsPostExecute(r ApiK8sNodepoolsPostRequ localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "K8sNodepoolsPost", } @@ -2215,28 +2102,26 @@ func (a *KubernetesApiService) K8sNodepoolsPostExecute(r ApiK8sNodepoolsPostRequ } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -2271,7 +2156,7 @@ func (r ApiK8sNodepoolsPutRequest) XContractNumber(xContractNumber int32) ApiK8s return r } -func (r ApiK8sNodepoolsPutRequest) Execute() (KubernetesNodePool, *APIResponse, error) { +func (r ApiK8sNodepoolsPutRequest) Execute() (KubernetesNodePool, *shared.APIResponse, error) { return r.ApiService.K8sNodepoolsPutExecute(r) } @@ -2296,7 +2181,7 @@ func (a *KubernetesApiService) K8sNodepoolsPut(ctx _context.Context, k8sClusterI * Execute executes the request * @return KubernetesNodePool */ -func (a *KubernetesApiService) K8sNodepoolsPutExecute(r ApiK8sNodepoolsPutRequest) (KubernetesNodePool, *APIResponse, error) { +func (a *KubernetesApiService) K8sNodepoolsPutExecute(r ApiK8sNodepoolsPutRequest) (KubernetesNodePool, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPut localVarPostBody interface{} @@ -2308,12 +2193,14 @@ func (a *KubernetesApiService) K8sNodepoolsPutExecute(r ApiK8sNodepoolsPutReques localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "KubernetesApiService.K8sNodepoolsPut") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/k8s/{k8sClusterId}/nodepools/{nodepoolId}" - localVarPath = strings.Replace(localVarPath, "{"+"k8sClusterId"+"}", _neturl.PathEscape(parameterToString(r.k8sClusterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"nodepoolId"+"}", _neturl.PathEscape(parameterToString(r.nodepoolId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"k8sClusterId"+"}", _neturl.PathEscape(parameterValueToString(r.k8sClusterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nodepoolId"+"}", _neturl.PathEscape(parameterValueToString(r.nodepoolId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -2323,20 +2210,10 @@ func (a *KubernetesApiService) K8sNodepoolsPutExecute(r ApiK8sNodepoolsPutReques } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -2357,13 +2234,13 @@ func (a *KubernetesApiService) K8sNodepoolsPutExecute(r ApiK8sNodepoolsPutReques localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.kubernetesNodePool if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -2382,11 +2259,11 @@ func (a *KubernetesApiService) K8sNodepoolsPutExecute(r ApiK8sNodepoolsPutReques localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "K8sNodepoolsPut", } @@ -2402,28 +2279,26 @@ func (a *KubernetesApiService) K8sNodepoolsPutExecute(r ApiK8sNodepoolsPutReques } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -2456,7 +2331,7 @@ func (r ApiK8sPostRequest) XContractNumber(xContractNumber int32) ApiK8sPostRequ return r } -func (r ApiK8sPostRequest) Execute() (KubernetesCluster, *APIResponse, error) { +func (r ApiK8sPostRequest) Execute() (KubernetesCluster, *shared.APIResponse, error) { return r.ApiService.K8sPostExecute(r) } @@ -2477,7 +2352,7 @@ func (a *KubernetesApiService) K8sPost(ctx _context.Context) ApiK8sPostRequest { * Execute executes the request * @return KubernetesCluster */ -func (a *KubernetesApiService) K8sPostExecute(r ApiK8sPostRequest) (KubernetesCluster, *APIResponse, error) { +func (a *KubernetesApiService) K8sPostExecute(r ApiK8sPostRequest) (KubernetesCluster, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -2489,7 +2364,9 @@ func (a *KubernetesApiService) K8sPostExecute(r ApiK8sPostRequest) (KubernetesCl localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "KubernetesApiService.K8sPost") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/k8s" @@ -2502,20 +2379,10 @@ func (a *KubernetesApiService) K8sPostExecute(r ApiK8sPostRequest) (KubernetesCl } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -2536,13 +2403,13 @@ func (a *KubernetesApiService) K8sPostExecute(r ApiK8sPostRequest) (KubernetesCl localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.kubernetesCluster if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -2561,11 +2428,11 @@ func (a *KubernetesApiService) K8sPostExecute(r ApiK8sPostRequest) (KubernetesCl localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "K8sPost", } @@ -2581,28 +2448,26 @@ func (a *KubernetesApiService) K8sPostExecute(r ApiK8sPostRequest) (KubernetesCl } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -2636,7 +2501,7 @@ func (r ApiK8sPutRequest) XContractNumber(xContractNumber int32) ApiK8sPutReques return r } -func (r ApiK8sPutRequest) Execute() (KubernetesCluster, *APIResponse, error) { +func (r ApiK8sPutRequest) Execute() (KubernetesCluster, *shared.APIResponse, error) { return r.ApiService.K8sPutExecute(r) } @@ -2659,7 +2524,7 @@ func (a *KubernetesApiService) K8sPut(ctx _context.Context, k8sClusterId string) * Execute executes the request * @return KubernetesCluster */ -func (a *KubernetesApiService) K8sPutExecute(r ApiK8sPutRequest) (KubernetesCluster, *APIResponse, error) { +func (a *KubernetesApiService) K8sPutExecute(r ApiK8sPutRequest) (KubernetesCluster, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPut localVarPostBody interface{} @@ -2671,11 +2536,13 @@ func (a *KubernetesApiService) K8sPutExecute(r ApiK8sPutRequest) (KubernetesClus localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "KubernetesApiService.K8sPut") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/k8s/{k8sClusterId}" - localVarPath = strings.Replace(localVarPath, "{"+"k8sClusterId"+"}", _neturl.PathEscape(parameterToString(r.k8sClusterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"k8sClusterId"+"}", _neturl.PathEscape(parameterValueToString(r.k8sClusterId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -2685,20 +2552,10 @@ func (a *KubernetesApiService) K8sPutExecute(r ApiK8sPutRequest) (KubernetesClus } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -2719,13 +2576,13 @@ func (a *KubernetesApiService) K8sPutExecute(r ApiK8sPutRequest) (KubernetesClus localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.kubernetesCluster if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -2744,11 +2601,11 @@ func (a *KubernetesApiService) K8sPutExecute(r ApiK8sPutRequest) (KubernetesClus localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "K8sPut", } @@ -2764,28 +2621,26 @@ func (a *KubernetesApiService) K8sPutExecute(r ApiK8sPutRequest) (KubernetesClus } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -2802,7 +2657,7 @@ type ApiK8sVersionsDefaultGetRequest struct { // Filters query parameters limit results to those containing a matching value for a specific property. func (r ApiK8sVersionsDefaultGetRequest) Filter(key string, value string) ApiK8sVersionsDefaultGetRequest { - filterKey := fmt.Sprintf(FilterQueryParam, key) + filterKey := fmt.Sprintf("filter.%s", key) r.filters[filterKey] = append(r.filters[filterKey], value) return r } @@ -2819,7 +2674,7 @@ func (r ApiK8sVersionsDefaultGetRequest) MaxResults(maxResults int32) ApiK8sVers return r } -func (r ApiK8sVersionsDefaultGetRequest) Execute() (string, *APIResponse, error) { +func (r ApiK8sVersionsDefaultGetRequest) Execute() (string, *shared.APIResponse, error) { return r.ApiService.K8sVersionsDefaultGetExecute(r) } @@ -2841,7 +2696,7 @@ func (a *KubernetesApiService) K8sVersionsDefaultGet(ctx _context.Context) ApiK8 * Execute executes the request * @return string */ -func (a *KubernetesApiService) K8sVersionsDefaultGetExecute(r ApiK8sVersionsDefaultGetRequest) (string, *APIResponse, error) { +func (a *KubernetesApiService) K8sVersionsDefaultGetExecute(r ApiK8sVersionsDefaultGetRequest) (string, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -2853,7 +2708,9 @@ func (a *KubernetesApiService) K8sVersionsDefaultGetExecute(r ApiK8sVersionsDefa localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "KubernetesApiService.K8sVersionsDefaultGet") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/k8s/versions/default" @@ -2895,7 +2752,7 @@ func (a *KubernetesApiService) K8sVersionsDefaultGetExecute(r ApiK8sVersionsDefa } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -2914,11 +2771,11 @@ func (a *KubernetesApiService) K8sVersionsDefaultGetExecute(r ApiK8sVersionsDefa localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "K8sVersionsDefaultGet", } @@ -2934,28 +2791,26 @@ func (a *KubernetesApiService) K8sVersionsDefaultGetExecute(r ApiK8sVersionsDefa } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -2972,7 +2827,7 @@ type ApiK8sVersionsGetRequest struct { // Filters query parameters limit results to those containing a matching value for a specific property. func (r ApiK8sVersionsGetRequest) Filter(key string, value string) ApiK8sVersionsGetRequest { - filterKey := fmt.Sprintf(FilterQueryParam, key) + filterKey := fmt.Sprintf("filter.%s", key) r.filters[filterKey] = append(r.filters[filterKey], value) return r } @@ -2989,7 +2844,7 @@ func (r ApiK8sVersionsGetRequest) MaxResults(maxResults int32) ApiK8sVersionsGet return r } -func (r ApiK8sVersionsGetRequest) Execute() ([]string, *APIResponse, error) { +func (r ApiK8sVersionsGetRequest) Execute() ([]string, *shared.APIResponse, error) { return r.ApiService.K8sVersionsGetExecute(r) } @@ -3011,7 +2866,7 @@ func (a *KubernetesApiService) K8sVersionsGet(ctx _context.Context) ApiK8sVersio * Execute executes the request * @return []string */ -func (a *KubernetesApiService) K8sVersionsGetExecute(r ApiK8sVersionsGetRequest) ([]string, *APIResponse, error) { +func (a *KubernetesApiService) K8sVersionsGetExecute(r ApiK8sVersionsGetRequest) ([]string, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -3023,7 +2878,9 @@ func (a *KubernetesApiService) K8sVersionsGetExecute(r ApiK8sVersionsGetRequest) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "KubernetesApiService.K8sVersionsGet") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/k8s/versions" @@ -3065,7 +2922,7 @@ func (a *KubernetesApiService) K8sVersionsGetExecute(r ApiK8sVersionsGetRequest) } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -3084,11 +2941,11 @@ func (a *KubernetesApiService) K8sVersionsGetExecute(r ApiK8sVersionsGetRequest) localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "K8sVersionsGet", } @@ -3104,28 +2961,26 @@ func (a *KubernetesApiService) K8sVersionsGetExecute(r ApiK8sVersionsGetRequest) } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/api_labels.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/api_labels.go similarity index 77% rename from vendor/github.com/ionos-cloud/sdk-go/v6/api_labels.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/api_labels.go index 8108fee82..7b6e616b2 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/api_labels.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/api_labels.go @@ -13,6 +13,7 @@ package ionoscloud import ( _context "context" "fmt" + "github.com/ionos-cloud/sdk-go-bundle/shared" "io" _nethttp "net/http" _neturl "net/url" @@ -50,7 +51,7 @@ func (r ApiDatacentersLabelsDeleteRequest) XContractNumber(xContractNumber int32 return r } -func (r ApiDatacentersLabelsDeleteRequest) Execute() (*APIResponse, error) { +func (r ApiDatacentersLabelsDeleteRequest) Execute() (*shared.APIResponse, error) { return r.ApiService.DatacentersLabelsDeleteExecute(r) } @@ -74,7 +75,7 @@ func (a *LabelsApiService) DatacentersLabelsDelete(ctx _context.Context, datacen /* * Execute executes the request */ -func (a *LabelsApiService) DatacentersLabelsDeleteExecute(r ApiDatacentersLabelsDeleteRequest) (*APIResponse, error) { +func (a *LabelsApiService) DatacentersLabelsDeleteExecute(r ApiDatacentersLabelsDeleteRequest) (*shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodDelete localVarPostBody interface{} @@ -85,32 +86,24 @@ func (a *LabelsApiService) DatacentersLabelsDeleteExecute(r ApiDatacentersLabels localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LabelsApiService.DatacentersLabelsDelete") if err != nil { - return nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/labels/{key}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"key"+"}", _neturl.PathEscape(parameterToString(r.key, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"key"+"}", _neturl.PathEscape(parameterValueToString(r.key, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -131,11 +124,11 @@ func (a *LabelsApiService) DatacentersLabelsDeleteExecute(r ApiDatacentersLabels localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -154,11 +147,11 @@ func (a *LabelsApiService) DatacentersLabelsDeleteExecute(r ApiDatacentersLabels localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersLabelsDelete", } @@ -174,18 +167,17 @@ func (a *LabelsApiService) DatacentersLabelsDeleteExecute(r ApiDatacentersLabels } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarAPIResponse, newErr } @@ -215,7 +207,7 @@ func (r ApiDatacentersLabelsFindByKeyRequest) XContractNumber(xContractNumber in return r } -func (r ApiDatacentersLabelsFindByKeyRequest) Execute() (LabelResource, *APIResponse, error) { +func (r ApiDatacentersLabelsFindByKeyRequest) Execute() (LabelResource, *shared.APIResponse, error) { return r.ApiService.DatacentersLabelsFindByKeyExecute(r) } @@ -240,7 +232,7 @@ func (a *LabelsApiService) DatacentersLabelsFindByKey(ctx _context.Context, data * Execute executes the request * @return LabelResource */ -func (a *LabelsApiService) DatacentersLabelsFindByKeyExecute(r ApiDatacentersLabelsFindByKeyRequest) (LabelResource, *APIResponse, error) { +func (a *LabelsApiService) DatacentersLabelsFindByKeyExecute(r ApiDatacentersLabelsFindByKeyRequest) (LabelResource, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -252,32 +244,24 @@ func (a *LabelsApiService) DatacentersLabelsFindByKeyExecute(r ApiDatacentersLab localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LabelsApiService.DatacentersLabelsFindByKey") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/labels/{key}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"key"+"}", _neturl.PathEscape(parameterToString(r.key, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"key"+"}", _neturl.PathEscape(parameterValueToString(r.key, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -298,11 +282,11 @@ func (a *LabelsApiService) DatacentersLabelsFindByKeyExecute(r ApiDatacentersLab localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -321,11 +305,11 @@ func (a *LabelsApiService) DatacentersLabelsFindByKeyExecute(r ApiDatacentersLab localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersLabelsFindByKey", } @@ -341,28 +325,26 @@ func (a *LabelsApiService) DatacentersLabelsFindByKeyExecute(r ApiDatacentersLab } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -396,7 +378,7 @@ func (r ApiDatacentersLabelsGetRequest) XContractNumber(xContractNumber int32) A // Filters query parameters limit results to those containing a matching value for a specific property. func (r ApiDatacentersLabelsGetRequest) Filter(key string, value string) ApiDatacentersLabelsGetRequest { - filterKey := fmt.Sprintf(FilterQueryParam, key) + filterKey := fmt.Sprintf("filter.%s", key) r.filters[filterKey] = append(r.filters[filterKey], value) return r } @@ -413,7 +395,7 @@ func (r ApiDatacentersLabelsGetRequest) MaxResults(maxResults int32) ApiDatacent return r } -func (r ApiDatacentersLabelsGetRequest) Execute() (LabelResources, *APIResponse, error) { +func (r ApiDatacentersLabelsGetRequest) Execute() (LabelResources, *shared.APIResponse, error) { return r.ApiService.DatacentersLabelsGetExecute(r) } @@ -437,7 +419,7 @@ func (a *LabelsApiService) DatacentersLabelsGet(ctx _context.Context, datacenter * Execute executes the request * @return LabelResources */ -func (a *LabelsApiService) DatacentersLabelsGetExecute(r ApiDatacentersLabelsGetRequest) (LabelResources, *APIResponse, error) { +func (a *LabelsApiService) DatacentersLabelsGetExecute(r ApiDatacentersLabelsGetRequest) (LabelResources, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -449,31 +431,23 @@ func (a *LabelsApiService) DatacentersLabelsGetExecute(r ApiDatacentersLabelsGet localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LabelsApiService.DatacentersLabelsGet") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/labels" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } if r.orderBy != nil { localVarQueryParams.Add("orderBy", parameterToString(*r.orderBy, "")) @@ -507,11 +481,11 @@ func (a *LabelsApiService) DatacentersLabelsGetExecute(r ApiDatacentersLabelsGet localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -530,11 +504,11 @@ func (a *LabelsApiService) DatacentersLabelsGetExecute(r ApiDatacentersLabelsGet localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersLabelsGet", } @@ -550,28 +524,26 @@ func (a *LabelsApiService) DatacentersLabelsGetExecute(r ApiDatacentersLabelsGet } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -605,7 +577,7 @@ func (r ApiDatacentersLabelsPostRequest) XContractNumber(xContractNumber int32) return r } -func (r ApiDatacentersLabelsPostRequest) Execute() (LabelResource, *APIResponse, error) { +func (r ApiDatacentersLabelsPostRequest) Execute() (LabelResource, *shared.APIResponse, error) { return r.ApiService.DatacentersLabelsPostExecute(r) } @@ -628,7 +600,7 @@ func (a *LabelsApiService) DatacentersLabelsPost(ctx _context.Context, datacente * Execute executes the request * @return LabelResource */ -func (a *LabelsApiService) DatacentersLabelsPostExecute(r ApiDatacentersLabelsPostRequest) (LabelResource, *APIResponse, error) { +func (a *LabelsApiService) DatacentersLabelsPostExecute(r ApiDatacentersLabelsPostRequest) (LabelResource, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -640,11 +612,13 @@ func (a *LabelsApiService) DatacentersLabelsPostExecute(r ApiDatacentersLabelsPo localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LabelsApiService.DatacentersLabelsPost") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/labels" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -654,20 +628,10 @@ func (a *LabelsApiService) DatacentersLabelsPostExecute(r ApiDatacentersLabelsPo } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -688,13 +652,13 @@ func (a *LabelsApiService) DatacentersLabelsPostExecute(r ApiDatacentersLabelsPo localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.label if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -713,11 +677,11 @@ func (a *LabelsApiService) DatacentersLabelsPostExecute(r ApiDatacentersLabelsPo localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersLabelsPost", } @@ -733,28 +697,26 @@ func (a *LabelsApiService) DatacentersLabelsPostExecute(r ApiDatacentersLabelsPo } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -789,7 +751,7 @@ func (r ApiDatacentersLabelsPutRequest) XContractNumber(xContractNumber int32) A return r } -func (r ApiDatacentersLabelsPutRequest) Execute() (LabelResource, *APIResponse, error) { +func (r ApiDatacentersLabelsPutRequest) Execute() (LabelResource, *shared.APIResponse, error) { return r.ApiService.DatacentersLabelsPutExecute(r) } @@ -814,7 +776,7 @@ func (a *LabelsApiService) DatacentersLabelsPut(ctx _context.Context, datacenter * Execute executes the request * @return LabelResource */ -func (a *LabelsApiService) DatacentersLabelsPutExecute(r ApiDatacentersLabelsPutRequest) (LabelResource, *APIResponse, error) { +func (a *LabelsApiService) DatacentersLabelsPutExecute(r ApiDatacentersLabelsPutRequest) (LabelResource, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPut localVarPostBody interface{} @@ -826,12 +788,14 @@ func (a *LabelsApiService) DatacentersLabelsPutExecute(r ApiDatacentersLabelsPut localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LabelsApiService.DatacentersLabelsPut") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/labels/{key}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"key"+"}", _neturl.PathEscape(parameterToString(r.key, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"key"+"}", _neturl.PathEscape(parameterValueToString(r.key, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -841,20 +805,10 @@ func (a *LabelsApiService) DatacentersLabelsPutExecute(r ApiDatacentersLabelsPut } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -875,13 +829,13 @@ func (a *LabelsApiService) DatacentersLabelsPutExecute(r ApiDatacentersLabelsPut localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.label if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -900,11 +854,11 @@ func (a *LabelsApiService) DatacentersLabelsPutExecute(r ApiDatacentersLabelsPut localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersLabelsPut", } @@ -920,28 +874,26 @@ func (a *LabelsApiService) DatacentersLabelsPutExecute(r ApiDatacentersLabelsPut } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -972,7 +924,7 @@ func (r ApiDatacentersServersLabelsDeleteRequest) XContractNumber(xContractNumbe return r } -func (r ApiDatacentersServersLabelsDeleteRequest) Execute() (*APIResponse, error) { +func (r ApiDatacentersServersLabelsDeleteRequest) Execute() (*shared.APIResponse, error) { return r.ApiService.DatacentersServersLabelsDeleteExecute(r) } @@ -998,7 +950,7 @@ func (a *LabelsApiService) DatacentersServersLabelsDelete(ctx _context.Context, /* * Execute executes the request */ -func (a *LabelsApiService) DatacentersServersLabelsDeleteExecute(r ApiDatacentersServersLabelsDeleteRequest) (*APIResponse, error) { +func (a *LabelsApiService) DatacentersServersLabelsDeleteExecute(r ApiDatacentersServersLabelsDeleteRequest) (*shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodDelete localVarPostBody interface{} @@ -1009,33 +961,25 @@ func (a *LabelsApiService) DatacentersServersLabelsDeleteExecute(r ApiDatacenter localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LabelsApiService.DatacentersServersLabelsDelete") if err != nil { - return nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/servers/{serverId}/labels/{key}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterToString(r.serverId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"key"+"}", _neturl.PathEscape(parameterToString(r.key, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterValueToString(r.serverId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"key"+"}", _neturl.PathEscape(parameterValueToString(r.key, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -1056,11 +1000,11 @@ func (a *LabelsApiService) DatacentersServersLabelsDeleteExecute(r ApiDatacenter localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -1079,11 +1023,11 @@ func (a *LabelsApiService) DatacentersServersLabelsDeleteExecute(r ApiDatacenter localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersServersLabelsDelete", } @@ -1099,18 +1043,17 @@ func (a *LabelsApiService) DatacentersServersLabelsDeleteExecute(r ApiDatacenter } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarAPIResponse, newErr } @@ -1141,7 +1084,7 @@ func (r ApiDatacentersServersLabelsFindByKeyRequest) XContractNumber(xContractNu return r } -func (r ApiDatacentersServersLabelsFindByKeyRequest) Execute() (LabelResource, *APIResponse, error) { +func (r ApiDatacentersServersLabelsFindByKeyRequest) Execute() (LabelResource, *shared.APIResponse, error) { return r.ApiService.DatacentersServersLabelsFindByKeyExecute(r) } @@ -1168,7 +1111,7 @@ func (a *LabelsApiService) DatacentersServersLabelsFindByKey(ctx _context.Contex * Execute executes the request * @return LabelResource */ -func (a *LabelsApiService) DatacentersServersLabelsFindByKeyExecute(r ApiDatacentersServersLabelsFindByKeyRequest) (LabelResource, *APIResponse, error) { +func (a *LabelsApiService) DatacentersServersLabelsFindByKeyExecute(r ApiDatacentersServersLabelsFindByKeyRequest) (LabelResource, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -1180,33 +1123,25 @@ func (a *LabelsApiService) DatacentersServersLabelsFindByKeyExecute(r ApiDatacen localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LabelsApiService.DatacentersServersLabelsFindByKey") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/servers/{serverId}/labels/{key}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterToString(r.serverId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"key"+"}", _neturl.PathEscape(parameterToString(r.key, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterValueToString(r.serverId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"key"+"}", _neturl.PathEscape(parameterValueToString(r.key, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -1227,11 +1162,11 @@ func (a *LabelsApiService) DatacentersServersLabelsFindByKeyExecute(r ApiDatacen localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -1250,11 +1185,11 @@ func (a *LabelsApiService) DatacentersServersLabelsFindByKeyExecute(r ApiDatacen localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersServersLabelsFindByKey", } @@ -1270,28 +1205,26 @@ func (a *LabelsApiService) DatacentersServersLabelsFindByKeyExecute(r ApiDatacen } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -1326,7 +1259,7 @@ func (r ApiDatacentersServersLabelsGetRequest) XContractNumber(xContractNumber i // Filters query parameters limit results to those containing a matching value for a specific property. func (r ApiDatacentersServersLabelsGetRequest) Filter(key string, value string) ApiDatacentersServersLabelsGetRequest { - filterKey := fmt.Sprintf(FilterQueryParam, key) + filterKey := fmt.Sprintf("filter.%s", key) r.filters[filterKey] = append(r.filters[filterKey], value) return r } @@ -1343,7 +1276,7 @@ func (r ApiDatacentersServersLabelsGetRequest) MaxResults(maxResults int32) ApiD return r } -func (r ApiDatacentersServersLabelsGetRequest) Execute() (LabelResources, *APIResponse, error) { +func (r ApiDatacentersServersLabelsGetRequest) Execute() (LabelResources, *shared.APIResponse, error) { return r.ApiService.DatacentersServersLabelsGetExecute(r) } @@ -1369,7 +1302,7 @@ func (a *LabelsApiService) DatacentersServersLabelsGet(ctx _context.Context, dat * Execute executes the request * @return LabelResources */ -func (a *LabelsApiService) DatacentersServersLabelsGetExecute(r ApiDatacentersServersLabelsGetRequest) (LabelResources, *APIResponse, error) { +func (a *LabelsApiService) DatacentersServersLabelsGetExecute(r ApiDatacentersServersLabelsGetRequest) (LabelResources, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -1381,32 +1314,24 @@ func (a *LabelsApiService) DatacentersServersLabelsGetExecute(r ApiDatacentersSe localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LabelsApiService.DatacentersServersLabelsGet") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/servers/{serverId}/labels" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterToString(r.serverId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterValueToString(r.serverId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } if r.orderBy != nil { localVarQueryParams.Add("orderBy", parameterToString(*r.orderBy, "")) @@ -1440,11 +1365,11 @@ func (a *LabelsApiService) DatacentersServersLabelsGetExecute(r ApiDatacentersSe localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -1463,11 +1388,11 @@ func (a *LabelsApiService) DatacentersServersLabelsGetExecute(r ApiDatacentersSe localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersServersLabelsGet", } @@ -1483,28 +1408,26 @@ func (a *LabelsApiService) DatacentersServersLabelsGetExecute(r ApiDatacentersSe } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -1539,7 +1462,7 @@ func (r ApiDatacentersServersLabelsPostRequest) XContractNumber(xContractNumber return r } -func (r ApiDatacentersServersLabelsPostRequest) Execute() (LabelResource, *APIResponse, error) { +func (r ApiDatacentersServersLabelsPostRequest) Execute() (LabelResource, *shared.APIResponse, error) { return r.ApiService.DatacentersServersLabelsPostExecute(r) } @@ -1564,7 +1487,7 @@ func (a *LabelsApiService) DatacentersServersLabelsPost(ctx _context.Context, da * Execute executes the request * @return LabelResource */ -func (a *LabelsApiService) DatacentersServersLabelsPostExecute(r ApiDatacentersServersLabelsPostRequest) (LabelResource, *APIResponse, error) { +func (a *LabelsApiService) DatacentersServersLabelsPostExecute(r ApiDatacentersServersLabelsPostRequest) (LabelResource, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -1576,12 +1499,14 @@ func (a *LabelsApiService) DatacentersServersLabelsPostExecute(r ApiDatacentersS localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LabelsApiService.DatacentersServersLabelsPost") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/servers/{serverId}/labels" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterToString(r.serverId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterValueToString(r.serverId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -1591,20 +1516,10 @@ func (a *LabelsApiService) DatacentersServersLabelsPostExecute(r ApiDatacentersS } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -1625,13 +1540,13 @@ func (a *LabelsApiService) DatacentersServersLabelsPostExecute(r ApiDatacentersS localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.label if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -1650,11 +1565,11 @@ func (a *LabelsApiService) DatacentersServersLabelsPostExecute(r ApiDatacentersS localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersServersLabelsPost", } @@ -1670,28 +1585,26 @@ func (a *LabelsApiService) DatacentersServersLabelsPostExecute(r ApiDatacentersS } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -1727,7 +1640,7 @@ func (r ApiDatacentersServersLabelsPutRequest) XContractNumber(xContractNumber i return r } -func (r ApiDatacentersServersLabelsPutRequest) Execute() (LabelResource, *APIResponse, error) { +func (r ApiDatacentersServersLabelsPutRequest) Execute() (LabelResource, *shared.APIResponse, error) { return r.ApiService.DatacentersServersLabelsPutExecute(r) } @@ -1754,7 +1667,7 @@ func (a *LabelsApiService) DatacentersServersLabelsPut(ctx _context.Context, dat * Execute executes the request * @return LabelResource */ -func (a *LabelsApiService) DatacentersServersLabelsPutExecute(r ApiDatacentersServersLabelsPutRequest) (LabelResource, *APIResponse, error) { +func (a *LabelsApiService) DatacentersServersLabelsPutExecute(r ApiDatacentersServersLabelsPutRequest) (LabelResource, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPut localVarPostBody interface{} @@ -1766,13 +1679,15 @@ func (a *LabelsApiService) DatacentersServersLabelsPutExecute(r ApiDatacentersSe localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LabelsApiService.DatacentersServersLabelsPut") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/servers/{serverId}/labels/{key}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterToString(r.serverId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"key"+"}", _neturl.PathEscape(parameterToString(r.key, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterValueToString(r.serverId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"key"+"}", _neturl.PathEscape(parameterValueToString(r.key, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -1782,20 +1697,10 @@ func (a *LabelsApiService) DatacentersServersLabelsPutExecute(r ApiDatacentersSe } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -1816,13 +1721,13 @@ func (a *LabelsApiService) DatacentersServersLabelsPutExecute(r ApiDatacentersSe localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.label if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -1841,11 +1746,11 @@ func (a *LabelsApiService) DatacentersServersLabelsPutExecute(r ApiDatacentersSe localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersServersLabelsPut", } @@ -1861,28 +1766,26 @@ func (a *LabelsApiService) DatacentersServersLabelsPutExecute(r ApiDatacentersSe } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -1913,7 +1816,7 @@ func (r ApiDatacentersVolumesLabelsDeleteRequest) XContractNumber(xContractNumbe return r } -func (r ApiDatacentersVolumesLabelsDeleteRequest) Execute() (*APIResponse, error) { +func (r ApiDatacentersVolumesLabelsDeleteRequest) Execute() (*shared.APIResponse, error) { return r.ApiService.DatacentersVolumesLabelsDeleteExecute(r) } @@ -1939,7 +1842,7 @@ func (a *LabelsApiService) DatacentersVolumesLabelsDelete(ctx _context.Context, /* * Execute executes the request */ -func (a *LabelsApiService) DatacentersVolumesLabelsDeleteExecute(r ApiDatacentersVolumesLabelsDeleteRequest) (*APIResponse, error) { +func (a *LabelsApiService) DatacentersVolumesLabelsDeleteExecute(r ApiDatacentersVolumesLabelsDeleteRequest) (*shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodDelete localVarPostBody interface{} @@ -1950,33 +1853,25 @@ func (a *LabelsApiService) DatacentersVolumesLabelsDeleteExecute(r ApiDatacenter localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LabelsApiService.DatacentersVolumesLabelsDelete") if err != nil { - return nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/volumes/{volumeId}/labels/{key}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"volumeId"+"}", _neturl.PathEscape(parameterToString(r.volumeId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"key"+"}", _neturl.PathEscape(parameterToString(r.key, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"volumeId"+"}", _neturl.PathEscape(parameterValueToString(r.volumeId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"key"+"}", _neturl.PathEscape(parameterValueToString(r.key, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -1997,11 +1892,11 @@ func (a *LabelsApiService) DatacentersVolumesLabelsDeleteExecute(r ApiDatacenter localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -2020,11 +1915,11 @@ func (a *LabelsApiService) DatacentersVolumesLabelsDeleteExecute(r ApiDatacenter localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersVolumesLabelsDelete", } @@ -2040,18 +1935,17 @@ func (a *LabelsApiService) DatacentersVolumesLabelsDeleteExecute(r ApiDatacenter } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarAPIResponse, newErr } @@ -2082,7 +1976,7 @@ func (r ApiDatacentersVolumesLabelsFindByKeyRequest) XContractNumber(xContractNu return r } -func (r ApiDatacentersVolumesLabelsFindByKeyRequest) Execute() (LabelResource, *APIResponse, error) { +func (r ApiDatacentersVolumesLabelsFindByKeyRequest) Execute() (LabelResource, *shared.APIResponse, error) { return r.ApiService.DatacentersVolumesLabelsFindByKeyExecute(r) } @@ -2109,7 +2003,7 @@ func (a *LabelsApiService) DatacentersVolumesLabelsFindByKey(ctx _context.Contex * Execute executes the request * @return LabelResource */ -func (a *LabelsApiService) DatacentersVolumesLabelsFindByKeyExecute(r ApiDatacentersVolumesLabelsFindByKeyRequest) (LabelResource, *APIResponse, error) { +func (a *LabelsApiService) DatacentersVolumesLabelsFindByKeyExecute(r ApiDatacentersVolumesLabelsFindByKeyRequest) (LabelResource, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -2121,33 +2015,25 @@ func (a *LabelsApiService) DatacentersVolumesLabelsFindByKeyExecute(r ApiDatacen localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LabelsApiService.DatacentersVolumesLabelsFindByKey") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/volumes/{volumeId}/labels/{key}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"volumeId"+"}", _neturl.PathEscape(parameterToString(r.volumeId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"key"+"}", _neturl.PathEscape(parameterToString(r.key, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"volumeId"+"}", _neturl.PathEscape(parameterValueToString(r.volumeId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"key"+"}", _neturl.PathEscape(parameterValueToString(r.key, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -2168,11 +2054,11 @@ func (a *LabelsApiService) DatacentersVolumesLabelsFindByKeyExecute(r ApiDatacen localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -2191,11 +2077,11 @@ func (a *LabelsApiService) DatacentersVolumesLabelsFindByKeyExecute(r ApiDatacen localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersVolumesLabelsFindByKey", } @@ -2211,28 +2097,26 @@ func (a *LabelsApiService) DatacentersVolumesLabelsFindByKeyExecute(r ApiDatacen } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -2267,7 +2151,7 @@ func (r ApiDatacentersVolumesLabelsGetRequest) XContractNumber(xContractNumber i // Filters query parameters limit results to those containing a matching value for a specific property. func (r ApiDatacentersVolumesLabelsGetRequest) Filter(key string, value string) ApiDatacentersVolumesLabelsGetRequest { - filterKey := fmt.Sprintf(FilterQueryParam, key) + filterKey := fmt.Sprintf("filter.%s", key) r.filters[filterKey] = append(r.filters[filterKey], value) return r } @@ -2284,7 +2168,7 @@ func (r ApiDatacentersVolumesLabelsGetRequest) MaxResults(maxResults int32) ApiD return r } -func (r ApiDatacentersVolumesLabelsGetRequest) Execute() (LabelResources, *APIResponse, error) { +func (r ApiDatacentersVolumesLabelsGetRequest) Execute() (LabelResources, *shared.APIResponse, error) { return r.ApiService.DatacentersVolumesLabelsGetExecute(r) } @@ -2310,7 +2194,7 @@ func (a *LabelsApiService) DatacentersVolumesLabelsGet(ctx _context.Context, dat * Execute executes the request * @return LabelResources */ -func (a *LabelsApiService) DatacentersVolumesLabelsGetExecute(r ApiDatacentersVolumesLabelsGetRequest) (LabelResources, *APIResponse, error) { +func (a *LabelsApiService) DatacentersVolumesLabelsGetExecute(r ApiDatacentersVolumesLabelsGetRequest) (LabelResources, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -2322,32 +2206,24 @@ func (a *LabelsApiService) DatacentersVolumesLabelsGetExecute(r ApiDatacentersVo localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LabelsApiService.DatacentersVolumesLabelsGet") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/volumes/{volumeId}/labels" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"volumeId"+"}", _neturl.PathEscape(parameterToString(r.volumeId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"volumeId"+"}", _neturl.PathEscape(parameterValueToString(r.volumeId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } if r.orderBy != nil { localVarQueryParams.Add("orderBy", parameterToString(*r.orderBy, "")) @@ -2381,11 +2257,11 @@ func (a *LabelsApiService) DatacentersVolumesLabelsGetExecute(r ApiDatacentersVo localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -2404,11 +2280,11 @@ func (a *LabelsApiService) DatacentersVolumesLabelsGetExecute(r ApiDatacentersVo localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersVolumesLabelsGet", } @@ -2424,28 +2300,26 @@ func (a *LabelsApiService) DatacentersVolumesLabelsGetExecute(r ApiDatacentersVo } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -2480,7 +2354,7 @@ func (r ApiDatacentersVolumesLabelsPostRequest) XContractNumber(xContractNumber return r } -func (r ApiDatacentersVolumesLabelsPostRequest) Execute() (LabelResource, *APIResponse, error) { +func (r ApiDatacentersVolumesLabelsPostRequest) Execute() (LabelResource, *shared.APIResponse, error) { return r.ApiService.DatacentersVolumesLabelsPostExecute(r) } @@ -2505,7 +2379,7 @@ func (a *LabelsApiService) DatacentersVolumesLabelsPost(ctx _context.Context, da * Execute executes the request * @return LabelResource */ -func (a *LabelsApiService) DatacentersVolumesLabelsPostExecute(r ApiDatacentersVolumesLabelsPostRequest) (LabelResource, *APIResponse, error) { +func (a *LabelsApiService) DatacentersVolumesLabelsPostExecute(r ApiDatacentersVolumesLabelsPostRequest) (LabelResource, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -2517,12 +2391,14 @@ func (a *LabelsApiService) DatacentersVolumesLabelsPostExecute(r ApiDatacentersV localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LabelsApiService.DatacentersVolumesLabelsPost") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/volumes/{volumeId}/labels" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"volumeId"+"}", _neturl.PathEscape(parameterToString(r.volumeId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"volumeId"+"}", _neturl.PathEscape(parameterValueToString(r.volumeId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -2532,20 +2408,10 @@ func (a *LabelsApiService) DatacentersVolumesLabelsPostExecute(r ApiDatacentersV } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -2566,13 +2432,13 @@ func (a *LabelsApiService) DatacentersVolumesLabelsPostExecute(r ApiDatacentersV localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.label if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -2591,11 +2457,11 @@ func (a *LabelsApiService) DatacentersVolumesLabelsPostExecute(r ApiDatacentersV localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersVolumesLabelsPost", } @@ -2611,28 +2477,26 @@ func (a *LabelsApiService) DatacentersVolumesLabelsPostExecute(r ApiDatacentersV } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -2668,7 +2532,7 @@ func (r ApiDatacentersVolumesLabelsPutRequest) XContractNumber(xContractNumber i return r } -func (r ApiDatacentersVolumesLabelsPutRequest) Execute() (LabelResource, *APIResponse, error) { +func (r ApiDatacentersVolumesLabelsPutRequest) Execute() (LabelResource, *shared.APIResponse, error) { return r.ApiService.DatacentersVolumesLabelsPutExecute(r) } @@ -2695,7 +2559,7 @@ func (a *LabelsApiService) DatacentersVolumesLabelsPut(ctx _context.Context, dat * Execute executes the request * @return LabelResource */ -func (a *LabelsApiService) DatacentersVolumesLabelsPutExecute(r ApiDatacentersVolumesLabelsPutRequest) (LabelResource, *APIResponse, error) { +func (a *LabelsApiService) DatacentersVolumesLabelsPutExecute(r ApiDatacentersVolumesLabelsPutRequest) (LabelResource, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPut localVarPostBody interface{} @@ -2707,13 +2571,15 @@ func (a *LabelsApiService) DatacentersVolumesLabelsPutExecute(r ApiDatacentersVo localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LabelsApiService.DatacentersVolumesLabelsPut") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/volumes/{volumeId}/labels/{key}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"volumeId"+"}", _neturl.PathEscape(parameterToString(r.volumeId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"key"+"}", _neturl.PathEscape(parameterToString(r.key, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"volumeId"+"}", _neturl.PathEscape(parameterValueToString(r.volumeId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"key"+"}", _neturl.PathEscape(parameterValueToString(r.key, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -2723,20 +2589,10 @@ func (a *LabelsApiService) DatacentersVolumesLabelsPutExecute(r ApiDatacentersVo } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -2757,13 +2613,13 @@ func (a *LabelsApiService) DatacentersVolumesLabelsPutExecute(r ApiDatacentersVo localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.label if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -2782,11 +2638,11 @@ func (a *LabelsApiService) DatacentersVolumesLabelsPutExecute(r ApiDatacentersVo localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersVolumesLabelsPut", } @@ -2802,28 +2658,26 @@ func (a *LabelsApiService) DatacentersVolumesLabelsPutExecute(r ApiDatacentersVo } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -2853,7 +2707,7 @@ func (r ApiImagesLabelsDeleteRequest) XContractNumber(xContractNumber int32) Api return r } -func (r ApiImagesLabelsDeleteRequest) Execute() (*APIResponse, error) { +func (r ApiImagesLabelsDeleteRequest) Execute() (*shared.APIResponse, error) { return r.ApiService.ImagesLabelsDeleteExecute(r) } @@ -2877,7 +2731,7 @@ func (a *LabelsApiService) ImagesLabelsDelete(ctx _context.Context, imageId stri /* * Execute executes the request */ -func (a *LabelsApiService) ImagesLabelsDeleteExecute(r ApiImagesLabelsDeleteRequest) (*APIResponse, error) { +func (a *LabelsApiService) ImagesLabelsDeleteExecute(r ApiImagesLabelsDeleteRequest) (*shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodDelete localVarPostBody interface{} @@ -2888,32 +2742,24 @@ func (a *LabelsApiService) ImagesLabelsDeleteExecute(r ApiImagesLabelsDeleteRequ localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LabelsApiService.ImagesLabelsDelete") if err != nil { - return nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return nil, gerr } localVarPath := localBasePath + "/images/{imageId}/labels/{key}" - localVarPath = strings.Replace(localVarPath, "{"+"imageId"+"}", _neturl.PathEscape(parameterToString(r.imageId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"key"+"}", _neturl.PathEscape(parameterToString(r.key, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"imageId"+"}", _neturl.PathEscape(parameterValueToString(r.imageId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"key"+"}", _neturl.PathEscape(parameterValueToString(r.key, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -2934,11 +2780,11 @@ func (a *LabelsApiService) ImagesLabelsDeleteExecute(r ApiImagesLabelsDeleteRequ localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -2957,11 +2803,11 @@ func (a *LabelsApiService) ImagesLabelsDeleteExecute(r ApiImagesLabelsDeleteRequ localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "ImagesLabelsDelete", } @@ -2977,18 +2823,17 @@ func (a *LabelsApiService) ImagesLabelsDeleteExecute(r ApiImagesLabelsDeleteRequ } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarAPIResponse, newErr } @@ -3018,7 +2863,7 @@ func (r ApiImagesLabelsFindByKeyRequest) XContractNumber(xContractNumber int32) return r } -func (r ApiImagesLabelsFindByKeyRequest) Execute() (LabelResource, *APIResponse, error) { +func (r ApiImagesLabelsFindByKeyRequest) Execute() (LabelResource, *shared.APIResponse, error) { return r.ApiService.ImagesLabelsFindByKeyExecute(r) } @@ -3043,7 +2888,7 @@ func (a *LabelsApiService) ImagesLabelsFindByKey(ctx _context.Context, imageId s * Execute executes the request * @return LabelResource */ -func (a *LabelsApiService) ImagesLabelsFindByKeyExecute(r ApiImagesLabelsFindByKeyRequest) (LabelResource, *APIResponse, error) { +func (a *LabelsApiService) ImagesLabelsFindByKeyExecute(r ApiImagesLabelsFindByKeyRequest) (LabelResource, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -3055,32 +2900,24 @@ func (a *LabelsApiService) ImagesLabelsFindByKeyExecute(r ApiImagesLabelsFindByK localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LabelsApiService.ImagesLabelsFindByKey") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/images/{imageId}/labels/{key}" - localVarPath = strings.Replace(localVarPath, "{"+"imageId"+"}", _neturl.PathEscape(parameterToString(r.imageId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"key"+"}", _neturl.PathEscape(parameterToString(r.key, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"imageId"+"}", _neturl.PathEscape(parameterValueToString(r.imageId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"key"+"}", _neturl.PathEscape(parameterValueToString(r.key, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -3101,11 +2938,11 @@ func (a *LabelsApiService) ImagesLabelsFindByKeyExecute(r ApiImagesLabelsFindByK localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -3124,11 +2961,11 @@ func (a *LabelsApiService) ImagesLabelsFindByKeyExecute(r ApiImagesLabelsFindByK localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "ImagesLabelsFindByKey", } @@ -3144,28 +2981,26 @@ func (a *LabelsApiService) ImagesLabelsFindByKeyExecute(r ApiImagesLabelsFindByK } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -3199,7 +3034,7 @@ func (r ApiImagesLabelsGetRequest) XContractNumber(xContractNumber int32) ApiIma // Filters query parameters limit results to those containing a matching value for a specific property. func (r ApiImagesLabelsGetRequest) Filter(key string, value string) ApiImagesLabelsGetRequest { - filterKey := fmt.Sprintf(FilterQueryParam, key) + filterKey := fmt.Sprintf("filter.%s", key) r.filters[filterKey] = append(r.filters[filterKey], value) return r } @@ -3216,7 +3051,7 @@ func (r ApiImagesLabelsGetRequest) MaxResults(maxResults int32) ApiImagesLabelsG return r } -func (r ApiImagesLabelsGetRequest) Execute() (LabelResources, *APIResponse, error) { +func (r ApiImagesLabelsGetRequest) Execute() (LabelResources, *shared.APIResponse, error) { return r.ApiService.ImagesLabelsGetExecute(r) } @@ -3240,7 +3075,7 @@ func (a *LabelsApiService) ImagesLabelsGet(ctx _context.Context, imageId string) * Execute executes the request * @return LabelResources */ -func (a *LabelsApiService) ImagesLabelsGetExecute(r ApiImagesLabelsGetRequest) (LabelResources, *APIResponse, error) { +func (a *LabelsApiService) ImagesLabelsGetExecute(r ApiImagesLabelsGetRequest) (LabelResources, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -3252,31 +3087,23 @@ func (a *LabelsApiService) ImagesLabelsGetExecute(r ApiImagesLabelsGetRequest) ( localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LabelsApiService.ImagesLabelsGet") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/images/{imageId}/labels" - localVarPath = strings.Replace(localVarPath, "{"+"imageId"+"}", _neturl.PathEscape(parameterToString(r.imageId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"imageId"+"}", _neturl.PathEscape(parameterValueToString(r.imageId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } if r.orderBy != nil { localVarQueryParams.Add("orderBy", parameterToString(*r.orderBy, "")) @@ -3310,11 +3137,11 @@ func (a *LabelsApiService) ImagesLabelsGetExecute(r ApiImagesLabelsGetRequest) ( localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -3333,11 +3160,11 @@ func (a *LabelsApiService) ImagesLabelsGetExecute(r ApiImagesLabelsGetRequest) ( localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "ImagesLabelsGet", } @@ -3353,28 +3180,26 @@ func (a *LabelsApiService) ImagesLabelsGetExecute(r ApiImagesLabelsGetRequest) ( } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -3408,7 +3233,7 @@ func (r ApiImagesLabelsPostRequest) XContractNumber(xContractNumber int32) ApiIm return r } -func (r ApiImagesLabelsPostRequest) Execute() (LabelResource, *APIResponse, error) { +func (r ApiImagesLabelsPostRequest) Execute() (LabelResource, *shared.APIResponse, error) { return r.ApiService.ImagesLabelsPostExecute(r) } @@ -3431,7 +3256,7 @@ func (a *LabelsApiService) ImagesLabelsPost(ctx _context.Context, imageId string * Execute executes the request * @return LabelResource */ -func (a *LabelsApiService) ImagesLabelsPostExecute(r ApiImagesLabelsPostRequest) (LabelResource, *APIResponse, error) { +func (a *LabelsApiService) ImagesLabelsPostExecute(r ApiImagesLabelsPostRequest) (LabelResource, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -3443,11 +3268,13 @@ func (a *LabelsApiService) ImagesLabelsPostExecute(r ApiImagesLabelsPostRequest) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LabelsApiService.ImagesLabelsPost") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/images/{imageId}/labels" - localVarPath = strings.Replace(localVarPath, "{"+"imageId"+"}", _neturl.PathEscape(parameterToString(r.imageId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"imageId"+"}", _neturl.PathEscape(parameterValueToString(r.imageId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -3457,20 +3284,10 @@ func (a *LabelsApiService) ImagesLabelsPostExecute(r ApiImagesLabelsPostRequest) } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -3491,13 +3308,13 @@ func (a *LabelsApiService) ImagesLabelsPostExecute(r ApiImagesLabelsPostRequest) localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.label if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -3516,11 +3333,11 @@ func (a *LabelsApiService) ImagesLabelsPostExecute(r ApiImagesLabelsPostRequest) localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "ImagesLabelsPost", } @@ -3536,28 +3353,26 @@ func (a *LabelsApiService) ImagesLabelsPostExecute(r ApiImagesLabelsPostRequest) } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -3592,7 +3407,7 @@ func (r ApiImagesLabelsPutRequest) XContractNumber(xContractNumber int32) ApiIma return r } -func (r ApiImagesLabelsPutRequest) Execute() (LabelResource, *APIResponse, error) { +func (r ApiImagesLabelsPutRequest) Execute() (LabelResource, *shared.APIResponse, error) { return r.ApiService.ImagesLabelsPutExecute(r) } @@ -3617,7 +3432,7 @@ func (a *LabelsApiService) ImagesLabelsPut(ctx _context.Context, imageId string, * Execute executes the request * @return LabelResource */ -func (a *LabelsApiService) ImagesLabelsPutExecute(r ApiImagesLabelsPutRequest) (LabelResource, *APIResponse, error) { +func (a *LabelsApiService) ImagesLabelsPutExecute(r ApiImagesLabelsPutRequest) (LabelResource, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPut localVarPostBody interface{} @@ -3629,12 +3444,14 @@ func (a *LabelsApiService) ImagesLabelsPutExecute(r ApiImagesLabelsPutRequest) ( localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LabelsApiService.ImagesLabelsPut") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/images/{imageId}/labels/{key}" - localVarPath = strings.Replace(localVarPath, "{"+"imageId"+"}", _neturl.PathEscape(parameterToString(r.imageId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"key"+"}", _neturl.PathEscape(parameterToString(r.key, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"imageId"+"}", _neturl.PathEscape(parameterValueToString(r.imageId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"key"+"}", _neturl.PathEscape(parameterValueToString(r.key, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -3644,20 +3461,10 @@ func (a *LabelsApiService) ImagesLabelsPutExecute(r ApiImagesLabelsPutRequest) ( } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -3678,13 +3485,13 @@ func (a *LabelsApiService) ImagesLabelsPutExecute(r ApiImagesLabelsPutRequest) ( localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.label if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -3703,11 +3510,11 @@ func (a *LabelsApiService) ImagesLabelsPutExecute(r ApiImagesLabelsPutRequest) ( localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "ImagesLabelsPut", } @@ -3723,28 +3530,26 @@ func (a *LabelsApiService) ImagesLabelsPutExecute(r ApiImagesLabelsPutRequest) ( } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -3774,7 +3579,7 @@ func (r ApiIpblocksLabelsDeleteRequest) XContractNumber(xContractNumber int32) A return r } -func (r ApiIpblocksLabelsDeleteRequest) Execute() (*APIResponse, error) { +func (r ApiIpblocksLabelsDeleteRequest) Execute() (*shared.APIResponse, error) { return r.ApiService.IpblocksLabelsDeleteExecute(r) } @@ -3798,7 +3603,7 @@ func (a *LabelsApiService) IpblocksLabelsDelete(ctx _context.Context, ipblockId /* * Execute executes the request */ -func (a *LabelsApiService) IpblocksLabelsDeleteExecute(r ApiIpblocksLabelsDeleteRequest) (*APIResponse, error) { +func (a *LabelsApiService) IpblocksLabelsDeleteExecute(r ApiIpblocksLabelsDeleteRequest) (*shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodDelete localVarPostBody interface{} @@ -3809,32 +3614,24 @@ func (a *LabelsApiService) IpblocksLabelsDeleteExecute(r ApiIpblocksLabelsDelete localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LabelsApiService.IpblocksLabelsDelete") if err != nil { - return nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return nil, gerr } localVarPath := localBasePath + "/ipblocks/{ipblockId}/labels/{key}" - localVarPath = strings.Replace(localVarPath, "{"+"ipblockId"+"}", _neturl.PathEscape(parameterToString(r.ipblockId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"key"+"}", _neturl.PathEscape(parameterToString(r.key, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"ipblockId"+"}", _neturl.PathEscape(parameterValueToString(r.ipblockId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"key"+"}", _neturl.PathEscape(parameterValueToString(r.key, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -3855,11 +3652,11 @@ func (a *LabelsApiService) IpblocksLabelsDeleteExecute(r ApiIpblocksLabelsDelete localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -3878,11 +3675,11 @@ func (a *LabelsApiService) IpblocksLabelsDeleteExecute(r ApiIpblocksLabelsDelete localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "IpblocksLabelsDelete", } @@ -3898,18 +3695,17 @@ func (a *LabelsApiService) IpblocksLabelsDeleteExecute(r ApiIpblocksLabelsDelete } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarAPIResponse, newErr } @@ -3939,7 +3735,7 @@ func (r ApiIpblocksLabelsFindByKeyRequest) XContractNumber(xContractNumber int32 return r } -func (r ApiIpblocksLabelsFindByKeyRequest) Execute() (LabelResource, *APIResponse, error) { +func (r ApiIpblocksLabelsFindByKeyRequest) Execute() (LabelResource, *shared.APIResponse, error) { return r.ApiService.IpblocksLabelsFindByKeyExecute(r) } @@ -3964,7 +3760,7 @@ func (a *LabelsApiService) IpblocksLabelsFindByKey(ctx _context.Context, ipblock * Execute executes the request * @return LabelResource */ -func (a *LabelsApiService) IpblocksLabelsFindByKeyExecute(r ApiIpblocksLabelsFindByKeyRequest) (LabelResource, *APIResponse, error) { +func (a *LabelsApiService) IpblocksLabelsFindByKeyExecute(r ApiIpblocksLabelsFindByKeyRequest) (LabelResource, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -3976,32 +3772,24 @@ func (a *LabelsApiService) IpblocksLabelsFindByKeyExecute(r ApiIpblocksLabelsFin localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LabelsApiService.IpblocksLabelsFindByKey") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/ipblocks/{ipblockId}/labels/{key}" - localVarPath = strings.Replace(localVarPath, "{"+"ipblockId"+"}", _neturl.PathEscape(parameterToString(r.ipblockId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"key"+"}", _neturl.PathEscape(parameterToString(r.key, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"ipblockId"+"}", _neturl.PathEscape(parameterValueToString(r.ipblockId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"key"+"}", _neturl.PathEscape(parameterValueToString(r.key, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -4022,11 +3810,11 @@ func (a *LabelsApiService) IpblocksLabelsFindByKeyExecute(r ApiIpblocksLabelsFin localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -4045,11 +3833,11 @@ func (a *LabelsApiService) IpblocksLabelsFindByKeyExecute(r ApiIpblocksLabelsFin localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "IpblocksLabelsFindByKey", } @@ -4065,28 +3853,26 @@ func (a *LabelsApiService) IpblocksLabelsFindByKeyExecute(r ApiIpblocksLabelsFin } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -4120,7 +3906,7 @@ func (r ApiIpblocksLabelsGetRequest) XContractNumber(xContractNumber int32) ApiI // Filters query parameters limit results to those containing a matching value for a specific property. func (r ApiIpblocksLabelsGetRequest) Filter(key string, value string) ApiIpblocksLabelsGetRequest { - filterKey := fmt.Sprintf(FilterQueryParam, key) + filterKey := fmt.Sprintf("filter.%s", key) r.filters[filterKey] = append(r.filters[filterKey], value) return r } @@ -4137,7 +3923,7 @@ func (r ApiIpblocksLabelsGetRequest) MaxResults(maxResults int32) ApiIpblocksLab return r } -func (r ApiIpblocksLabelsGetRequest) Execute() (LabelResources, *APIResponse, error) { +func (r ApiIpblocksLabelsGetRequest) Execute() (LabelResources, *shared.APIResponse, error) { return r.ApiService.IpblocksLabelsGetExecute(r) } @@ -4161,7 +3947,7 @@ func (a *LabelsApiService) IpblocksLabelsGet(ctx _context.Context, ipblockId str * Execute executes the request * @return LabelResources */ -func (a *LabelsApiService) IpblocksLabelsGetExecute(r ApiIpblocksLabelsGetRequest) (LabelResources, *APIResponse, error) { +func (a *LabelsApiService) IpblocksLabelsGetExecute(r ApiIpblocksLabelsGetRequest) (LabelResources, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -4173,31 +3959,23 @@ func (a *LabelsApiService) IpblocksLabelsGetExecute(r ApiIpblocksLabelsGetReques localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LabelsApiService.IpblocksLabelsGet") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/ipblocks/{ipblockId}/labels" - localVarPath = strings.Replace(localVarPath, "{"+"ipblockId"+"}", _neturl.PathEscape(parameterToString(r.ipblockId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"ipblockId"+"}", _neturl.PathEscape(parameterValueToString(r.ipblockId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } if r.orderBy != nil { localVarQueryParams.Add("orderBy", parameterToString(*r.orderBy, "")) @@ -4231,11 +4009,11 @@ func (a *LabelsApiService) IpblocksLabelsGetExecute(r ApiIpblocksLabelsGetReques localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -4254,11 +4032,11 @@ func (a *LabelsApiService) IpblocksLabelsGetExecute(r ApiIpblocksLabelsGetReques localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "IpblocksLabelsGet", } @@ -4274,28 +4052,26 @@ func (a *LabelsApiService) IpblocksLabelsGetExecute(r ApiIpblocksLabelsGetReques } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -4329,7 +4105,7 @@ func (r ApiIpblocksLabelsPostRequest) XContractNumber(xContractNumber int32) Api return r } -func (r ApiIpblocksLabelsPostRequest) Execute() (LabelResource, *APIResponse, error) { +func (r ApiIpblocksLabelsPostRequest) Execute() (LabelResource, *shared.APIResponse, error) { return r.ApiService.IpblocksLabelsPostExecute(r) } @@ -4352,7 +4128,7 @@ func (a *LabelsApiService) IpblocksLabelsPost(ctx _context.Context, ipblockId st * Execute executes the request * @return LabelResource */ -func (a *LabelsApiService) IpblocksLabelsPostExecute(r ApiIpblocksLabelsPostRequest) (LabelResource, *APIResponse, error) { +func (a *LabelsApiService) IpblocksLabelsPostExecute(r ApiIpblocksLabelsPostRequest) (LabelResource, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -4364,11 +4140,13 @@ func (a *LabelsApiService) IpblocksLabelsPostExecute(r ApiIpblocksLabelsPostRequ localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LabelsApiService.IpblocksLabelsPost") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/ipblocks/{ipblockId}/labels" - localVarPath = strings.Replace(localVarPath, "{"+"ipblockId"+"}", _neturl.PathEscape(parameterToString(r.ipblockId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"ipblockId"+"}", _neturl.PathEscape(parameterValueToString(r.ipblockId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -4378,20 +4156,10 @@ func (a *LabelsApiService) IpblocksLabelsPostExecute(r ApiIpblocksLabelsPostRequ } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -4412,13 +4180,13 @@ func (a *LabelsApiService) IpblocksLabelsPostExecute(r ApiIpblocksLabelsPostRequ localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.label if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -4437,11 +4205,11 @@ func (a *LabelsApiService) IpblocksLabelsPostExecute(r ApiIpblocksLabelsPostRequ localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "IpblocksLabelsPost", } @@ -4457,28 +4225,26 @@ func (a *LabelsApiService) IpblocksLabelsPostExecute(r ApiIpblocksLabelsPostRequ } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -4513,7 +4279,7 @@ func (r ApiIpblocksLabelsPutRequest) XContractNumber(xContractNumber int32) ApiI return r } -func (r ApiIpblocksLabelsPutRequest) Execute() (LabelResource, *APIResponse, error) { +func (r ApiIpblocksLabelsPutRequest) Execute() (LabelResource, *shared.APIResponse, error) { return r.ApiService.IpblocksLabelsPutExecute(r) } @@ -4538,7 +4304,7 @@ func (a *LabelsApiService) IpblocksLabelsPut(ctx _context.Context, ipblockId str * Execute executes the request * @return LabelResource */ -func (a *LabelsApiService) IpblocksLabelsPutExecute(r ApiIpblocksLabelsPutRequest) (LabelResource, *APIResponse, error) { +func (a *LabelsApiService) IpblocksLabelsPutExecute(r ApiIpblocksLabelsPutRequest) (LabelResource, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPut localVarPostBody interface{} @@ -4550,12 +4316,14 @@ func (a *LabelsApiService) IpblocksLabelsPutExecute(r ApiIpblocksLabelsPutReques localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LabelsApiService.IpblocksLabelsPut") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/ipblocks/{ipblockId}/labels/{key}" - localVarPath = strings.Replace(localVarPath, "{"+"ipblockId"+"}", _neturl.PathEscape(parameterToString(r.ipblockId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"key"+"}", _neturl.PathEscape(parameterToString(r.key, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"ipblockId"+"}", _neturl.PathEscape(parameterValueToString(r.ipblockId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"key"+"}", _neturl.PathEscape(parameterValueToString(r.key, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -4565,20 +4333,10 @@ func (a *LabelsApiService) IpblocksLabelsPutExecute(r ApiIpblocksLabelsPutReques } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -4599,13 +4357,13 @@ func (a *LabelsApiService) IpblocksLabelsPutExecute(r ApiIpblocksLabelsPutReques localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.label if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -4624,11 +4382,11 @@ func (a *LabelsApiService) IpblocksLabelsPutExecute(r ApiIpblocksLabelsPutReques localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "IpblocksLabelsPut", } @@ -4644,28 +4402,26 @@ func (a *LabelsApiService) IpblocksLabelsPutExecute(r ApiIpblocksLabelsPutReques } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -4694,7 +4450,7 @@ func (r ApiLabelsFindByUrnRequest) XContractNumber(xContractNumber int32) ApiLab return r } -func (r ApiLabelsFindByUrnRequest) Execute() (Label, *APIResponse, error) { +func (r ApiLabelsFindByUrnRequest) Execute() (Label, *shared.APIResponse, error) { return r.ApiService.LabelsFindByUrnExecute(r) } @@ -4721,7 +4477,7 @@ func (a *LabelsApiService) LabelsFindByUrn(ctx _context.Context, labelurn string * Execute executes the request * @return Label */ -func (a *LabelsApiService) LabelsFindByUrnExecute(r ApiLabelsFindByUrnRequest) (Label, *APIResponse, error) { +func (a *LabelsApiService) LabelsFindByUrnExecute(r ApiLabelsFindByUrnRequest) (Label, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -4733,31 +4489,23 @@ func (a *LabelsApiService) LabelsFindByUrnExecute(r ApiLabelsFindByUrnRequest) ( localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LabelsApiService.LabelsFindByUrn") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/labels/{labelurn}" - localVarPath = strings.Replace(localVarPath, "{"+"labelurn"+"}", _neturl.PathEscape(parameterToString(r.labelurn, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"labelurn"+"}", _neturl.PathEscape(parameterValueToString(r.labelurn, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -4778,11 +4526,11 @@ func (a *LabelsApiService) LabelsFindByUrnExecute(r ApiLabelsFindByUrnRequest) ( localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -4801,11 +4549,11 @@ func (a *LabelsApiService) LabelsFindByUrnExecute(r ApiLabelsFindByUrnRequest) ( localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "LabelsFindByUrn", } @@ -4821,28 +4569,26 @@ func (a *LabelsApiService) LabelsFindByUrnExecute(r ApiLabelsFindByUrnRequest) ( } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -4875,7 +4621,7 @@ func (r ApiLabelsGetRequest) XContractNumber(xContractNumber int32) ApiLabelsGet // Filters query parameters limit results to those containing a matching value for a specific property. func (r ApiLabelsGetRequest) Filter(key string, value string) ApiLabelsGetRequest { - filterKey := fmt.Sprintf(FilterQueryParam, key) + filterKey := fmt.Sprintf("filter.%s", key) r.filters[filterKey] = append(r.filters[filterKey], value) return r } @@ -4892,7 +4638,7 @@ func (r ApiLabelsGetRequest) MaxResults(maxResults int32) ApiLabelsGetRequest { return r } -func (r ApiLabelsGetRequest) Execute() (Labels, *APIResponse, error) { +func (r ApiLabelsGetRequest) Execute() (Labels, *shared.APIResponse, error) { return r.ApiService.LabelsGetExecute(r) } @@ -4914,7 +4660,7 @@ func (a *LabelsApiService) LabelsGet(ctx _context.Context) ApiLabelsGetRequest { * Execute executes the request * @return Labels */ -func (a *LabelsApiService) LabelsGetExecute(r ApiLabelsGetRequest) (Labels, *APIResponse, error) { +func (a *LabelsApiService) LabelsGetExecute(r ApiLabelsGetRequest) (Labels, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -4926,7 +4672,9 @@ func (a *LabelsApiService) LabelsGetExecute(r ApiLabelsGetRequest) (Labels, *API localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LabelsApiService.LabelsGet") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/labels" @@ -4936,20 +4684,10 @@ func (a *LabelsApiService) LabelsGetExecute(r ApiLabelsGetRequest) (Labels, *API localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } if r.orderBy != nil { localVarQueryParams.Add("orderBy", parameterToString(*r.orderBy, "")) @@ -4983,11 +4721,11 @@ func (a *LabelsApiService) LabelsGetExecute(r ApiLabelsGetRequest) (Labels, *API localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -5006,11 +4744,11 @@ func (a *LabelsApiService) LabelsGetExecute(r ApiLabelsGetRequest) (Labels, *API localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "LabelsGet", } @@ -5026,28 +4764,26 @@ func (a *LabelsApiService) LabelsGetExecute(r ApiLabelsGetRequest) (Labels, *API } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -5077,7 +4813,7 @@ func (r ApiSnapshotsLabelsDeleteRequest) XContractNumber(xContractNumber int32) return r } -func (r ApiSnapshotsLabelsDeleteRequest) Execute() (*APIResponse, error) { +func (r ApiSnapshotsLabelsDeleteRequest) Execute() (*shared.APIResponse, error) { return r.ApiService.SnapshotsLabelsDeleteExecute(r) } @@ -5101,7 +4837,7 @@ func (a *LabelsApiService) SnapshotsLabelsDelete(ctx _context.Context, snapshotI /* * Execute executes the request */ -func (a *LabelsApiService) SnapshotsLabelsDeleteExecute(r ApiSnapshotsLabelsDeleteRequest) (*APIResponse, error) { +func (a *LabelsApiService) SnapshotsLabelsDeleteExecute(r ApiSnapshotsLabelsDeleteRequest) (*shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodDelete localVarPostBody interface{} @@ -5112,32 +4848,24 @@ func (a *LabelsApiService) SnapshotsLabelsDeleteExecute(r ApiSnapshotsLabelsDele localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LabelsApiService.SnapshotsLabelsDelete") if err != nil { - return nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return nil, gerr } localVarPath := localBasePath + "/snapshots/{snapshotId}/labels/{key}" - localVarPath = strings.Replace(localVarPath, "{"+"snapshotId"+"}", _neturl.PathEscape(parameterToString(r.snapshotId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"key"+"}", _neturl.PathEscape(parameterToString(r.key, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"snapshotId"+"}", _neturl.PathEscape(parameterValueToString(r.snapshotId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"key"+"}", _neturl.PathEscape(parameterValueToString(r.key, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -5158,11 +4886,11 @@ func (a *LabelsApiService) SnapshotsLabelsDeleteExecute(r ApiSnapshotsLabelsDele localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -5181,11 +4909,11 @@ func (a *LabelsApiService) SnapshotsLabelsDeleteExecute(r ApiSnapshotsLabelsDele localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "SnapshotsLabelsDelete", } @@ -5201,18 +4929,17 @@ func (a *LabelsApiService) SnapshotsLabelsDeleteExecute(r ApiSnapshotsLabelsDele } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarAPIResponse, newErr } @@ -5242,7 +4969,7 @@ func (r ApiSnapshotsLabelsFindByKeyRequest) XContractNumber(xContractNumber int3 return r } -func (r ApiSnapshotsLabelsFindByKeyRequest) Execute() (LabelResource, *APIResponse, error) { +func (r ApiSnapshotsLabelsFindByKeyRequest) Execute() (LabelResource, *shared.APIResponse, error) { return r.ApiService.SnapshotsLabelsFindByKeyExecute(r) } @@ -5267,7 +4994,7 @@ func (a *LabelsApiService) SnapshotsLabelsFindByKey(ctx _context.Context, snapsh * Execute executes the request * @return LabelResource */ -func (a *LabelsApiService) SnapshotsLabelsFindByKeyExecute(r ApiSnapshotsLabelsFindByKeyRequest) (LabelResource, *APIResponse, error) { +func (a *LabelsApiService) SnapshotsLabelsFindByKeyExecute(r ApiSnapshotsLabelsFindByKeyRequest) (LabelResource, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -5279,32 +5006,24 @@ func (a *LabelsApiService) SnapshotsLabelsFindByKeyExecute(r ApiSnapshotsLabelsF localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LabelsApiService.SnapshotsLabelsFindByKey") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/snapshots/{snapshotId}/labels/{key}" - localVarPath = strings.Replace(localVarPath, "{"+"snapshotId"+"}", _neturl.PathEscape(parameterToString(r.snapshotId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"key"+"}", _neturl.PathEscape(parameterToString(r.key, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"snapshotId"+"}", _neturl.PathEscape(parameterValueToString(r.snapshotId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"key"+"}", _neturl.PathEscape(parameterValueToString(r.key, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -5325,11 +5044,11 @@ func (a *LabelsApiService) SnapshotsLabelsFindByKeyExecute(r ApiSnapshotsLabelsF localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -5348,11 +5067,11 @@ func (a *LabelsApiService) SnapshotsLabelsFindByKeyExecute(r ApiSnapshotsLabelsF localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "SnapshotsLabelsFindByKey", } @@ -5368,28 +5087,26 @@ func (a *LabelsApiService) SnapshotsLabelsFindByKeyExecute(r ApiSnapshotsLabelsF } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -5423,7 +5140,7 @@ func (r ApiSnapshotsLabelsGetRequest) XContractNumber(xContractNumber int32) Api // Filters query parameters limit results to those containing a matching value for a specific property. func (r ApiSnapshotsLabelsGetRequest) Filter(key string, value string) ApiSnapshotsLabelsGetRequest { - filterKey := fmt.Sprintf(FilterQueryParam, key) + filterKey := fmt.Sprintf("filter.%s", key) r.filters[filterKey] = append(r.filters[filterKey], value) return r } @@ -5440,7 +5157,7 @@ func (r ApiSnapshotsLabelsGetRequest) MaxResults(maxResults int32) ApiSnapshotsL return r } -func (r ApiSnapshotsLabelsGetRequest) Execute() (LabelResources, *APIResponse, error) { +func (r ApiSnapshotsLabelsGetRequest) Execute() (LabelResources, *shared.APIResponse, error) { return r.ApiService.SnapshotsLabelsGetExecute(r) } @@ -5464,7 +5181,7 @@ func (a *LabelsApiService) SnapshotsLabelsGet(ctx _context.Context, snapshotId s * Execute executes the request * @return LabelResources */ -func (a *LabelsApiService) SnapshotsLabelsGetExecute(r ApiSnapshotsLabelsGetRequest) (LabelResources, *APIResponse, error) { +func (a *LabelsApiService) SnapshotsLabelsGetExecute(r ApiSnapshotsLabelsGetRequest) (LabelResources, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -5476,31 +5193,23 @@ func (a *LabelsApiService) SnapshotsLabelsGetExecute(r ApiSnapshotsLabelsGetRequ localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LabelsApiService.SnapshotsLabelsGet") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/snapshots/{snapshotId}/labels" - localVarPath = strings.Replace(localVarPath, "{"+"snapshotId"+"}", _neturl.PathEscape(parameterToString(r.snapshotId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"snapshotId"+"}", _neturl.PathEscape(parameterValueToString(r.snapshotId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } if r.orderBy != nil { localVarQueryParams.Add("orderBy", parameterToString(*r.orderBy, "")) @@ -5534,11 +5243,11 @@ func (a *LabelsApiService) SnapshotsLabelsGetExecute(r ApiSnapshotsLabelsGetRequ localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -5557,11 +5266,11 @@ func (a *LabelsApiService) SnapshotsLabelsGetExecute(r ApiSnapshotsLabelsGetRequ localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "SnapshotsLabelsGet", } @@ -5577,28 +5286,26 @@ func (a *LabelsApiService) SnapshotsLabelsGetExecute(r ApiSnapshotsLabelsGetRequ } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -5632,7 +5339,7 @@ func (r ApiSnapshotsLabelsPostRequest) XContractNumber(xContractNumber int32) Ap return r } -func (r ApiSnapshotsLabelsPostRequest) Execute() (LabelResource, *APIResponse, error) { +func (r ApiSnapshotsLabelsPostRequest) Execute() (LabelResource, *shared.APIResponse, error) { return r.ApiService.SnapshotsLabelsPostExecute(r) } @@ -5655,7 +5362,7 @@ func (a *LabelsApiService) SnapshotsLabelsPost(ctx _context.Context, snapshotId * Execute executes the request * @return LabelResource */ -func (a *LabelsApiService) SnapshotsLabelsPostExecute(r ApiSnapshotsLabelsPostRequest) (LabelResource, *APIResponse, error) { +func (a *LabelsApiService) SnapshotsLabelsPostExecute(r ApiSnapshotsLabelsPostRequest) (LabelResource, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -5667,11 +5374,13 @@ func (a *LabelsApiService) SnapshotsLabelsPostExecute(r ApiSnapshotsLabelsPostRe localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LabelsApiService.SnapshotsLabelsPost") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/snapshots/{snapshotId}/labels" - localVarPath = strings.Replace(localVarPath, "{"+"snapshotId"+"}", _neturl.PathEscape(parameterToString(r.snapshotId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"snapshotId"+"}", _neturl.PathEscape(parameterValueToString(r.snapshotId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -5681,20 +5390,10 @@ func (a *LabelsApiService) SnapshotsLabelsPostExecute(r ApiSnapshotsLabelsPostRe } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -5715,13 +5414,13 @@ func (a *LabelsApiService) SnapshotsLabelsPostExecute(r ApiSnapshotsLabelsPostRe localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.label if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -5740,11 +5439,11 @@ func (a *LabelsApiService) SnapshotsLabelsPostExecute(r ApiSnapshotsLabelsPostRe localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "SnapshotsLabelsPost", } @@ -5760,28 +5459,26 @@ func (a *LabelsApiService) SnapshotsLabelsPostExecute(r ApiSnapshotsLabelsPostRe } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -5816,7 +5513,7 @@ func (r ApiSnapshotsLabelsPutRequest) XContractNumber(xContractNumber int32) Api return r } -func (r ApiSnapshotsLabelsPutRequest) Execute() (LabelResource, *APIResponse, error) { +func (r ApiSnapshotsLabelsPutRequest) Execute() (LabelResource, *shared.APIResponse, error) { return r.ApiService.SnapshotsLabelsPutExecute(r) } @@ -5841,7 +5538,7 @@ func (a *LabelsApiService) SnapshotsLabelsPut(ctx _context.Context, snapshotId s * Execute executes the request * @return LabelResource */ -func (a *LabelsApiService) SnapshotsLabelsPutExecute(r ApiSnapshotsLabelsPutRequest) (LabelResource, *APIResponse, error) { +func (a *LabelsApiService) SnapshotsLabelsPutExecute(r ApiSnapshotsLabelsPutRequest) (LabelResource, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPut localVarPostBody interface{} @@ -5853,12 +5550,14 @@ func (a *LabelsApiService) SnapshotsLabelsPutExecute(r ApiSnapshotsLabelsPutRequ localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LabelsApiService.SnapshotsLabelsPut") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/snapshots/{snapshotId}/labels/{key}" - localVarPath = strings.Replace(localVarPath, "{"+"snapshotId"+"}", _neturl.PathEscape(parameterToString(r.snapshotId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"key"+"}", _neturl.PathEscape(parameterToString(r.key, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"snapshotId"+"}", _neturl.PathEscape(parameterValueToString(r.snapshotId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"key"+"}", _neturl.PathEscape(parameterValueToString(r.key, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -5868,20 +5567,10 @@ func (a *LabelsApiService) SnapshotsLabelsPutExecute(r ApiSnapshotsLabelsPutRequ } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -5902,13 +5591,13 @@ func (a *LabelsApiService) SnapshotsLabelsPutExecute(r ApiSnapshotsLabelsPutRequ localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.label if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -5927,11 +5616,11 @@ func (a *LabelsApiService) SnapshotsLabelsPutExecute(r ApiSnapshotsLabelsPutRequ localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "SnapshotsLabelsPut", } @@ -5947,28 +5636,26 @@ func (a *LabelsApiService) SnapshotsLabelsPutExecute(r ApiSnapshotsLabelsPutRequ } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/api_lans.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/api_lans.go similarity index 76% rename from vendor/github.com/ionos-cloud/sdk-go/v6/api_lans.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/api_lans.go index 42267ac8d..e8fdc30bd 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/api_lans.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/api_lans.go @@ -13,6 +13,7 @@ package ionoscloud import ( _context "context" "fmt" + "github.com/ionos-cloud/sdk-go-bundle/shared" "io" _nethttp "net/http" _neturl "net/url" @@ -50,7 +51,7 @@ func (r ApiDatacentersLansDeleteRequest) XContractNumber(xContractNumber int32) return r } -func (r ApiDatacentersLansDeleteRequest) Execute() (*APIResponse, error) { +func (r ApiDatacentersLansDeleteRequest) Execute() (*shared.APIResponse, error) { return r.ApiService.DatacentersLansDeleteExecute(r) } @@ -74,7 +75,7 @@ func (a *LANsApiService) DatacentersLansDelete(ctx _context.Context, datacenterI /* * Execute executes the request */ -func (a *LANsApiService) DatacentersLansDeleteExecute(r ApiDatacentersLansDeleteRequest) (*APIResponse, error) { +func (a *LANsApiService) DatacentersLansDeleteExecute(r ApiDatacentersLansDeleteRequest) (*shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodDelete localVarPostBody interface{} @@ -85,32 +86,24 @@ func (a *LANsApiService) DatacentersLansDeleteExecute(r ApiDatacentersLansDelete localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LANsApiService.DatacentersLansDelete") if err != nil { - return nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/lans/{lanId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"lanId"+"}", _neturl.PathEscape(parameterToString(r.lanId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"lanId"+"}", _neturl.PathEscape(parameterValueToString(r.lanId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -131,11 +124,11 @@ func (a *LANsApiService) DatacentersLansDeleteExecute(r ApiDatacentersLansDelete localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -154,11 +147,11 @@ func (a *LANsApiService) DatacentersLansDeleteExecute(r ApiDatacentersLansDelete localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersLansDelete", } @@ -174,18 +167,17 @@ func (a *LANsApiService) DatacentersLansDeleteExecute(r ApiDatacentersLansDelete } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarAPIResponse, newErr } @@ -215,7 +207,7 @@ func (r ApiDatacentersLansFindByIdRequest) XContractNumber(xContractNumber int32 return r } -func (r ApiDatacentersLansFindByIdRequest) Execute() (Lan, *APIResponse, error) { +func (r ApiDatacentersLansFindByIdRequest) Execute() (Lan, *shared.APIResponse, error) { return r.ApiService.DatacentersLansFindByIdExecute(r) } @@ -240,7 +232,7 @@ func (a *LANsApiService) DatacentersLansFindById(ctx _context.Context, datacente * Execute executes the request * @return Lan */ -func (a *LANsApiService) DatacentersLansFindByIdExecute(r ApiDatacentersLansFindByIdRequest) (Lan, *APIResponse, error) { +func (a *LANsApiService) DatacentersLansFindByIdExecute(r ApiDatacentersLansFindByIdRequest) (Lan, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -252,32 +244,24 @@ func (a *LANsApiService) DatacentersLansFindByIdExecute(r ApiDatacentersLansFind localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LANsApiService.DatacentersLansFindById") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/lans/{lanId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"lanId"+"}", _neturl.PathEscape(parameterToString(r.lanId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"lanId"+"}", _neturl.PathEscape(parameterValueToString(r.lanId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -298,11 +282,11 @@ func (a *LANsApiService) DatacentersLansFindByIdExecute(r ApiDatacentersLansFind localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -321,11 +305,11 @@ func (a *LANsApiService) DatacentersLansFindByIdExecute(r ApiDatacentersLansFind localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersLansFindById", } @@ -341,28 +325,26 @@ func (a *LANsApiService) DatacentersLansFindByIdExecute(r ApiDatacentersLansFind } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -406,7 +388,7 @@ func (r ApiDatacentersLansGetRequest) Limit(limit int32) ApiDatacentersLansGetRe // Filters query parameters limit results to those containing a matching value for a specific property. func (r ApiDatacentersLansGetRequest) Filter(key string, value string) ApiDatacentersLansGetRequest { - filterKey := fmt.Sprintf(FilterQueryParam, key) + filterKey := fmt.Sprintf("filter.%s", key) r.filters[filterKey] = append(r.filters[filterKey], value) return r } @@ -423,7 +405,7 @@ func (r ApiDatacentersLansGetRequest) MaxResults(maxResults int32) ApiDatacenter return r } -func (r ApiDatacentersLansGetRequest) Execute() (Lans, *APIResponse, error) { +func (r ApiDatacentersLansGetRequest) Execute() (Lans, *shared.APIResponse, error) { return r.ApiService.DatacentersLansGetExecute(r) } @@ -447,7 +429,7 @@ func (a *LANsApiService) DatacentersLansGet(ctx _context.Context, datacenterId s * Execute executes the request * @return Lans */ -func (a *LANsApiService) DatacentersLansGetExecute(r ApiDatacentersLansGetRequest) (Lans, *APIResponse, error) { +func (a *LANsApiService) DatacentersLansGetExecute(r ApiDatacentersLansGetRequest) (Lans, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -459,47 +441,29 @@ func (a *LANsApiService) DatacentersLansGetExecute(r ApiDatacentersLansGetReques localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LANsApiService.DatacentersLansGet") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/lans" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } if r.offset != nil { - localVarQueryParams.Add("offset", parameterToString(*r.offset, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("offset") - if defaultQueryParam == "" { - localVarQueryParams.Add("offset", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "offset", r.offset, "") } if r.limit != nil { - localVarQueryParams.Add("limit", parameterToString(*r.limit, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("limit") - if defaultQueryParam == "" { - localVarQueryParams.Add("limit", parameterToString(1000, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "") } if r.orderBy != nil { localVarQueryParams.Add("orderBy", parameterToString(*r.orderBy, "")) @@ -533,11 +497,11 @@ func (a *LANsApiService) DatacentersLansGetExecute(r ApiDatacentersLansGetReques localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -556,11 +520,11 @@ func (a *LANsApiService) DatacentersLansGetExecute(r ApiDatacentersLansGetReques localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersLansGet", } @@ -576,28 +540,26 @@ func (a *LANsApiService) DatacentersLansGetExecute(r ApiDatacentersLansGetReques } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -628,7 +590,7 @@ func (r ApiDatacentersLansNicsFindByIdRequest) XContractNumber(xContractNumber i return r } -func (r ApiDatacentersLansNicsFindByIdRequest) Execute() (Nic, *APIResponse, error) { +func (r ApiDatacentersLansNicsFindByIdRequest) Execute() (Nic, *shared.APIResponse, error) { return r.ApiService.DatacentersLansNicsFindByIdExecute(r) } @@ -655,7 +617,7 @@ func (a *LANsApiService) DatacentersLansNicsFindById(ctx _context.Context, datac * Execute executes the request * @return Nic */ -func (a *LANsApiService) DatacentersLansNicsFindByIdExecute(r ApiDatacentersLansNicsFindByIdRequest) (Nic, *APIResponse, error) { +func (a *LANsApiService) DatacentersLansNicsFindByIdExecute(r ApiDatacentersLansNicsFindByIdRequest) (Nic, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -667,33 +629,25 @@ func (a *LANsApiService) DatacentersLansNicsFindByIdExecute(r ApiDatacentersLans localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LANsApiService.DatacentersLansNicsFindById") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/lans/{lanId}/nics/{nicId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"lanId"+"}", _neturl.PathEscape(parameterToString(r.lanId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"nicId"+"}", _neturl.PathEscape(parameterToString(r.nicId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"lanId"+"}", _neturl.PathEscape(parameterValueToString(r.lanId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nicId"+"}", _neturl.PathEscape(parameterValueToString(r.nicId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -714,11 +668,11 @@ func (a *LANsApiService) DatacentersLansNicsFindByIdExecute(r ApiDatacentersLans localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -737,11 +691,11 @@ func (a *LANsApiService) DatacentersLansNicsFindByIdExecute(r ApiDatacentersLans localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersLansNicsFindById", } @@ -757,28 +711,26 @@ func (a *LANsApiService) DatacentersLansNicsFindByIdExecute(r ApiDatacentersLans } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -823,7 +775,7 @@ func (r ApiDatacentersLansNicsGetRequest) Limit(limit int32) ApiDatacentersLansN // Filters query parameters limit results to those containing a matching value for a specific property. func (r ApiDatacentersLansNicsGetRequest) Filter(key string, value string) ApiDatacentersLansNicsGetRequest { - filterKey := fmt.Sprintf(FilterQueryParam, key) + filterKey := fmt.Sprintf("filter.%s", key) r.filters[filterKey] = append(r.filters[filterKey], value) return r } @@ -840,7 +792,7 @@ func (r ApiDatacentersLansNicsGetRequest) MaxResults(maxResults int32) ApiDatace return r } -func (r ApiDatacentersLansNicsGetRequest) Execute() (LanNics, *APIResponse, error) { +func (r ApiDatacentersLansNicsGetRequest) Execute() (LanNics, *shared.APIResponse, error) { return r.ApiService.DatacentersLansNicsGetExecute(r) } @@ -866,7 +818,7 @@ func (a *LANsApiService) DatacentersLansNicsGet(ctx _context.Context, datacenter * Execute executes the request * @return LanNics */ -func (a *LANsApiService) DatacentersLansNicsGetExecute(r ApiDatacentersLansNicsGetRequest) (LanNics, *APIResponse, error) { +func (a *LANsApiService) DatacentersLansNicsGetExecute(r ApiDatacentersLansNicsGetRequest) (LanNics, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -878,48 +830,30 @@ func (a *LANsApiService) DatacentersLansNicsGetExecute(r ApiDatacentersLansNicsG localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LANsApiService.DatacentersLansNicsGet") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/lans/{lanId}/nics" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"lanId"+"}", _neturl.PathEscape(parameterToString(r.lanId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"lanId"+"}", _neturl.PathEscape(parameterValueToString(r.lanId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } if r.offset != nil { - localVarQueryParams.Add("offset", parameterToString(*r.offset, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("offset") - if defaultQueryParam == "" { - localVarQueryParams.Add("offset", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "offset", r.offset, "") } if r.limit != nil { - localVarQueryParams.Add("limit", parameterToString(*r.limit, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("limit") - if defaultQueryParam == "" { - localVarQueryParams.Add("limit", parameterToString(1000, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "") } if r.orderBy != nil { localVarQueryParams.Add("orderBy", parameterToString(*r.orderBy, "")) @@ -953,11 +887,11 @@ func (a *LANsApiService) DatacentersLansNicsGetExecute(r ApiDatacentersLansNicsG localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -976,11 +910,11 @@ func (a *LANsApiService) DatacentersLansNicsGetExecute(r ApiDatacentersLansNicsG localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersLansNicsGet", } @@ -996,28 +930,26 @@ func (a *LANsApiService) DatacentersLansNicsGetExecute(r ApiDatacentersLansNicsG } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -1052,7 +984,7 @@ func (r ApiDatacentersLansNicsPostRequest) XContractNumber(xContractNumber int32 return r } -func (r ApiDatacentersLansNicsPostRequest) Execute() (Nic, *APIResponse, error) { +func (r ApiDatacentersLansNicsPostRequest) Execute() (Nic, *shared.APIResponse, error) { return r.ApiService.DatacentersLansNicsPostExecute(r) } @@ -1077,7 +1009,7 @@ func (a *LANsApiService) DatacentersLansNicsPost(ctx _context.Context, datacente * Execute executes the request * @return Nic */ -func (a *LANsApiService) DatacentersLansNicsPostExecute(r ApiDatacentersLansNicsPostRequest) (Nic, *APIResponse, error) { +func (a *LANsApiService) DatacentersLansNicsPostExecute(r ApiDatacentersLansNicsPostRequest) (Nic, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -1089,12 +1021,14 @@ func (a *LANsApiService) DatacentersLansNicsPostExecute(r ApiDatacentersLansNics localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LANsApiService.DatacentersLansNicsPost") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/lans/{lanId}/nics" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"lanId"+"}", _neturl.PathEscape(parameterToString(r.lanId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"lanId"+"}", _neturl.PathEscape(parameterValueToString(r.lanId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -1104,20 +1038,10 @@ func (a *LANsApiService) DatacentersLansNicsPostExecute(r ApiDatacentersLansNics } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -1138,13 +1062,13 @@ func (a *LANsApiService) DatacentersLansNicsPostExecute(r ApiDatacentersLansNics localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.nic if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -1163,11 +1087,11 @@ func (a *LANsApiService) DatacentersLansNicsPostExecute(r ApiDatacentersLansNics localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersLansNicsPost", } @@ -1183,28 +1107,26 @@ func (a *LANsApiService) DatacentersLansNicsPostExecute(r ApiDatacentersLansNics } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -1239,7 +1161,7 @@ func (r ApiDatacentersLansPatchRequest) XContractNumber(xContractNumber int32) A return r } -func (r ApiDatacentersLansPatchRequest) Execute() (Lan, *APIResponse, error) { +func (r ApiDatacentersLansPatchRequest) Execute() (Lan, *shared.APIResponse, error) { return r.ApiService.DatacentersLansPatchExecute(r) } @@ -1264,7 +1186,7 @@ func (a *LANsApiService) DatacentersLansPatch(ctx _context.Context, datacenterId * Execute executes the request * @return Lan */ -func (a *LANsApiService) DatacentersLansPatchExecute(r ApiDatacentersLansPatchRequest) (Lan, *APIResponse, error) { +func (a *LANsApiService) DatacentersLansPatchExecute(r ApiDatacentersLansPatchRequest) (Lan, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPatch localVarPostBody interface{} @@ -1276,12 +1198,14 @@ func (a *LANsApiService) DatacentersLansPatchExecute(r ApiDatacentersLansPatchRe localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LANsApiService.DatacentersLansPatch") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/lans/{lanId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"lanId"+"}", _neturl.PathEscape(parameterToString(r.lanId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"lanId"+"}", _neturl.PathEscape(parameterValueToString(r.lanId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -1291,20 +1215,10 @@ func (a *LANsApiService) DatacentersLansPatchExecute(r ApiDatacentersLansPatchRe } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -1325,13 +1239,13 @@ func (a *LANsApiService) DatacentersLansPatchExecute(r ApiDatacentersLansPatchRe localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.lan if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -1350,11 +1264,11 @@ func (a *LANsApiService) DatacentersLansPatchExecute(r ApiDatacentersLansPatchRe localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersLansPatch", } @@ -1370,28 +1284,26 @@ func (a *LANsApiService) DatacentersLansPatchExecute(r ApiDatacentersLansPatchRe } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -1425,7 +1337,7 @@ func (r ApiDatacentersLansPostRequest) XContractNumber(xContractNumber int32) Ap return r } -func (r ApiDatacentersLansPostRequest) Execute() (Lan, *APIResponse, error) { +func (r ApiDatacentersLansPostRequest) Execute() (Lan, *shared.APIResponse, error) { return r.ApiService.DatacentersLansPostExecute(r) } @@ -1448,7 +1360,7 @@ func (a *LANsApiService) DatacentersLansPost(ctx _context.Context, datacenterId * Execute executes the request * @return Lan */ -func (a *LANsApiService) DatacentersLansPostExecute(r ApiDatacentersLansPostRequest) (Lan, *APIResponse, error) { +func (a *LANsApiService) DatacentersLansPostExecute(r ApiDatacentersLansPostRequest) (Lan, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -1460,11 +1372,13 @@ func (a *LANsApiService) DatacentersLansPostExecute(r ApiDatacentersLansPostRequ localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LANsApiService.DatacentersLansPost") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/lans" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -1474,20 +1388,10 @@ func (a *LANsApiService) DatacentersLansPostExecute(r ApiDatacentersLansPostRequ } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -1508,13 +1412,13 @@ func (a *LANsApiService) DatacentersLansPostExecute(r ApiDatacentersLansPostRequ localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.lan if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -1533,11 +1437,11 @@ func (a *LANsApiService) DatacentersLansPostExecute(r ApiDatacentersLansPostRequ localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersLansPost", } @@ -1553,28 +1457,26 @@ func (a *LANsApiService) DatacentersLansPostExecute(r ApiDatacentersLansPostRequ } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -1609,7 +1511,7 @@ func (r ApiDatacentersLansPutRequest) XContractNumber(xContractNumber int32) Api return r } -func (r ApiDatacentersLansPutRequest) Execute() (Lan, *APIResponse, error) { +func (r ApiDatacentersLansPutRequest) Execute() (Lan, *shared.APIResponse, error) { return r.ApiService.DatacentersLansPutExecute(r) } @@ -1634,7 +1536,7 @@ func (a *LANsApiService) DatacentersLansPut(ctx _context.Context, datacenterId s * Execute executes the request * @return Lan */ -func (a *LANsApiService) DatacentersLansPutExecute(r ApiDatacentersLansPutRequest) (Lan, *APIResponse, error) { +func (a *LANsApiService) DatacentersLansPutExecute(r ApiDatacentersLansPutRequest) (Lan, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPut localVarPostBody interface{} @@ -1646,12 +1548,14 @@ func (a *LANsApiService) DatacentersLansPutExecute(r ApiDatacentersLansPutReques localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LANsApiService.DatacentersLansPut") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/lans/{lanId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"lanId"+"}", _neturl.PathEscape(parameterToString(r.lanId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"lanId"+"}", _neturl.PathEscape(parameterValueToString(r.lanId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -1661,20 +1565,10 @@ func (a *LANsApiService) DatacentersLansPutExecute(r ApiDatacentersLansPutReques } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -1695,13 +1589,13 @@ func (a *LANsApiService) DatacentersLansPutExecute(r ApiDatacentersLansPutReques localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.lan if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -1720,11 +1614,11 @@ func (a *LANsApiService) DatacentersLansPutExecute(r ApiDatacentersLansPutReques localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersLansPut", } @@ -1740,28 +1634,26 @@ func (a *LANsApiService) DatacentersLansPutExecute(r ApiDatacentersLansPutReques } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/api_load_balancers.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/api_load_balancers.go similarity index 78% rename from vendor/github.com/ionos-cloud/sdk-go/v6/api_load_balancers.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/api_load_balancers.go index 8caa3acbd..845810cf1 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/api_load_balancers.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/api_load_balancers.go @@ -13,6 +13,7 @@ package ionoscloud import ( _context "context" "fmt" + "github.com/ionos-cloud/sdk-go-bundle/shared" "io" _nethttp "net/http" _neturl "net/url" @@ -51,7 +52,7 @@ func (r ApiDatacentersLoadbalancersBalancednicsDeleteRequest) XContractNumber(xC return r } -func (r ApiDatacentersLoadbalancersBalancednicsDeleteRequest) Execute() (*APIResponse, error) { +func (r ApiDatacentersLoadbalancersBalancednicsDeleteRequest) Execute() (*shared.APIResponse, error) { return r.ApiService.DatacentersLoadbalancersBalancednicsDeleteExecute(r) } @@ -77,7 +78,7 @@ func (a *LoadBalancersApiService) DatacentersLoadbalancersBalancednicsDelete(ctx /* * Execute executes the request */ -func (a *LoadBalancersApiService) DatacentersLoadbalancersBalancednicsDeleteExecute(r ApiDatacentersLoadbalancersBalancednicsDeleteRequest) (*APIResponse, error) { +func (a *LoadBalancersApiService) DatacentersLoadbalancersBalancednicsDeleteExecute(r ApiDatacentersLoadbalancersBalancednicsDeleteRequest) (*shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodDelete localVarPostBody interface{} @@ -88,33 +89,25 @@ func (a *LoadBalancersApiService) DatacentersLoadbalancersBalancednicsDeleteExec localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LoadBalancersApiService.DatacentersLoadbalancersBalancednicsDelete") if err != nil { - return nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/loadbalancers/{loadbalancerId}/balancednics/{nicId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"loadbalancerId"+"}", _neturl.PathEscape(parameterToString(r.loadbalancerId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"nicId"+"}", _neturl.PathEscape(parameterToString(r.nicId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"loadbalancerId"+"}", _neturl.PathEscape(parameterValueToString(r.loadbalancerId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nicId"+"}", _neturl.PathEscape(parameterValueToString(r.nicId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -135,11 +128,11 @@ func (a *LoadBalancersApiService) DatacentersLoadbalancersBalancednicsDeleteExec localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -158,11 +151,11 @@ func (a *LoadBalancersApiService) DatacentersLoadbalancersBalancednicsDeleteExec localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersLoadbalancersBalancednicsDelete", } @@ -178,18 +171,17 @@ func (a *LoadBalancersApiService) DatacentersLoadbalancersBalancednicsDeleteExec } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarAPIResponse, newErr } @@ -220,7 +212,7 @@ func (r ApiDatacentersLoadbalancersBalancednicsFindByNicIdRequest) XContractNumb return r } -func (r ApiDatacentersLoadbalancersBalancednicsFindByNicIdRequest) Execute() (Nic, *APIResponse, error) { +func (r ApiDatacentersLoadbalancersBalancednicsFindByNicIdRequest) Execute() (Nic, *shared.APIResponse, error) { return r.ApiService.DatacentersLoadbalancersBalancednicsFindByNicIdExecute(r) } @@ -247,7 +239,7 @@ func (a *LoadBalancersApiService) DatacentersLoadbalancersBalancednicsFindByNicI * Execute executes the request * @return Nic */ -func (a *LoadBalancersApiService) DatacentersLoadbalancersBalancednicsFindByNicIdExecute(r ApiDatacentersLoadbalancersBalancednicsFindByNicIdRequest) (Nic, *APIResponse, error) { +func (a *LoadBalancersApiService) DatacentersLoadbalancersBalancednicsFindByNicIdExecute(r ApiDatacentersLoadbalancersBalancednicsFindByNicIdRequest) (Nic, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -259,33 +251,25 @@ func (a *LoadBalancersApiService) DatacentersLoadbalancersBalancednicsFindByNicI localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LoadBalancersApiService.DatacentersLoadbalancersBalancednicsFindByNicId") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/loadbalancers/{loadbalancerId}/balancednics/{nicId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"loadbalancerId"+"}", _neturl.PathEscape(parameterToString(r.loadbalancerId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"nicId"+"}", _neturl.PathEscape(parameterToString(r.nicId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"loadbalancerId"+"}", _neturl.PathEscape(parameterValueToString(r.loadbalancerId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nicId"+"}", _neturl.PathEscape(parameterValueToString(r.nicId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -306,11 +290,11 @@ func (a *LoadBalancersApiService) DatacentersLoadbalancersBalancednicsFindByNicI localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -329,11 +313,11 @@ func (a *LoadBalancersApiService) DatacentersLoadbalancersBalancednicsFindByNicI localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersLoadbalancersBalancednicsFindByNicId", } @@ -349,28 +333,26 @@ func (a *LoadBalancersApiService) DatacentersLoadbalancersBalancednicsFindByNicI } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -405,7 +387,7 @@ func (r ApiDatacentersLoadbalancersBalancednicsGetRequest) XContractNumber(xCont // Filters query parameters limit results to those containing a matching value for a specific property. func (r ApiDatacentersLoadbalancersBalancednicsGetRequest) Filter(key string, value string) ApiDatacentersLoadbalancersBalancednicsGetRequest { - filterKey := fmt.Sprintf(FilterQueryParam, key) + filterKey := fmt.Sprintf("filter.%s", key) r.filters[filterKey] = append(r.filters[filterKey], value) return r } @@ -422,7 +404,7 @@ func (r ApiDatacentersLoadbalancersBalancednicsGetRequest) MaxResults(maxResults return r } -func (r ApiDatacentersLoadbalancersBalancednicsGetRequest) Execute() (BalancedNics, *APIResponse, error) { +func (r ApiDatacentersLoadbalancersBalancednicsGetRequest) Execute() (BalancedNics, *shared.APIResponse, error) { return r.ApiService.DatacentersLoadbalancersBalancednicsGetExecute(r) } @@ -448,7 +430,7 @@ func (a *LoadBalancersApiService) DatacentersLoadbalancersBalancednicsGet(ctx _c * Execute executes the request * @return BalancedNics */ -func (a *LoadBalancersApiService) DatacentersLoadbalancersBalancednicsGetExecute(r ApiDatacentersLoadbalancersBalancednicsGetRequest) (BalancedNics, *APIResponse, error) { +func (a *LoadBalancersApiService) DatacentersLoadbalancersBalancednicsGetExecute(r ApiDatacentersLoadbalancersBalancednicsGetRequest) (BalancedNics, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -460,32 +442,24 @@ func (a *LoadBalancersApiService) DatacentersLoadbalancersBalancednicsGetExecute localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LoadBalancersApiService.DatacentersLoadbalancersBalancednicsGet") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/loadbalancers/{loadbalancerId}/balancednics" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"loadbalancerId"+"}", _neturl.PathEscape(parameterToString(r.loadbalancerId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"loadbalancerId"+"}", _neturl.PathEscape(parameterValueToString(r.loadbalancerId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } if r.orderBy != nil { localVarQueryParams.Add("orderBy", parameterToString(*r.orderBy, "")) @@ -519,11 +493,11 @@ func (a *LoadBalancersApiService) DatacentersLoadbalancersBalancednicsGetExecute localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -542,11 +516,11 @@ func (a *LoadBalancersApiService) DatacentersLoadbalancersBalancednicsGetExecute localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersLoadbalancersBalancednicsGet", } @@ -562,28 +536,26 @@ func (a *LoadBalancersApiService) DatacentersLoadbalancersBalancednicsGetExecute } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -618,7 +590,7 @@ func (r ApiDatacentersLoadbalancersBalancednicsPostRequest) XContractNumber(xCon return r } -func (r ApiDatacentersLoadbalancersBalancednicsPostRequest) Execute() (Nic, *APIResponse, error) { +func (r ApiDatacentersLoadbalancersBalancednicsPostRequest) Execute() (Nic, *shared.APIResponse, error) { return r.ApiService.DatacentersLoadbalancersBalancednicsPostExecute(r) } @@ -643,7 +615,7 @@ func (a *LoadBalancersApiService) DatacentersLoadbalancersBalancednicsPost(ctx _ * Execute executes the request * @return Nic */ -func (a *LoadBalancersApiService) DatacentersLoadbalancersBalancednicsPostExecute(r ApiDatacentersLoadbalancersBalancednicsPostRequest) (Nic, *APIResponse, error) { +func (a *LoadBalancersApiService) DatacentersLoadbalancersBalancednicsPostExecute(r ApiDatacentersLoadbalancersBalancednicsPostRequest) (Nic, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -655,12 +627,14 @@ func (a *LoadBalancersApiService) DatacentersLoadbalancersBalancednicsPostExecut localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LoadBalancersApiService.DatacentersLoadbalancersBalancednicsPost") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/loadbalancers/{loadbalancerId}/balancednics" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"loadbalancerId"+"}", _neturl.PathEscape(parameterToString(r.loadbalancerId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"loadbalancerId"+"}", _neturl.PathEscape(parameterValueToString(r.loadbalancerId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -670,20 +644,10 @@ func (a *LoadBalancersApiService) DatacentersLoadbalancersBalancednicsPostExecut } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -704,13 +668,13 @@ func (a *LoadBalancersApiService) DatacentersLoadbalancersBalancednicsPostExecut localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.nic if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -729,11 +693,11 @@ func (a *LoadBalancersApiService) DatacentersLoadbalancersBalancednicsPostExecut localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersLoadbalancersBalancednicsPost", } @@ -749,28 +713,26 @@ func (a *LoadBalancersApiService) DatacentersLoadbalancersBalancednicsPostExecut } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -800,7 +762,7 @@ func (r ApiDatacentersLoadbalancersDeleteRequest) XContractNumber(xContractNumbe return r } -func (r ApiDatacentersLoadbalancersDeleteRequest) Execute() (*APIResponse, error) { +func (r ApiDatacentersLoadbalancersDeleteRequest) Execute() (*shared.APIResponse, error) { return r.ApiService.DatacentersLoadbalancersDeleteExecute(r) } @@ -824,7 +786,7 @@ func (a *LoadBalancersApiService) DatacentersLoadbalancersDelete(ctx _context.Co /* * Execute executes the request */ -func (a *LoadBalancersApiService) DatacentersLoadbalancersDeleteExecute(r ApiDatacentersLoadbalancersDeleteRequest) (*APIResponse, error) { +func (a *LoadBalancersApiService) DatacentersLoadbalancersDeleteExecute(r ApiDatacentersLoadbalancersDeleteRequest) (*shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodDelete localVarPostBody interface{} @@ -835,32 +797,24 @@ func (a *LoadBalancersApiService) DatacentersLoadbalancersDeleteExecute(r ApiDat localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LoadBalancersApiService.DatacentersLoadbalancersDelete") if err != nil { - return nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/loadbalancers/{loadbalancerId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"loadbalancerId"+"}", _neturl.PathEscape(parameterToString(r.loadbalancerId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"loadbalancerId"+"}", _neturl.PathEscape(parameterValueToString(r.loadbalancerId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -881,11 +835,11 @@ func (a *LoadBalancersApiService) DatacentersLoadbalancersDeleteExecute(r ApiDat localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -904,11 +858,11 @@ func (a *LoadBalancersApiService) DatacentersLoadbalancersDeleteExecute(r ApiDat localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersLoadbalancersDelete", } @@ -924,18 +878,17 @@ func (a *LoadBalancersApiService) DatacentersLoadbalancersDeleteExecute(r ApiDat } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarAPIResponse, newErr } @@ -965,7 +918,7 @@ func (r ApiDatacentersLoadbalancersFindByIdRequest) XContractNumber(xContractNum return r } -func (r ApiDatacentersLoadbalancersFindByIdRequest) Execute() (Loadbalancer, *APIResponse, error) { +func (r ApiDatacentersLoadbalancersFindByIdRequest) Execute() (Loadbalancer, *shared.APIResponse, error) { return r.ApiService.DatacentersLoadbalancersFindByIdExecute(r) } @@ -990,7 +943,7 @@ func (a *LoadBalancersApiService) DatacentersLoadbalancersFindById(ctx _context. * Execute executes the request * @return Loadbalancer */ -func (a *LoadBalancersApiService) DatacentersLoadbalancersFindByIdExecute(r ApiDatacentersLoadbalancersFindByIdRequest) (Loadbalancer, *APIResponse, error) { +func (a *LoadBalancersApiService) DatacentersLoadbalancersFindByIdExecute(r ApiDatacentersLoadbalancersFindByIdRequest) (Loadbalancer, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -1002,32 +955,24 @@ func (a *LoadBalancersApiService) DatacentersLoadbalancersFindByIdExecute(r ApiD localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LoadBalancersApiService.DatacentersLoadbalancersFindById") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/loadbalancers/{loadbalancerId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"loadbalancerId"+"}", _neturl.PathEscape(parameterToString(r.loadbalancerId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"loadbalancerId"+"}", _neturl.PathEscape(parameterValueToString(r.loadbalancerId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -1048,11 +993,11 @@ func (a *LoadBalancersApiService) DatacentersLoadbalancersFindByIdExecute(r ApiD localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -1071,11 +1016,11 @@ func (a *LoadBalancersApiService) DatacentersLoadbalancersFindByIdExecute(r ApiD localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersLoadbalancersFindById", } @@ -1091,28 +1036,26 @@ func (a *LoadBalancersApiService) DatacentersLoadbalancersFindByIdExecute(r ApiD } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -1156,7 +1099,7 @@ func (r ApiDatacentersLoadbalancersGetRequest) Limit(limit int32) ApiDatacenters // Filters query parameters limit results to those containing a matching value for a specific property. func (r ApiDatacentersLoadbalancersGetRequest) Filter(key string, value string) ApiDatacentersLoadbalancersGetRequest { - filterKey := fmt.Sprintf(FilterQueryParam, key) + filterKey := fmt.Sprintf("filter.%s", key) r.filters[filterKey] = append(r.filters[filterKey], value) return r } @@ -1173,7 +1116,7 @@ func (r ApiDatacentersLoadbalancersGetRequest) MaxResults(maxResults int32) ApiD return r } -func (r ApiDatacentersLoadbalancersGetRequest) Execute() (Loadbalancers, *APIResponse, error) { +func (r ApiDatacentersLoadbalancersGetRequest) Execute() (Loadbalancers, *shared.APIResponse, error) { return r.ApiService.DatacentersLoadbalancersGetExecute(r) } @@ -1197,7 +1140,7 @@ func (a *LoadBalancersApiService) DatacentersLoadbalancersGet(ctx _context.Conte * Execute executes the request * @return Loadbalancers */ -func (a *LoadBalancersApiService) DatacentersLoadbalancersGetExecute(r ApiDatacentersLoadbalancersGetRequest) (Loadbalancers, *APIResponse, error) { +func (a *LoadBalancersApiService) DatacentersLoadbalancersGetExecute(r ApiDatacentersLoadbalancersGetRequest) (Loadbalancers, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -1209,47 +1152,29 @@ func (a *LoadBalancersApiService) DatacentersLoadbalancersGetExecute(r ApiDatace localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LoadBalancersApiService.DatacentersLoadbalancersGet") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/loadbalancers" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } if r.offset != nil { - localVarQueryParams.Add("offset", parameterToString(*r.offset, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("offset") - if defaultQueryParam == "" { - localVarQueryParams.Add("offset", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "offset", r.offset, "") } if r.limit != nil { - localVarQueryParams.Add("limit", parameterToString(*r.limit, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("limit") - if defaultQueryParam == "" { - localVarQueryParams.Add("limit", parameterToString(1000, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "") } if r.orderBy != nil { localVarQueryParams.Add("orderBy", parameterToString(*r.orderBy, "")) @@ -1283,11 +1208,11 @@ func (a *LoadBalancersApiService) DatacentersLoadbalancersGetExecute(r ApiDatace localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -1306,11 +1231,11 @@ func (a *LoadBalancersApiService) DatacentersLoadbalancersGetExecute(r ApiDatace localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersLoadbalancersGet", } @@ -1326,28 +1251,26 @@ func (a *LoadBalancersApiService) DatacentersLoadbalancersGetExecute(r ApiDatace } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -1382,7 +1305,7 @@ func (r ApiDatacentersLoadbalancersPatchRequest) XContractNumber(xContractNumber return r } -func (r ApiDatacentersLoadbalancersPatchRequest) Execute() (Loadbalancer, *APIResponse, error) { +func (r ApiDatacentersLoadbalancersPatchRequest) Execute() (Loadbalancer, *shared.APIResponse, error) { return r.ApiService.DatacentersLoadbalancersPatchExecute(r) } @@ -1407,7 +1330,7 @@ func (a *LoadBalancersApiService) DatacentersLoadbalancersPatch(ctx _context.Con * Execute executes the request * @return Loadbalancer */ -func (a *LoadBalancersApiService) DatacentersLoadbalancersPatchExecute(r ApiDatacentersLoadbalancersPatchRequest) (Loadbalancer, *APIResponse, error) { +func (a *LoadBalancersApiService) DatacentersLoadbalancersPatchExecute(r ApiDatacentersLoadbalancersPatchRequest) (Loadbalancer, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPatch localVarPostBody interface{} @@ -1419,12 +1342,14 @@ func (a *LoadBalancersApiService) DatacentersLoadbalancersPatchExecute(r ApiData localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LoadBalancersApiService.DatacentersLoadbalancersPatch") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/loadbalancers/{loadbalancerId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"loadbalancerId"+"}", _neturl.PathEscape(parameterToString(r.loadbalancerId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"loadbalancerId"+"}", _neturl.PathEscape(parameterValueToString(r.loadbalancerId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -1434,20 +1359,10 @@ func (a *LoadBalancersApiService) DatacentersLoadbalancersPatchExecute(r ApiData } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -1468,13 +1383,13 @@ func (a *LoadBalancersApiService) DatacentersLoadbalancersPatchExecute(r ApiData localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.loadbalancer if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -1493,11 +1408,11 @@ func (a *LoadBalancersApiService) DatacentersLoadbalancersPatchExecute(r ApiData localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersLoadbalancersPatch", } @@ -1513,28 +1428,26 @@ func (a *LoadBalancersApiService) DatacentersLoadbalancersPatchExecute(r ApiData } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -1568,7 +1481,7 @@ func (r ApiDatacentersLoadbalancersPostRequest) XContractNumber(xContractNumber return r } -func (r ApiDatacentersLoadbalancersPostRequest) Execute() (Loadbalancer, *APIResponse, error) { +func (r ApiDatacentersLoadbalancersPostRequest) Execute() (Loadbalancer, *shared.APIResponse, error) { return r.ApiService.DatacentersLoadbalancersPostExecute(r) } @@ -1591,7 +1504,7 @@ func (a *LoadBalancersApiService) DatacentersLoadbalancersPost(ctx _context.Cont * Execute executes the request * @return Loadbalancer */ -func (a *LoadBalancersApiService) DatacentersLoadbalancersPostExecute(r ApiDatacentersLoadbalancersPostRequest) (Loadbalancer, *APIResponse, error) { +func (a *LoadBalancersApiService) DatacentersLoadbalancersPostExecute(r ApiDatacentersLoadbalancersPostRequest) (Loadbalancer, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -1603,11 +1516,13 @@ func (a *LoadBalancersApiService) DatacentersLoadbalancersPostExecute(r ApiDatac localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LoadBalancersApiService.DatacentersLoadbalancersPost") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/loadbalancers" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -1617,20 +1532,10 @@ func (a *LoadBalancersApiService) DatacentersLoadbalancersPostExecute(r ApiDatac } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -1651,13 +1556,13 @@ func (a *LoadBalancersApiService) DatacentersLoadbalancersPostExecute(r ApiDatac localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.loadbalancer if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -1676,11 +1581,11 @@ func (a *LoadBalancersApiService) DatacentersLoadbalancersPostExecute(r ApiDatac localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersLoadbalancersPost", } @@ -1696,28 +1601,26 @@ func (a *LoadBalancersApiService) DatacentersLoadbalancersPostExecute(r ApiDatac } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -1752,7 +1655,7 @@ func (r ApiDatacentersLoadbalancersPutRequest) XContractNumber(xContractNumber i return r } -func (r ApiDatacentersLoadbalancersPutRequest) Execute() (Loadbalancer, *APIResponse, error) { +func (r ApiDatacentersLoadbalancersPutRequest) Execute() (Loadbalancer, *shared.APIResponse, error) { return r.ApiService.DatacentersLoadbalancersPutExecute(r) } @@ -1777,7 +1680,7 @@ func (a *LoadBalancersApiService) DatacentersLoadbalancersPut(ctx _context.Conte * Execute executes the request * @return Loadbalancer */ -func (a *LoadBalancersApiService) DatacentersLoadbalancersPutExecute(r ApiDatacentersLoadbalancersPutRequest) (Loadbalancer, *APIResponse, error) { +func (a *LoadBalancersApiService) DatacentersLoadbalancersPutExecute(r ApiDatacentersLoadbalancersPutRequest) (Loadbalancer, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPut localVarPostBody interface{} @@ -1789,12 +1692,14 @@ func (a *LoadBalancersApiService) DatacentersLoadbalancersPutExecute(r ApiDatace localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LoadBalancersApiService.DatacentersLoadbalancersPut") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/loadbalancers/{loadbalancerId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"loadbalancerId"+"}", _neturl.PathEscape(parameterToString(r.loadbalancerId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"loadbalancerId"+"}", _neturl.PathEscape(parameterValueToString(r.loadbalancerId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -1804,20 +1709,10 @@ func (a *LoadBalancersApiService) DatacentersLoadbalancersPutExecute(r ApiDatace } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -1838,13 +1733,13 @@ func (a *LoadBalancersApiService) DatacentersLoadbalancersPutExecute(r ApiDatace localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.loadbalancer if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -1863,11 +1758,11 @@ func (a *LoadBalancersApiService) DatacentersLoadbalancersPutExecute(r ApiDatace localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersLoadbalancersPut", } @@ -1883,28 +1778,26 @@ func (a *LoadBalancersApiService) DatacentersLoadbalancersPutExecute(r ApiDatace } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/api_locations.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/api_locations.go similarity index 78% rename from vendor/github.com/ionos-cloud/sdk-go/v6/api_locations.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/api_locations.go index 4c2e0f779..082f30d94 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/api_locations.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/api_locations.go @@ -13,6 +13,7 @@ package ionoscloud import ( _context "context" "fmt" + "github.com/ionos-cloud/sdk-go-bundle/shared" "io" _nethttp "net/http" _neturl "net/url" @@ -49,7 +50,7 @@ func (r ApiLocationsFindByRegionIdRequest) XContractNumber(xContractNumber int32 return r } -func (r ApiLocationsFindByRegionIdRequest) Execute() (Locations, *APIResponse, error) { +func (r ApiLocationsFindByRegionIdRequest) Execute() (Locations, *shared.APIResponse, error) { return r.ApiService.LocationsFindByRegionIdExecute(r) } @@ -72,7 +73,7 @@ func (a *LocationsApiService) LocationsFindByRegionId(ctx _context.Context, regi * Execute executes the request * @return Locations */ -func (a *LocationsApiService) LocationsFindByRegionIdExecute(r ApiLocationsFindByRegionIdRequest) (Locations, *APIResponse, error) { +func (a *LocationsApiService) LocationsFindByRegionIdExecute(r ApiLocationsFindByRegionIdRequest) (Locations, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -84,31 +85,23 @@ func (a *LocationsApiService) LocationsFindByRegionIdExecute(r ApiLocationsFindB localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LocationsApiService.LocationsFindByRegionId") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/locations/{regionId}" - localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", _neturl.PathEscape(parameterToString(r.regionId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", _neturl.PathEscape(parameterValueToString(r.regionId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -129,11 +122,11 @@ func (a *LocationsApiService) LocationsFindByRegionIdExecute(r ApiLocationsFindB localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -152,11 +145,11 @@ func (a *LocationsApiService) LocationsFindByRegionIdExecute(r ApiLocationsFindB localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "LocationsFindByRegionId", } @@ -172,28 +165,26 @@ func (a *LocationsApiService) LocationsFindByRegionIdExecute(r ApiLocationsFindB } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -223,7 +214,7 @@ func (r ApiLocationsFindByRegionIdAndIdRequest) XContractNumber(xContractNumber return r } -func (r ApiLocationsFindByRegionIdAndIdRequest) Execute() (Location, *APIResponse, error) { +func (r ApiLocationsFindByRegionIdAndIdRequest) Execute() (Location, *shared.APIResponse, error) { return r.ApiService.LocationsFindByRegionIdAndIdExecute(r) } @@ -248,7 +239,7 @@ func (a *LocationsApiService) LocationsFindByRegionIdAndId(ctx _context.Context, * Execute executes the request * @return Location */ -func (a *LocationsApiService) LocationsFindByRegionIdAndIdExecute(r ApiLocationsFindByRegionIdAndIdRequest) (Location, *APIResponse, error) { +func (a *LocationsApiService) LocationsFindByRegionIdAndIdExecute(r ApiLocationsFindByRegionIdAndIdRequest) (Location, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -260,32 +251,24 @@ func (a *LocationsApiService) LocationsFindByRegionIdAndIdExecute(r ApiLocations localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LocationsApiService.LocationsFindByRegionIdAndId") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/locations/{regionId}/{locationId}" - localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", _neturl.PathEscape(parameterToString(r.regionId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"locationId"+"}", _neturl.PathEscape(parameterToString(r.locationId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", _neturl.PathEscape(parameterValueToString(r.regionId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"locationId"+"}", _neturl.PathEscape(parameterValueToString(r.locationId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -306,11 +289,11 @@ func (a *LocationsApiService) LocationsFindByRegionIdAndIdExecute(r ApiLocations localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -329,11 +312,11 @@ func (a *LocationsApiService) LocationsFindByRegionIdAndIdExecute(r ApiLocations localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "LocationsFindByRegionIdAndId", } @@ -349,28 +332,26 @@ func (a *LocationsApiService) LocationsFindByRegionIdAndIdExecute(r ApiLocations } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -403,7 +384,7 @@ func (r ApiLocationsGetRequest) XContractNumber(xContractNumber int32) ApiLocati // Filters query parameters limit results to those containing a matching value for a specific property. func (r ApiLocationsGetRequest) Filter(key string, value string) ApiLocationsGetRequest { - filterKey := fmt.Sprintf(FilterQueryParam, key) + filterKey := fmt.Sprintf("filter.%s", key) r.filters[filterKey] = append(r.filters[filterKey], value) return r } @@ -420,7 +401,7 @@ func (r ApiLocationsGetRequest) MaxResults(maxResults int32) ApiLocationsGetRequ return r } -func (r ApiLocationsGetRequest) Execute() (Locations, *APIResponse, error) { +func (r ApiLocationsGetRequest) Execute() (Locations, *shared.APIResponse, error) { return r.ApiService.LocationsGetExecute(r) } @@ -450,7 +431,7 @@ func (a *LocationsApiService) LocationsGet(ctx _context.Context) ApiLocationsGet * Execute executes the request * @return Locations */ -func (a *LocationsApiService) LocationsGetExecute(r ApiLocationsGetRequest) (Locations, *APIResponse, error) { +func (a *LocationsApiService) LocationsGetExecute(r ApiLocationsGetRequest) (Locations, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -462,7 +443,9 @@ func (a *LocationsApiService) LocationsGetExecute(r ApiLocationsGetRequest) (Loc localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "LocationsApiService.LocationsGet") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/locations" @@ -472,20 +455,10 @@ func (a *LocationsApiService) LocationsGetExecute(r ApiLocationsGetRequest) (Loc localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } if r.orderBy != nil { localVarQueryParams.Add("orderBy", parameterToString(*r.orderBy, "")) @@ -519,11 +492,11 @@ func (a *LocationsApiService) LocationsGetExecute(r ApiLocationsGetRequest) (Loc localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -542,11 +515,11 @@ func (a *LocationsApiService) LocationsGetExecute(r ApiLocationsGetRequest) (Loc localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "LocationsGet", } @@ -562,28 +535,26 @@ func (a *LocationsApiService) LocationsGetExecute(r ApiLocationsGetRequest) (Loc } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/api_nat_gateways.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/api_nat_gateways.go similarity index 78% rename from vendor/github.com/ionos-cloud/sdk-go/v6/api_nat_gateways.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/api_nat_gateways.go index 036483831..0791fe29e 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/api_nat_gateways.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/api_nat_gateways.go @@ -13,6 +13,7 @@ package ionoscloud import ( _context "context" "fmt" + "github.com/ionos-cloud/sdk-go-bundle/shared" "io" _nethttp "net/http" _neturl "net/url" @@ -50,7 +51,7 @@ func (r ApiDatacentersNatgatewaysDeleteRequest) XContractNumber(xContractNumber return r } -func (r ApiDatacentersNatgatewaysDeleteRequest) Execute() (*APIResponse, error) { +func (r ApiDatacentersNatgatewaysDeleteRequest) Execute() (*shared.APIResponse, error) { return r.ApiService.DatacentersNatgatewaysDeleteExecute(r) } @@ -74,7 +75,7 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysDelete(ctx _context.Contex /* * Execute executes the request */ -func (a *NATGatewaysApiService) DatacentersNatgatewaysDeleteExecute(r ApiDatacentersNatgatewaysDeleteRequest) (*APIResponse, error) { +func (a *NATGatewaysApiService) DatacentersNatgatewaysDeleteExecute(r ApiDatacentersNatgatewaysDeleteRequest) (*shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodDelete localVarPostBody interface{} @@ -85,32 +86,24 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysDeleteExecute(r ApiDatacen localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "NATGatewaysApiService.DatacentersNatgatewaysDelete") if err != nil { - return nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/natgateways/{natGatewayId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"natGatewayId"+"}", _neturl.PathEscape(parameterToString(r.natGatewayId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"natGatewayId"+"}", _neturl.PathEscape(parameterValueToString(r.natGatewayId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -131,11 +124,11 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysDeleteExecute(r ApiDatacen localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -154,11 +147,11 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysDeleteExecute(r ApiDatacen localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersNatgatewaysDelete", } @@ -174,18 +167,17 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysDeleteExecute(r ApiDatacen } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarAPIResponse, newErr } @@ -215,7 +207,7 @@ func (r ApiDatacentersNatgatewaysFindByNatGatewayIdRequest) XContractNumber(xCon return r } -func (r ApiDatacentersNatgatewaysFindByNatGatewayIdRequest) Execute() (NatGateway, *APIResponse, error) { +func (r ApiDatacentersNatgatewaysFindByNatGatewayIdRequest) Execute() (NatGateway, *shared.APIResponse, error) { return r.ApiService.DatacentersNatgatewaysFindByNatGatewayIdExecute(r) } @@ -240,7 +232,7 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysFindByNatGatewayId(ctx _co * Execute executes the request * @return NatGateway */ -func (a *NATGatewaysApiService) DatacentersNatgatewaysFindByNatGatewayIdExecute(r ApiDatacentersNatgatewaysFindByNatGatewayIdRequest) (NatGateway, *APIResponse, error) { +func (a *NATGatewaysApiService) DatacentersNatgatewaysFindByNatGatewayIdExecute(r ApiDatacentersNatgatewaysFindByNatGatewayIdRequest) (NatGateway, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -252,32 +244,24 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysFindByNatGatewayIdExecute( localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "NATGatewaysApiService.DatacentersNatgatewaysFindByNatGatewayId") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/natgateways/{natGatewayId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"natGatewayId"+"}", _neturl.PathEscape(parameterToString(r.natGatewayId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"natGatewayId"+"}", _neturl.PathEscape(parameterValueToString(r.natGatewayId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -298,11 +282,11 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysFindByNatGatewayIdExecute( localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -321,11 +305,11 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysFindByNatGatewayIdExecute( localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersNatgatewaysFindByNatGatewayId", } @@ -341,28 +325,26 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysFindByNatGatewayIdExecute( } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -388,7 +370,7 @@ func (r ApiDatacentersNatgatewaysFlowlogsDeleteRequest) Depth(depth int32) ApiDa return r } -func (r ApiDatacentersNatgatewaysFlowlogsDeleteRequest) Execute() (*APIResponse, error) { +func (r ApiDatacentersNatgatewaysFlowlogsDeleteRequest) Execute() (*shared.APIResponse, error) { return r.ApiService.DatacentersNatgatewaysFlowlogsDeleteExecute(r) } @@ -414,7 +396,7 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysFlowlogsDelete(ctx _contex /* * Execute executes the request */ -func (a *NATGatewaysApiService) DatacentersNatgatewaysFlowlogsDeleteExecute(r ApiDatacentersNatgatewaysFlowlogsDeleteRequest) (*APIResponse, error) { +func (a *NATGatewaysApiService) DatacentersNatgatewaysFlowlogsDeleteExecute(r ApiDatacentersNatgatewaysFlowlogsDeleteRequest) (*shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodDelete localVarPostBody interface{} @@ -425,33 +407,25 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysFlowlogsDeleteExecute(r Ap localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "NATGatewaysApiService.DatacentersNatgatewaysFlowlogsDelete") if err != nil { - return nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/natgateways/{natGatewayId}/flowlogs/{flowLogId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"natGatewayId"+"}", _neturl.PathEscape(parameterToString(r.natGatewayId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"flowLogId"+"}", _neturl.PathEscape(parameterToString(r.flowLogId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"natGatewayId"+"}", _neturl.PathEscape(parameterValueToString(r.natGatewayId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"flowLogId"+"}", _neturl.PathEscape(parameterValueToString(r.flowLogId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -473,7 +447,7 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysFlowlogsDeleteExecute(r Ap } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -492,11 +466,11 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysFlowlogsDeleteExecute(r Ap localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersNatgatewaysFlowlogsDelete", } @@ -512,18 +486,17 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysFlowlogsDeleteExecute(r Ap } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarAPIResponse, newErr } @@ -549,7 +522,7 @@ func (r ApiDatacentersNatgatewaysFlowlogsFindByFlowLogIdRequest) Depth(depth int return r } -func (r ApiDatacentersNatgatewaysFlowlogsFindByFlowLogIdRequest) Execute() (FlowLog, *APIResponse, error) { +func (r ApiDatacentersNatgatewaysFlowlogsFindByFlowLogIdRequest) Execute() (FlowLog, *shared.APIResponse, error) { return r.ApiService.DatacentersNatgatewaysFlowlogsFindByFlowLogIdExecute(r) } @@ -576,7 +549,7 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysFlowlogsFindByFlowLogId(ct * Execute executes the request * @return FlowLog */ -func (a *NATGatewaysApiService) DatacentersNatgatewaysFlowlogsFindByFlowLogIdExecute(r ApiDatacentersNatgatewaysFlowlogsFindByFlowLogIdRequest) (FlowLog, *APIResponse, error) { +func (a *NATGatewaysApiService) DatacentersNatgatewaysFlowlogsFindByFlowLogIdExecute(r ApiDatacentersNatgatewaysFlowlogsFindByFlowLogIdRequest) (FlowLog, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -588,33 +561,25 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysFlowlogsFindByFlowLogIdExe localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "NATGatewaysApiService.DatacentersNatgatewaysFlowlogsFindByFlowLogId") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/natgateways/{natGatewayId}/flowlogs/{flowLogId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"natGatewayId"+"}", _neturl.PathEscape(parameterToString(r.natGatewayId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"flowLogId"+"}", _neturl.PathEscape(parameterToString(r.flowLogId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"natGatewayId"+"}", _neturl.PathEscape(parameterValueToString(r.natGatewayId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"flowLogId"+"}", _neturl.PathEscape(parameterValueToString(r.flowLogId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -636,7 +601,7 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysFlowlogsFindByFlowLogIdExe } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -655,11 +620,11 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysFlowlogsFindByFlowLogIdExe localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersNatgatewaysFlowlogsFindByFlowLogId", } @@ -675,28 +640,26 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysFlowlogsFindByFlowLogIdExe } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -736,7 +699,7 @@ func (r ApiDatacentersNatgatewaysFlowlogsGetRequest) Limit(limit int32) ApiDatac // Filters query parameters limit results to those containing a matching value for a specific property. func (r ApiDatacentersNatgatewaysFlowlogsGetRequest) Filter(key string, value string) ApiDatacentersNatgatewaysFlowlogsGetRequest { - filterKey := fmt.Sprintf(FilterQueryParam, key) + filterKey := fmt.Sprintf("filter.%s", key) r.filters[filterKey] = append(r.filters[filterKey], value) return r } @@ -753,7 +716,7 @@ func (r ApiDatacentersNatgatewaysFlowlogsGetRequest) MaxResults(maxResults int32 return r } -func (r ApiDatacentersNatgatewaysFlowlogsGetRequest) Execute() (FlowLogs, *APIResponse, error) { +func (r ApiDatacentersNatgatewaysFlowlogsGetRequest) Execute() (FlowLogs, *shared.APIResponse, error) { return r.ApiService.DatacentersNatgatewaysFlowlogsGetExecute(r) } @@ -779,7 +742,7 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysFlowlogsGet(ctx _context.C * Execute executes the request * @return FlowLogs */ -func (a *NATGatewaysApiService) DatacentersNatgatewaysFlowlogsGetExecute(r ApiDatacentersNatgatewaysFlowlogsGetRequest) (FlowLogs, *APIResponse, error) { +func (a *NATGatewaysApiService) DatacentersNatgatewaysFlowlogsGetExecute(r ApiDatacentersNatgatewaysFlowlogsGetRequest) (FlowLogs, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -791,48 +754,30 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysFlowlogsGetExecute(r ApiDa localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "NATGatewaysApiService.DatacentersNatgatewaysFlowlogsGet") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/natgateways/{natGatewayId}/flowlogs" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"natGatewayId"+"}", _neturl.PathEscape(parameterToString(r.natGatewayId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"natGatewayId"+"}", _neturl.PathEscape(parameterValueToString(r.natGatewayId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } if r.offset != nil { - localVarQueryParams.Add("offset", parameterToString(*r.offset, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("offset") - if defaultQueryParam == "" { - localVarQueryParams.Add("offset", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "offset", r.offset, "") } if r.limit != nil { - localVarQueryParams.Add("limit", parameterToString(*r.limit, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("limit") - if defaultQueryParam == "" { - localVarQueryParams.Add("limit", parameterToString(1000, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "") } if r.orderBy != nil { localVarQueryParams.Add("orderBy", parameterToString(*r.orderBy, "")) @@ -867,7 +812,7 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysFlowlogsGetExecute(r ApiDa } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -886,11 +831,11 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysFlowlogsGetExecute(r ApiDa localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersNatgatewaysFlowlogsGet", } @@ -906,28 +851,26 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysFlowlogsGetExecute(r ApiDa } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -958,7 +901,7 @@ func (r ApiDatacentersNatgatewaysFlowlogsPatchRequest) Depth(depth int32) ApiDat return r } -func (r ApiDatacentersNatgatewaysFlowlogsPatchRequest) Execute() (FlowLog, *APIResponse, error) { +func (r ApiDatacentersNatgatewaysFlowlogsPatchRequest) Execute() (FlowLog, *shared.APIResponse, error) { return r.ApiService.DatacentersNatgatewaysFlowlogsPatchExecute(r) } @@ -985,7 +928,7 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysFlowlogsPatch(ctx _context * Execute executes the request * @return FlowLog */ -func (a *NATGatewaysApiService) DatacentersNatgatewaysFlowlogsPatchExecute(r ApiDatacentersNatgatewaysFlowlogsPatchRequest) (FlowLog, *APIResponse, error) { +func (a *NATGatewaysApiService) DatacentersNatgatewaysFlowlogsPatchExecute(r ApiDatacentersNatgatewaysFlowlogsPatchRequest) (FlowLog, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPatch localVarPostBody interface{} @@ -997,13 +940,15 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysFlowlogsPatchExecute(r Api localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "NATGatewaysApiService.DatacentersNatgatewaysFlowlogsPatch") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/natgateways/{natGatewayId}/flowlogs/{flowLogId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"natGatewayId"+"}", _neturl.PathEscape(parameterToString(r.natGatewayId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"flowLogId"+"}", _neturl.PathEscape(parameterToString(r.flowLogId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"natGatewayId"+"}", _neturl.PathEscape(parameterValueToString(r.natGatewayId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"flowLogId"+"}", _neturl.PathEscape(parameterValueToString(r.flowLogId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -1013,20 +958,10 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysFlowlogsPatchExecute(r Api } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -1050,7 +985,7 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysFlowlogsPatchExecute(r Api localVarPostBody = r.natGatewayFlowLogProperties if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -1069,11 +1004,11 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysFlowlogsPatchExecute(r Api localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersNatgatewaysFlowlogsPatch", } @@ -1089,28 +1024,26 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysFlowlogsPatchExecute(r Api } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -1140,7 +1073,7 @@ func (r ApiDatacentersNatgatewaysFlowlogsPostRequest) Depth(depth int32) ApiData return r } -func (r ApiDatacentersNatgatewaysFlowlogsPostRequest) Execute() (FlowLog, *APIResponse, error) { +func (r ApiDatacentersNatgatewaysFlowlogsPostRequest) Execute() (FlowLog, *shared.APIResponse, error) { return r.ApiService.DatacentersNatgatewaysFlowlogsPostExecute(r) } @@ -1165,7 +1098,7 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysFlowlogsPost(ctx _context. * Execute executes the request * @return FlowLog */ -func (a *NATGatewaysApiService) DatacentersNatgatewaysFlowlogsPostExecute(r ApiDatacentersNatgatewaysFlowlogsPostRequest) (FlowLog, *APIResponse, error) { +func (a *NATGatewaysApiService) DatacentersNatgatewaysFlowlogsPostExecute(r ApiDatacentersNatgatewaysFlowlogsPostRequest) (FlowLog, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -1177,12 +1110,14 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysFlowlogsPostExecute(r ApiD localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "NATGatewaysApiService.DatacentersNatgatewaysFlowlogsPost") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/natgateways/{natGatewayId}/flowlogs" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"natGatewayId"+"}", _neturl.PathEscape(parameterToString(r.natGatewayId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"natGatewayId"+"}", _neturl.PathEscape(parameterValueToString(r.natGatewayId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -1192,20 +1127,10 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysFlowlogsPostExecute(r ApiD } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -1229,7 +1154,7 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysFlowlogsPostExecute(r ApiD localVarPostBody = r.natGatewayFlowLog if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -1248,11 +1173,11 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysFlowlogsPostExecute(r ApiD localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersNatgatewaysFlowlogsPost", } @@ -1268,28 +1193,26 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysFlowlogsPostExecute(r ApiD } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -1320,7 +1243,7 @@ func (r ApiDatacentersNatgatewaysFlowlogsPutRequest) Depth(depth int32) ApiDatac return r } -func (r ApiDatacentersNatgatewaysFlowlogsPutRequest) Execute() (FlowLog, *APIResponse, error) { +func (r ApiDatacentersNatgatewaysFlowlogsPutRequest) Execute() (FlowLog, *shared.APIResponse, error) { return r.ApiService.DatacentersNatgatewaysFlowlogsPutExecute(r) } @@ -1347,7 +1270,7 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysFlowlogsPut(ctx _context.C * Execute executes the request * @return FlowLog */ -func (a *NATGatewaysApiService) DatacentersNatgatewaysFlowlogsPutExecute(r ApiDatacentersNatgatewaysFlowlogsPutRequest) (FlowLog, *APIResponse, error) { +func (a *NATGatewaysApiService) DatacentersNatgatewaysFlowlogsPutExecute(r ApiDatacentersNatgatewaysFlowlogsPutRequest) (FlowLog, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPut localVarPostBody interface{} @@ -1359,13 +1282,15 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysFlowlogsPutExecute(r ApiDa localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "NATGatewaysApiService.DatacentersNatgatewaysFlowlogsPut") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/natgateways/{natGatewayId}/flowlogs/{flowLogId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"natGatewayId"+"}", _neturl.PathEscape(parameterToString(r.natGatewayId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"flowLogId"+"}", _neturl.PathEscape(parameterToString(r.flowLogId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"natGatewayId"+"}", _neturl.PathEscape(parameterValueToString(r.natGatewayId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"flowLogId"+"}", _neturl.PathEscape(parameterValueToString(r.flowLogId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -1375,20 +1300,10 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysFlowlogsPutExecute(r ApiDa } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -1412,7 +1327,7 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysFlowlogsPutExecute(r ApiDa localVarPostBody = r.natGatewayFlowLog if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -1431,11 +1346,11 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysFlowlogsPutExecute(r ApiDa localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersNatgatewaysFlowlogsPut", } @@ -1451,28 +1366,26 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysFlowlogsPutExecute(r ApiDa } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -1506,7 +1419,7 @@ func (r ApiDatacentersNatgatewaysGetRequest) XContractNumber(xContractNumber int // Filters query parameters limit results to those containing a matching value for a specific property. func (r ApiDatacentersNatgatewaysGetRequest) Filter(key string, value string) ApiDatacentersNatgatewaysGetRequest { - filterKey := fmt.Sprintf(FilterQueryParam, key) + filterKey := fmt.Sprintf("filter.%s", key) r.filters[filterKey] = append(r.filters[filterKey], value) return r } @@ -1523,7 +1436,7 @@ func (r ApiDatacentersNatgatewaysGetRequest) MaxResults(maxResults int32) ApiDat return r } -func (r ApiDatacentersNatgatewaysGetRequest) Execute() (NatGateways, *APIResponse, error) { +func (r ApiDatacentersNatgatewaysGetRequest) Execute() (NatGateways, *shared.APIResponse, error) { return r.ApiService.DatacentersNatgatewaysGetExecute(r) } @@ -1547,7 +1460,7 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysGet(ctx _context.Context, * Execute executes the request * @return NatGateways */ -func (a *NATGatewaysApiService) DatacentersNatgatewaysGetExecute(r ApiDatacentersNatgatewaysGetRequest) (NatGateways, *APIResponse, error) { +func (a *NATGatewaysApiService) DatacentersNatgatewaysGetExecute(r ApiDatacentersNatgatewaysGetRequest) (NatGateways, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -1559,31 +1472,23 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysGetExecute(r ApiDatacenter localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "NATGatewaysApiService.DatacentersNatgatewaysGet") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/natgateways" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } if r.orderBy != nil { localVarQueryParams.Add("orderBy", parameterToString(*r.orderBy, "")) @@ -1617,11 +1522,11 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysGetExecute(r ApiDatacenter localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -1640,11 +1545,11 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysGetExecute(r ApiDatacenter localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersNatgatewaysGet", } @@ -1660,28 +1565,26 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysGetExecute(r ApiDatacenter } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -1716,7 +1619,7 @@ func (r ApiDatacentersNatgatewaysPatchRequest) XContractNumber(xContractNumber i return r } -func (r ApiDatacentersNatgatewaysPatchRequest) Execute() (NatGateway, *APIResponse, error) { +func (r ApiDatacentersNatgatewaysPatchRequest) Execute() (NatGateway, *shared.APIResponse, error) { return r.ApiService.DatacentersNatgatewaysPatchExecute(r) } @@ -1741,7 +1644,7 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysPatch(ctx _context.Context * Execute executes the request * @return NatGateway */ -func (a *NATGatewaysApiService) DatacentersNatgatewaysPatchExecute(r ApiDatacentersNatgatewaysPatchRequest) (NatGateway, *APIResponse, error) { +func (a *NATGatewaysApiService) DatacentersNatgatewaysPatchExecute(r ApiDatacentersNatgatewaysPatchRequest) (NatGateway, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPatch localVarPostBody interface{} @@ -1753,12 +1656,14 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysPatchExecute(r ApiDatacent localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "NATGatewaysApiService.DatacentersNatgatewaysPatch") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/natgateways/{natGatewayId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"natGatewayId"+"}", _neturl.PathEscape(parameterToString(r.natGatewayId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"natGatewayId"+"}", _neturl.PathEscape(parameterValueToString(r.natGatewayId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -1768,20 +1673,10 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysPatchExecute(r ApiDatacent } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -1802,13 +1697,13 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysPatchExecute(r ApiDatacent localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.natGatewayProperties if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -1827,11 +1722,11 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysPatchExecute(r ApiDatacent localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersNatgatewaysPatch", } @@ -1847,28 +1742,26 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysPatchExecute(r ApiDatacent } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -1902,7 +1795,7 @@ func (r ApiDatacentersNatgatewaysPostRequest) XContractNumber(xContractNumber in return r } -func (r ApiDatacentersNatgatewaysPostRequest) Execute() (NatGateway, *APIResponse, error) { +func (r ApiDatacentersNatgatewaysPostRequest) Execute() (NatGateway, *shared.APIResponse, error) { return r.ApiService.DatacentersNatgatewaysPostExecute(r) } @@ -1927,7 +1820,7 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysPost(ctx _context.Context, * Execute executes the request * @return NatGateway */ -func (a *NATGatewaysApiService) DatacentersNatgatewaysPostExecute(r ApiDatacentersNatgatewaysPostRequest) (NatGateway, *APIResponse, error) { +func (a *NATGatewaysApiService) DatacentersNatgatewaysPostExecute(r ApiDatacentersNatgatewaysPostRequest) (NatGateway, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -1939,11 +1832,13 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysPostExecute(r ApiDatacente localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "NATGatewaysApiService.DatacentersNatgatewaysPost") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/natgateways" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -1953,20 +1848,10 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysPostExecute(r ApiDatacente } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -1987,13 +1872,13 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysPostExecute(r ApiDatacente localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.natGateway if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -2012,11 +1897,11 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysPostExecute(r ApiDatacente localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersNatgatewaysPost", } @@ -2032,28 +1917,26 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysPostExecute(r ApiDatacente } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -2088,7 +1971,7 @@ func (r ApiDatacentersNatgatewaysPutRequest) XContractNumber(xContractNumber int return r } -func (r ApiDatacentersNatgatewaysPutRequest) Execute() (NatGateway, *APIResponse, error) { +func (r ApiDatacentersNatgatewaysPutRequest) Execute() (NatGateway, *shared.APIResponse, error) { return r.ApiService.DatacentersNatgatewaysPutExecute(r) } @@ -2113,7 +1996,7 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysPut(ctx _context.Context, * Execute executes the request * @return NatGateway */ -func (a *NATGatewaysApiService) DatacentersNatgatewaysPutExecute(r ApiDatacentersNatgatewaysPutRequest) (NatGateway, *APIResponse, error) { +func (a *NATGatewaysApiService) DatacentersNatgatewaysPutExecute(r ApiDatacentersNatgatewaysPutRequest) (NatGateway, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPut localVarPostBody interface{} @@ -2125,12 +2008,14 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysPutExecute(r ApiDatacenter localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "NATGatewaysApiService.DatacentersNatgatewaysPut") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/natgateways/{natGatewayId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"natGatewayId"+"}", _neturl.PathEscape(parameterToString(r.natGatewayId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"natGatewayId"+"}", _neturl.PathEscape(parameterValueToString(r.natGatewayId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -2140,20 +2025,10 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysPutExecute(r ApiDatacenter } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -2174,13 +2049,13 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysPutExecute(r ApiDatacenter localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.natGateway if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -2199,11 +2074,11 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysPutExecute(r ApiDatacenter localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersNatgatewaysPut", } @@ -2219,28 +2094,26 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysPutExecute(r ApiDatacenter } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -2271,7 +2144,7 @@ func (r ApiDatacentersNatgatewaysRulesDeleteRequest) XContractNumber(xContractNu return r } -func (r ApiDatacentersNatgatewaysRulesDeleteRequest) Execute() (*APIResponse, error) { +func (r ApiDatacentersNatgatewaysRulesDeleteRequest) Execute() (*shared.APIResponse, error) { return r.ApiService.DatacentersNatgatewaysRulesDeleteExecute(r) } @@ -2297,7 +2170,7 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysRulesDelete(ctx _context.C /* * Execute executes the request */ -func (a *NATGatewaysApiService) DatacentersNatgatewaysRulesDeleteExecute(r ApiDatacentersNatgatewaysRulesDeleteRequest) (*APIResponse, error) { +func (a *NATGatewaysApiService) DatacentersNatgatewaysRulesDeleteExecute(r ApiDatacentersNatgatewaysRulesDeleteRequest) (*shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodDelete localVarPostBody interface{} @@ -2308,33 +2181,25 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysRulesDeleteExecute(r ApiDa localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "NATGatewaysApiService.DatacentersNatgatewaysRulesDelete") if err != nil { - return nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/natgateways/{natGatewayId}/rules/{natGatewayRuleId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"natGatewayId"+"}", _neturl.PathEscape(parameterToString(r.natGatewayId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"natGatewayRuleId"+"}", _neturl.PathEscape(parameterToString(r.natGatewayRuleId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"natGatewayId"+"}", _neturl.PathEscape(parameterValueToString(r.natGatewayId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"natGatewayRuleId"+"}", _neturl.PathEscape(parameterValueToString(r.natGatewayRuleId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -2355,11 +2220,11 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysRulesDeleteExecute(r ApiDa localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -2378,11 +2243,11 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysRulesDeleteExecute(r ApiDa localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersNatgatewaysRulesDelete", } @@ -2398,18 +2263,17 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysRulesDeleteExecute(r ApiDa } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarAPIResponse, newErr } @@ -2440,7 +2304,7 @@ func (r ApiDatacentersNatgatewaysRulesFindByNatGatewayRuleIdRequest) XContractNu return r } -func (r ApiDatacentersNatgatewaysRulesFindByNatGatewayRuleIdRequest) Execute() (NatGatewayRule, *APIResponse, error) { +func (r ApiDatacentersNatgatewaysRulesFindByNatGatewayRuleIdRequest) Execute() (NatGatewayRule, *shared.APIResponse, error) { return r.ApiService.DatacentersNatgatewaysRulesFindByNatGatewayRuleIdExecute(r) } @@ -2467,7 +2331,7 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysRulesFindByNatGatewayRuleI * Execute executes the request * @return NatGatewayRule */ -func (a *NATGatewaysApiService) DatacentersNatgatewaysRulesFindByNatGatewayRuleIdExecute(r ApiDatacentersNatgatewaysRulesFindByNatGatewayRuleIdRequest) (NatGatewayRule, *APIResponse, error) { +func (a *NATGatewaysApiService) DatacentersNatgatewaysRulesFindByNatGatewayRuleIdExecute(r ApiDatacentersNatgatewaysRulesFindByNatGatewayRuleIdRequest) (NatGatewayRule, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -2479,33 +2343,25 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysRulesFindByNatGatewayRuleI localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "NATGatewaysApiService.DatacentersNatgatewaysRulesFindByNatGatewayRuleId") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/natgateways/{natGatewayId}/rules/{natGatewayRuleId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"natGatewayId"+"}", _neturl.PathEscape(parameterToString(r.natGatewayId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"natGatewayRuleId"+"}", _neturl.PathEscape(parameterToString(r.natGatewayRuleId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"natGatewayId"+"}", _neturl.PathEscape(parameterValueToString(r.natGatewayId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"natGatewayRuleId"+"}", _neturl.PathEscape(parameterValueToString(r.natGatewayRuleId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -2526,11 +2382,11 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysRulesFindByNatGatewayRuleI localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -2549,11 +2405,11 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysRulesFindByNatGatewayRuleI localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersNatgatewaysRulesFindByNatGatewayRuleId", } @@ -2569,28 +2425,26 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysRulesFindByNatGatewayRuleI } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -2625,7 +2479,7 @@ func (r ApiDatacentersNatgatewaysRulesGetRequest) XContractNumber(xContractNumbe // Filters query parameters limit results to those containing a matching value for a specific property. func (r ApiDatacentersNatgatewaysRulesGetRequest) Filter(key string, value string) ApiDatacentersNatgatewaysRulesGetRequest { - filterKey := fmt.Sprintf(FilterQueryParam, key) + filterKey := fmt.Sprintf("filter.%s", key) r.filters[filterKey] = append(r.filters[filterKey], value) return r } @@ -2642,7 +2496,7 @@ func (r ApiDatacentersNatgatewaysRulesGetRequest) MaxResults(maxResults int32) A return r } -func (r ApiDatacentersNatgatewaysRulesGetRequest) Execute() (NatGatewayRules, *APIResponse, error) { +func (r ApiDatacentersNatgatewaysRulesGetRequest) Execute() (NatGatewayRules, *shared.APIResponse, error) { return r.ApiService.DatacentersNatgatewaysRulesGetExecute(r) } @@ -2668,7 +2522,7 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysRulesGet(ctx _context.Cont * Execute executes the request * @return NatGatewayRules */ -func (a *NATGatewaysApiService) DatacentersNatgatewaysRulesGetExecute(r ApiDatacentersNatgatewaysRulesGetRequest) (NatGatewayRules, *APIResponse, error) { +func (a *NATGatewaysApiService) DatacentersNatgatewaysRulesGetExecute(r ApiDatacentersNatgatewaysRulesGetRequest) (NatGatewayRules, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -2680,32 +2534,24 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysRulesGetExecute(r ApiDatac localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "NATGatewaysApiService.DatacentersNatgatewaysRulesGet") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/natgateways/{natGatewayId}/rules" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"natGatewayId"+"}", _neturl.PathEscape(parameterToString(r.natGatewayId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"natGatewayId"+"}", _neturl.PathEscape(parameterValueToString(r.natGatewayId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } if r.orderBy != nil { localVarQueryParams.Add("orderBy", parameterToString(*r.orderBy, "")) @@ -2739,11 +2585,11 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysRulesGetExecute(r ApiDatac localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -2762,11 +2608,11 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysRulesGetExecute(r ApiDatac localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersNatgatewaysRulesGet", } @@ -2782,28 +2628,26 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysRulesGetExecute(r ApiDatac } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -2839,7 +2683,7 @@ func (r ApiDatacentersNatgatewaysRulesPatchRequest) XContractNumber(xContractNum return r } -func (r ApiDatacentersNatgatewaysRulesPatchRequest) Execute() (NatGatewayRule, *APIResponse, error) { +func (r ApiDatacentersNatgatewaysRulesPatchRequest) Execute() (NatGatewayRule, *shared.APIResponse, error) { return r.ApiService.DatacentersNatgatewaysRulesPatchExecute(r) } @@ -2866,7 +2710,7 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysRulesPatch(ctx _context.Co * Execute executes the request * @return NatGatewayRule */ -func (a *NATGatewaysApiService) DatacentersNatgatewaysRulesPatchExecute(r ApiDatacentersNatgatewaysRulesPatchRequest) (NatGatewayRule, *APIResponse, error) { +func (a *NATGatewaysApiService) DatacentersNatgatewaysRulesPatchExecute(r ApiDatacentersNatgatewaysRulesPatchRequest) (NatGatewayRule, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPatch localVarPostBody interface{} @@ -2878,13 +2722,15 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysRulesPatchExecute(r ApiDat localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "NATGatewaysApiService.DatacentersNatgatewaysRulesPatch") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/natgateways/{natGatewayId}/rules/{natGatewayRuleId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"natGatewayId"+"}", _neturl.PathEscape(parameterToString(r.natGatewayId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"natGatewayRuleId"+"}", _neturl.PathEscape(parameterToString(r.natGatewayRuleId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"natGatewayId"+"}", _neturl.PathEscape(parameterValueToString(r.natGatewayId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"natGatewayRuleId"+"}", _neturl.PathEscape(parameterValueToString(r.natGatewayRuleId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -2894,20 +2740,10 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysRulesPatchExecute(r ApiDat } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -2928,13 +2764,13 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysRulesPatchExecute(r ApiDat localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.natGatewayRuleProperties if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -2953,11 +2789,11 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysRulesPatchExecute(r ApiDat localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersNatgatewaysRulesPatch", } @@ -2973,28 +2809,26 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysRulesPatchExecute(r ApiDat } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -3029,7 +2863,7 @@ func (r ApiDatacentersNatgatewaysRulesPostRequest) XContractNumber(xContractNumb return r } -func (r ApiDatacentersNatgatewaysRulesPostRequest) Execute() (NatGatewayRule, *APIResponse, error) { +func (r ApiDatacentersNatgatewaysRulesPostRequest) Execute() (NatGatewayRule, *shared.APIResponse, error) { return r.ApiService.DatacentersNatgatewaysRulesPostExecute(r) } @@ -3054,7 +2888,7 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysRulesPost(ctx _context.Con * Execute executes the request * @return NatGatewayRule */ -func (a *NATGatewaysApiService) DatacentersNatgatewaysRulesPostExecute(r ApiDatacentersNatgatewaysRulesPostRequest) (NatGatewayRule, *APIResponse, error) { +func (a *NATGatewaysApiService) DatacentersNatgatewaysRulesPostExecute(r ApiDatacentersNatgatewaysRulesPostRequest) (NatGatewayRule, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -3066,12 +2900,14 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysRulesPostExecute(r ApiData localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "NATGatewaysApiService.DatacentersNatgatewaysRulesPost") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/natgateways/{natGatewayId}/rules" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"natGatewayId"+"}", _neturl.PathEscape(parameterToString(r.natGatewayId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"natGatewayId"+"}", _neturl.PathEscape(parameterValueToString(r.natGatewayId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -3081,20 +2917,10 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysRulesPostExecute(r ApiData } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -3115,13 +2941,13 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysRulesPostExecute(r ApiData localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.natGatewayRule if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -3140,11 +2966,11 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysRulesPostExecute(r ApiData localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersNatgatewaysRulesPost", } @@ -3160,28 +2986,26 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysRulesPostExecute(r ApiData } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -3217,7 +3041,7 @@ func (r ApiDatacentersNatgatewaysRulesPutRequest) XContractNumber(xContractNumbe return r } -func (r ApiDatacentersNatgatewaysRulesPutRequest) Execute() (NatGatewayRule, *APIResponse, error) { +func (r ApiDatacentersNatgatewaysRulesPutRequest) Execute() (NatGatewayRule, *shared.APIResponse, error) { return r.ApiService.DatacentersNatgatewaysRulesPutExecute(r) } @@ -3244,7 +3068,7 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysRulesPut(ctx _context.Cont * Execute executes the request * @return NatGatewayRule */ -func (a *NATGatewaysApiService) DatacentersNatgatewaysRulesPutExecute(r ApiDatacentersNatgatewaysRulesPutRequest) (NatGatewayRule, *APIResponse, error) { +func (a *NATGatewaysApiService) DatacentersNatgatewaysRulesPutExecute(r ApiDatacentersNatgatewaysRulesPutRequest) (NatGatewayRule, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPut localVarPostBody interface{} @@ -3256,13 +3080,15 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysRulesPutExecute(r ApiDatac localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "NATGatewaysApiService.DatacentersNatgatewaysRulesPut") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/natgateways/{natGatewayId}/rules/{natGatewayRuleId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"natGatewayId"+"}", _neturl.PathEscape(parameterToString(r.natGatewayId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"natGatewayRuleId"+"}", _neturl.PathEscape(parameterToString(r.natGatewayRuleId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"natGatewayId"+"}", _neturl.PathEscape(parameterValueToString(r.natGatewayId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"natGatewayRuleId"+"}", _neturl.PathEscape(parameterValueToString(r.natGatewayRuleId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -3272,20 +3098,10 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysRulesPutExecute(r ApiDatac } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -3306,13 +3122,13 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysRulesPutExecute(r ApiDatac localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.natGatewayRule if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -3331,11 +3147,11 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysRulesPutExecute(r ApiDatac localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersNatgatewaysRulesPut", } @@ -3351,28 +3167,26 @@ func (a *NATGatewaysApiService) DatacentersNatgatewaysRulesPutExecute(r ApiDatac } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/api_network_interfaces.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/api_network_interfaces.go similarity index 77% rename from vendor/github.com/ionos-cloud/sdk-go/v6/api_network_interfaces.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/api_network_interfaces.go index a5666e4a1..cedfe55a7 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/api_network_interfaces.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/api_network_interfaces.go @@ -13,6 +13,7 @@ package ionoscloud import ( _context "context" "fmt" + "github.com/ionos-cloud/sdk-go-bundle/shared" "io" _nethttp "net/http" _neturl "net/url" @@ -51,7 +52,7 @@ func (r ApiDatacentersServersNicsDeleteRequest) XContractNumber(xContractNumber return r } -func (r ApiDatacentersServersNicsDeleteRequest) Execute() (*APIResponse, error) { +func (r ApiDatacentersServersNicsDeleteRequest) Execute() (*shared.APIResponse, error) { return r.ApiService.DatacentersServersNicsDeleteExecute(r) } @@ -77,7 +78,7 @@ func (a *NetworkInterfacesApiService) DatacentersServersNicsDelete(ctx _context. /* * Execute executes the request */ -func (a *NetworkInterfacesApiService) DatacentersServersNicsDeleteExecute(r ApiDatacentersServersNicsDeleteRequest) (*APIResponse, error) { +func (a *NetworkInterfacesApiService) DatacentersServersNicsDeleteExecute(r ApiDatacentersServersNicsDeleteRequest) (*shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodDelete localVarPostBody interface{} @@ -88,33 +89,25 @@ func (a *NetworkInterfacesApiService) DatacentersServersNicsDeleteExecute(r ApiD localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "NetworkInterfacesApiService.DatacentersServersNicsDelete") if err != nil { - return nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/servers/{serverId}/nics/{nicId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterToString(r.serverId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"nicId"+"}", _neturl.PathEscape(parameterToString(r.nicId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterValueToString(r.serverId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nicId"+"}", _neturl.PathEscape(parameterValueToString(r.nicId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -135,11 +128,11 @@ func (a *NetworkInterfacesApiService) DatacentersServersNicsDeleteExecute(r ApiD localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -158,11 +151,11 @@ func (a *NetworkInterfacesApiService) DatacentersServersNicsDeleteExecute(r ApiD localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersServersNicsDelete", } @@ -178,18 +171,17 @@ func (a *NetworkInterfacesApiService) DatacentersServersNicsDeleteExecute(r ApiD } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarAPIResponse, newErr } @@ -220,7 +212,7 @@ func (r ApiDatacentersServersNicsFindByIdRequest) XContractNumber(xContractNumbe return r } -func (r ApiDatacentersServersNicsFindByIdRequest) Execute() (Nic, *APIResponse, error) { +func (r ApiDatacentersServersNicsFindByIdRequest) Execute() (Nic, *shared.APIResponse, error) { return r.ApiService.DatacentersServersNicsFindByIdExecute(r) } @@ -247,7 +239,7 @@ func (a *NetworkInterfacesApiService) DatacentersServersNicsFindById(ctx _contex * Execute executes the request * @return Nic */ -func (a *NetworkInterfacesApiService) DatacentersServersNicsFindByIdExecute(r ApiDatacentersServersNicsFindByIdRequest) (Nic, *APIResponse, error) { +func (a *NetworkInterfacesApiService) DatacentersServersNicsFindByIdExecute(r ApiDatacentersServersNicsFindByIdRequest) (Nic, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -259,33 +251,25 @@ func (a *NetworkInterfacesApiService) DatacentersServersNicsFindByIdExecute(r Ap localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "NetworkInterfacesApiService.DatacentersServersNicsFindById") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/servers/{serverId}/nics/{nicId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterToString(r.serverId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"nicId"+"}", _neturl.PathEscape(parameterToString(r.nicId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterValueToString(r.serverId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nicId"+"}", _neturl.PathEscape(parameterValueToString(r.nicId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -306,11 +290,11 @@ func (a *NetworkInterfacesApiService) DatacentersServersNicsFindByIdExecute(r Ap localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -329,11 +313,11 @@ func (a *NetworkInterfacesApiService) DatacentersServersNicsFindByIdExecute(r Ap localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersServersNicsFindById", } @@ -349,28 +333,26 @@ func (a *NetworkInterfacesApiService) DatacentersServersNicsFindByIdExecute(r Ap } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -415,7 +397,7 @@ func (r ApiDatacentersServersNicsGetRequest) Limit(limit int32) ApiDatacentersSe // Filters query parameters limit results to those containing a matching value for a specific property. func (r ApiDatacentersServersNicsGetRequest) Filter(key string, value string) ApiDatacentersServersNicsGetRequest { - filterKey := fmt.Sprintf(FilterQueryParam, key) + filterKey := fmt.Sprintf("filter.%s", key) r.filters[filterKey] = append(r.filters[filterKey], value) return r } @@ -432,7 +414,7 @@ func (r ApiDatacentersServersNicsGetRequest) MaxResults(maxResults int32) ApiDat return r } -func (r ApiDatacentersServersNicsGetRequest) Execute() (Nics, *APIResponse, error) { +func (r ApiDatacentersServersNicsGetRequest) Execute() (Nics, *shared.APIResponse, error) { return r.ApiService.DatacentersServersNicsGetExecute(r) } @@ -458,7 +440,7 @@ func (a *NetworkInterfacesApiService) DatacentersServersNicsGet(ctx _context.Con * Execute executes the request * @return Nics */ -func (a *NetworkInterfacesApiService) DatacentersServersNicsGetExecute(r ApiDatacentersServersNicsGetRequest) (Nics, *APIResponse, error) { +func (a *NetworkInterfacesApiService) DatacentersServersNicsGetExecute(r ApiDatacentersServersNicsGetRequest) (Nics, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -470,48 +452,30 @@ func (a *NetworkInterfacesApiService) DatacentersServersNicsGetExecute(r ApiData localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "NetworkInterfacesApiService.DatacentersServersNicsGet") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/servers/{serverId}/nics" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterToString(r.serverId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterValueToString(r.serverId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } if r.offset != nil { - localVarQueryParams.Add("offset", parameterToString(*r.offset, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("offset") - if defaultQueryParam == "" { - localVarQueryParams.Add("offset", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "offset", r.offset, "") } if r.limit != nil { - localVarQueryParams.Add("limit", parameterToString(*r.limit, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("limit") - if defaultQueryParam == "" { - localVarQueryParams.Add("limit", parameterToString(1000, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "") } if r.orderBy != nil { localVarQueryParams.Add("orderBy", parameterToString(*r.orderBy, "")) @@ -545,11 +509,11 @@ func (a *NetworkInterfacesApiService) DatacentersServersNicsGetExecute(r ApiData localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -568,11 +532,11 @@ func (a *NetworkInterfacesApiService) DatacentersServersNicsGetExecute(r ApiData localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersServersNicsGet", } @@ -588,28 +552,26 @@ func (a *NetworkInterfacesApiService) DatacentersServersNicsGetExecute(r ApiData } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -645,7 +607,7 @@ func (r ApiDatacentersServersNicsPatchRequest) XContractNumber(xContractNumber i return r } -func (r ApiDatacentersServersNicsPatchRequest) Execute() (Nic, *APIResponse, error) { +func (r ApiDatacentersServersNicsPatchRequest) Execute() (Nic, *shared.APIResponse, error) { return r.ApiService.DatacentersServersNicsPatchExecute(r) } @@ -672,7 +634,7 @@ func (a *NetworkInterfacesApiService) DatacentersServersNicsPatch(ctx _context.C * Execute executes the request * @return Nic */ -func (a *NetworkInterfacesApiService) DatacentersServersNicsPatchExecute(r ApiDatacentersServersNicsPatchRequest) (Nic, *APIResponse, error) { +func (a *NetworkInterfacesApiService) DatacentersServersNicsPatchExecute(r ApiDatacentersServersNicsPatchRequest) (Nic, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPatch localVarPostBody interface{} @@ -684,13 +646,15 @@ func (a *NetworkInterfacesApiService) DatacentersServersNicsPatchExecute(r ApiDa localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "NetworkInterfacesApiService.DatacentersServersNicsPatch") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/servers/{serverId}/nics/{nicId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterToString(r.serverId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"nicId"+"}", _neturl.PathEscape(parameterToString(r.nicId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterValueToString(r.serverId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nicId"+"}", _neturl.PathEscape(parameterValueToString(r.nicId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -700,20 +664,10 @@ func (a *NetworkInterfacesApiService) DatacentersServersNicsPatchExecute(r ApiDa } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -734,13 +688,13 @@ func (a *NetworkInterfacesApiService) DatacentersServersNicsPatchExecute(r ApiDa localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.nic if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -759,11 +713,11 @@ func (a *NetworkInterfacesApiService) DatacentersServersNicsPatchExecute(r ApiDa localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersServersNicsPatch", } @@ -779,28 +733,26 @@ func (a *NetworkInterfacesApiService) DatacentersServersNicsPatchExecute(r ApiDa } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -835,7 +787,7 @@ func (r ApiDatacentersServersNicsPostRequest) XContractNumber(xContractNumber in return r } -func (r ApiDatacentersServersNicsPostRequest) Execute() (Nic, *APIResponse, error) { +func (r ApiDatacentersServersNicsPostRequest) Execute() (Nic, *shared.APIResponse, error) { return r.ApiService.DatacentersServersNicsPostExecute(r) } @@ -860,7 +812,7 @@ func (a *NetworkInterfacesApiService) DatacentersServersNicsPost(ctx _context.Co * Execute executes the request * @return Nic */ -func (a *NetworkInterfacesApiService) DatacentersServersNicsPostExecute(r ApiDatacentersServersNicsPostRequest) (Nic, *APIResponse, error) { +func (a *NetworkInterfacesApiService) DatacentersServersNicsPostExecute(r ApiDatacentersServersNicsPostRequest) (Nic, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -872,12 +824,14 @@ func (a *NetworkInterfacesApiService) DatacentersServersNicsPostExecute(r ApiDat localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "NetworkInterfacesApiService.DatacentersServersNicsPost") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/servers/{serverId}/nics" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterToString(r.serverId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterValueToString(r.serverId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -887,20 +841,10 @@ func (a *NetworkInterfacesApiService) DatacentersServersNicsPostExecute(r ApiDat } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -921,13 +865,13 @@ func (a *NetworkInterfacesApiService) DatacentersServersNicsPostExecute(r ApiDat localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.nic if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -946,11 +890,11 @@ func (a *NetworkInterfacesApiService) DatacentersServersNicsPostExecute(r ApiDat localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersServersNicsPost", } @@ -966,28 +910,26 @@ func (a *NetworkInterfacesApiService) DatacentersServersNicsPostExecute(r ApiDat } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -1023,7 +965,7 @@ func (r ApiDatacentersServersNicsPutRequest) XContractNumber(xContractNumber int return r } -func (r ApiDatacentersServersNicsPutRequest) Execute() (Nic, *APIResponse, error) { +func (r ApiDatacentersServersNicsPutRequest) Execute() (Nic, *shared.APIResponse, error) { return r.ApiService.DatacentersServersNicsPutExecute(r) } @@ -1050,7 +992,7 @@ func (a *NetworkInterfacesApiService) DatacentersServersNicsPut(ctx _context.Con * Execute executes the request * @return Nic */ -func (a *NetworkInterfacesApiService) DatacentersServersNicsPutExecute(r ApiDatacentersServersNicsPutRequest) (Nic, *APIResponse, error) { +func (a *NetworkInterfacesApiService) DatacentersServersNicsPutExecute(r ApiDatacentersServersNicsPutRequest) (Nic, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPut localVarPostBody interface{} @@ -1062,13 +1004,15 @@ func (a *NetworkInterfacesApiService) DatacentersServersNicsPutExecute(r ApiData localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "NetworkInterfacesApiService.DatacentersServersNicsPut") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/servers/{serverId}/nics/{nicId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterToString(r.serverId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"nicId"+"}", _neturl.PathEscape(parameterToString(r.nicId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterValueToString(r.serverId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nicId"+"}", _neturl.PathEscape(parameterValueToString(r.nicId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -1078,20 +1022,10 @@ func (a *NetworkInterfacesApiService) DatacentersServersNicsPutExecute(r ApiData } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -1112,13 +1046,13 @@ func (a *NetworkInterfacesApiService) DatacentersServersNicsPutExecute(r ApiData localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.nic if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -1137,11 +1071,11 @@ func (a *NetworkInterfacesApiService) DatacentersServersNicsPutExecute(r ApiData localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersServersNicsPut", } @@ -1157,28 +1091,26 @@ func (a *NetworkInterfacesApiService) DatacentersServersNicsPutExecute(r ApiData } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/api_network_load_balancers.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/api_network_load_balancers.go similarity index 79% rename from vendor/github.com/ionos-cloud/sdk-go/v6/api_network_load_balancers.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/api_network_load_balancers.go index c010bbd0c..585865785 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/api_network_load_balancers.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/api_network_load_balancers.go @@ -13,6 +13,7 @@ package ionoscloud import ( _context "context" "fmt" + "github.com/ionos-cloud/sdk-go-bundle/shared" "io" _nethttp "net/http" _neturl "net/url" @@ -50,7 +51,7 @@ func (r ApiDatacentersNetworkloadbalancersDeleteRequest) XContractNumber(xContra return r } -func (r ApiDatacentersNetworkloadbalancersDeleteRequest) Execute() (*APIResponse, error) { +func (r ApiDatacentersNetworkloadbalancersDeleteRequest) Execute() (*shared.APIResponse, error) { return r.ApiService.DatacentersNetworkloadbalancersDeleteExecute(r) } @@ -74,7 +75,7 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersDelete(c /* * Execute executes the request */ -func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersDeleteExecute(r ApiDatacentersNetworkloadbalancersDeleteRequest) (*APIResponse, error) { +func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersDeleteExecute(r ApiDatacentersNetworkloadbalancersDeleteRequest) (*shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodDelete localVarPostBody interface{} @@ -85,32 +86,24 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersDeleteEx localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "NetworkLoadBalancersApiService.DatacentersNetworkloadbalancersDelete") if err != nil { - return nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/networkloadbalancers/{networkLoadBalancerId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"networkLoadBalancerId"+"}", _neturl.PathEscape(parameterToString(r.networkLoadBalancerId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"networkLoadBalancerId"+"}", _neturl.PathEscape(parameterValueToString(r.networkLoadBalancerId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -131,11 +124,11 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersDeleteEx localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -154,11 +147,11 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersDeleteEx localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersNetworkloadbalancersDelete", } @@ -174,18 +167,17 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersDeleteEx } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarAPIResponse, newErr } @@ -215,7 +207,7 @@ func (r ApiDatacentersNetworkloadbalancersFindByNetworkLoadBalancerIdRequest) XC return r } -func (r ApiDatacentersNetworkloadbalancersFindByNetworkLoadBalancerIdRequest) Execute() (NetworkLoadBalancer, *APIResponse, error) { +func (r ApiDatacentersNetworkloadbalancersFindByNetworkLoadBalancerIdRequest) Execute() (NetworkLoadBalancer, *shared.APIResponse, error) { return r.ApiService.DatacentersNetworkloadbalancersFindByNetworkLoadBalancerIdExecute(r) } @@ -240,7 +232,7 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersFindByNe * Execute executes the request * @return NetworkLoadBalancer */ -func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersFindByNetworkLoadBalancerIdExecute(r ApiDatacentersNetworkloadbalancersFindByNetworkLoadBalancerIdRequest) (NetworkLoadBalancer, *APIResponse, error) { +func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersFindByNetworkLoadBalancerIdExecute(r ApiDatacentersNetworkloadbalancersFindByNetworkLoadBalancerIdRequest) (NetworkLoadBalancer, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -252,32 +244,24 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersFindByNe localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "NetworkLoadBalancersApiService.DatacentersNetworkloadbalancersFindByNetworkLoadBalancerId") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/networkloadbalancers/{networkLoadBalancerId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"networkLoadBalancerId"+"}", _neturl.PathEscape(parameterToString(r.networkLoadBalancerId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"networkLoadBalancerId"+"}", _neturl.PathEscape(parameterValueToString(r.networkLoadBalancerId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -298,11 +282,11 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersFindByNe localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -321,11 +305,11 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersFindByNe localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersNetworkloadbalancersFindByNetworkLoadBalancerId", } @@ -341,28 +325,26 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersFindByNe } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -393,7 +375,7 @@ func (r ApiDatacentersNetworkloadbalancersFlowlogsDeleteRequest) XContractNumber return r } -func (r ApiDatacentersNetworkloadbalancersFlowlogsDeleteRequest) Execute() (*APIResponse, error) { +func (r ApiDatacentersNetworkloadbalancersFlowlogsDeleteRequest) Execute() (*shared.APIResponse, error) { return r.ApiService.DatacentersNetworkloadbalancersFlowlogsDeleteExecute(r) } @@ -419,7 +401,7 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersFlowlogs /* * Execute executes the request */ -func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersFlowlogsDeleteExecute(r ApiDatacentersNetworkloadbalancersFlowlogsDeleteRequest) (*APIResponse, error) { +func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersFlowlogsDeleteExecute(r ApiDatacentersNetworkloadbalancersFlowlogsDeleteRequest) (*shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodDelete localVarPostBody interface{} @@ -430,33 +412,25 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersFlowlogs localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "NetworkLoadBalancersApiService.DatacentersNetworkloadbalancersFlowlogsDelete") if err != nil { - return nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/networkloadbalancers/{networkLoadBalancerId}/flowlogs/{flowLogId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"networkLoadBalancerId"+"}", _neturl.PathEscape(parameterToString(r.networkLoadBalancerId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"flowLogId"+"}", _neturl.PathEscape(parameterToString(r.flowLogId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"networkLoadBalancerId"+"}", _neturl.PathEscape(parameterValueToString(r.networkLoadBalancerId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"flowLogId"+"}", _neturl.PathEscape(parameterValueToString(r.flowLogId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -477,11 +451,11 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersFlowlogs localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -500,11 +474,11 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersFlowlogs localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersNetworkloadbalancersFlowlogsDelete", } @@ -520,18 +494,17 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersFlowlogs } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarAPIResponse, newErr } @@ -562,7 +535,7 @@ func (r ApiDatacentersNetworkloadbalancersFlowlogsFindByFlowLogIdRequest) XContr return r } -func (r ApiDatacentersNetworkloadbalancersFlowlogsFindByFlowLogIdRequest) Execute() (FlowLog, *APIResponse, error) { +func (r ApiDatacentersNetworkloadbalancersFlowlogsFindByFlowLogIdRequest) Execute() (FlowLog, *shared.APIResponse, error) { return r.ApiService.DatacentersNetworkloadbalancersFlowlogsFindByFlowLogIdExecute(r) } @@ -589,7 +562,7 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersFlowlogs * Execute executes the request * @return FlowLog */ -func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersFlowlogsFindByFlowLogIdExecute(r ApiDatacentersNetworkloadbalancersFlowlogsFindByFlowLogIdRequest) (FlowLog, *APIResponse, error) { +func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersFlowlogsFindByFlowLogIdExecute(r ApiDatacentersNetworkloadbalancersFlowlogsFindByFlowLogIdRequest) (FlowLog, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -601,33 +574,25 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersFlowlogs localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "NetworkLoadBalancersApiService.DatacentersNetworkloadbalancersFlowlogsFindByFlowLogId") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/networkloadbalancers/{networkLoadBalancerId}/flowlogs/{flowLogId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"networkLoadBalancerId"+"}", _neturl.PathEscape(parameterToString(r.networkLoadBalancerId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"flowLogId"+"}", _neturl.PathEscape(parameterToString(r.flowLogId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"networkLoadBalancerId"+"}", _neturl.PathEscape(parameterValueToString(r.networkLoadBalancerId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"flowLogId"+"}", _neturl.PathEscape(parameterValueToString(r.flowLogId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -648,11 +613,11 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersFlowlogs localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -671,11 +636,11 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersFlowlogs localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersNetworkloadbalancersFlowlogsFindByFlowLogId", } @@ -691,28 +656,26 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersFlowlogs } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -747,7 +710,7 @@ func (r ApiDatacentersNetworkloadbalancersFlowlogsGetRequest) XContractNumber(xC // Filters query parameters limit results to those containing a matching value for a specific property. func (r ApiDatacentersNetworkloadbalancersFlowlogsGetRequest) Filter(key string, value string) ApiDatacentersNetworkloadbalancersFlowlogsGetRequest { - filterKey := fmt.Sprintf(FilterQueryParam, key) + filterKey := fmt.Sprintf("filter.%s", key) r.filters[filterKey] = append(r.filters[filterKey], value) return r } @@ -764,7 +727,7 @@ func (r ApiDatacentersNetworkloadbalancersFlowlogsGetRequest) MaxResults(maxResu return r } -func (r ApiDatacentersNetworkloadbalancersFlowlogsGetRequest) Execute() (FlowLogs, *APIResponse, error) { +func (r ApiDatacentersNetworkloadbalancersFlowlogsGetRequest) Execute() (FlowLogs, *shared.APIResponse, error) { return r.ApiService.DatacentersNetworkloadbalancersFlowlogsGetExecute(r) } @@ -790,7 +753,7 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersFlowlogs * Execute executes the request * @return FlowLogs */ -func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersFlowlogsGetExecute(r ApiDatacentersNetworkloadbalancersFlowlogsGetRequest) (FlowLogs, *APIResponse, error) { +func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersFlowlogsGetExecute(r ApiDatacentersNetworkloadbalancersFlowlogsGetRequest) (FlowLogs, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -802,32 +765,24 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersFlowlogs localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "NetworkLoadBalancersApiService.DatacentersNetworkloadbalancersFlowlogsGet") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/networkloadbalancers/{networkLoadBalancerId}/flowlogs" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"networkLoadBalancerId"+"}", _neturl.PathEscape(parameterToString(r.networkLoadBalancerId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"networkLoadBalancerId"+"}", _neturl.PathEscape(parameterValueToString(r.networkLoadBalancerId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } if r.orderBy != nil { localVarQueryParams.Add("orderBy", parameterToString(*r.orderBy, "")) @@ -861,11 +816,11 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersFlowlogs localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -884,11 +839,11 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersFlowlogs localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersNetworkloadbalancersFlowlogsGet", } @@ -904,28 +859,26 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersFlowlogs } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -961,7 +914,7 @@ func (r ApiDatacentersNetworkloadbalancersFlowlogsPatchRequest) XContractNumber( return r } -func (r ApiDatacentersNetworkloadbalancersFlowlogsPatchRequest) Execute() (FlowLog, *APIResponse, error) { +func (r ApiDatacentersNetworkloadbalancersFlowlogsPatchRequest) Execute() (FlowLog, *shared.APIResponse, error) { return r.ApiService.DatacentersNetworkloadbalancersFlowlogsPatchExecute(r) } @@ -988,7 +941,7 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersFlowlogs * Execute executes the request * @return FlowLog */ -func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersFlowlogsPatchExecute(r ApiDatacentersNetworkloadbalancersFlowlogsPatchRequest) (FlowLog, *APIResponse, error) { +func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersFlowlogsPatchExecute(r ApiDatacentersNetworkloadbalancersFlowlogsPatchRequest) (FlowLog, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPatch localVarPostBody interface{} @@ -1000,13 +953,15 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersFlowlogs localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "NetworkLoadBalancersApiService.DatacentersNetworkloadbalancersFlowlogsPatch") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/networkloadbalancers/{networkLoadBalancerId}/flowlogs/{flowLogId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"networkLoadBalancerId"+"}", _neturl.PathEscape(parameterToString(r.networkLoadBalancerId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"flowLogId"+"}", _neturl.PathEscape(parameterToString(r.flowLogId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"networkLoadBalancerId"+"}", _neturl.PathEscape(parameterValueToString(r.networkLoadBalancerId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"flowLogId"+"}", _neturl.PathEscape(parameterValueToString(r.flowLogId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -1016,20 +971,10 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersFlowlogs } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -1050,13 +995,13 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersFlowlogs localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.networkLoadBalancerFlowLogProperties if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -1075,11 +1020,11 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersFlowlogs localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersNetworkloadbalancersFlowlogsPatch", } @@ -1095,28 +1040,26 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersFlowlogs } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -1151,7 +1094,7 @@ func (r ApiDatacentersNetworkloadbalancersFlowlogsPostRequest) XContractNumber(x return r } -func (r ApiDatacentersNetworkloadbalancersFlowlogsPostRequest) Execute() (FlowLog, *APIResponse, error) { +func (r ApiDatacentersNetworkloadbalancersFlowlogsPostRequest) Execute() (FlowLog, *shared.APIResponse, error) { return r.ApiService.DatacentersNetworkloadbalancersFlowlogsPostExecute(r) } @@ -1176,7 +1119,7 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersFlowlogs * Execute executes the request * @return FlowLog */ -func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersFlowlogsPostExecute(r ApiDatacentersNetworkloadbalancersFlowlogsPostRequest) (FlowLog, *APIResponse, error) { +func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersFlowlogsPostExecute(r ApiDatacentersNetworkloadbalancersFlowlogsPostRequest) (FlowLog, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -1188,12 +1131,14 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersFlowlogs localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "NetworkLoadBalancersApiService.DatacentersNetworkloadbalancersFlowlogsPost") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/networkloadbalancers/{networkLoadBalancerId}/flowlogs" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"networkLoadBalancerId"+"}", _neturl.PathEscape(parameterToString(r.networkLoadBalancerId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"networkLoadBalancerId"+"}", _neturl.PathEscape(parameterValueToString(r.networkLoadBalancerId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -1203,20 +1148,10 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersFlowlogs } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -1237,13 +1172,13 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersFlowlogs localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.networkLoadBalancerFlowLog if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -1262,11 +1197,11 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersFlowlogs localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersNetworkloadbalancersFlowlogsPost", } @@ -1282,28 +1217,26 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersFlowlogs } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -1339,7 +1272,7 @@ func (r ApiDatacentersNetworkloadbalancersFlowlogsPutRequest) XContractNumber(xC return r } -func (r ApiDatacentersNetworkloadbalancersFlowlogsPutRequest) Execute() (FlowLog, *APIResponse, error) { +func (r ApiDatacentersNetworkloadbalancersFlowlogsPutRequest) Execute() (FlowLog, *shared.APIResponse, error) { return r.ApiService.DatacentersNetworkloadbalancersFlowlogsPutExecute(r) } @@ -1366,7 +1299,7 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersFlowlogs * Execute executes the request * @return FlowLog */ -func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersFlowlogsPutExecute(r ApiDatacentersNetworkloadbalancersFlowlogsPutRequest) (FlowLog, *APIResponse, error) { +func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersFlowlogsPutExecute(r ApiDatacentersNetworkloadbalancersFlowlogsPutRequest) (FlowLog, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPut localVarPostBody interface{} @@ -1378,13 +1311,15 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersFlowlogs localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "NetworkLoadBalancersApiService.DatacentersNetworkloadbalancersFlowlogsPut") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/networkloadbalancers/{networkLoadBalancerId}/flowlogs/{flowLogId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"networkLoadBalancerId"+"}", _neturl.PathEscape(parameterToString(r.networkLoadBalancerId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"flowLogId"+"}", _neturl.PathEscape(parameterToString(r.flowLogId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"networkLoadBalancerId"+"}", _neturl.PathEscape(parameterValueToString(r.networkLoadBalancerId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"flowLogId"+"}", _neturl.PathEscape(parameterValueToString(r.flowLogId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -1394,20 +1329,10 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersFlowlogs } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -1428,13 +1353,13 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersFlowlogs localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.networkLoadBalancerFlowLog if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -1453,11 +1378,11 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersFlowlogs localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersNetworkloadbalancersFlowlogsPut", } @@ -1473,28 +1398,26 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersFlowlogs } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -1525,7 +1448,7 @@ func (r ApiDatacentersNetworkloadbalancersForwardingrulesDeleteRequest) XContrac return r } -func (r ApiDatacentersNetworkloadbalancersForwardingrulesDeleteRequest) Execute() (*APIResponse, error) { +func (r ApiDatacentersNetworkloadbalancersForwardingrulesDeleteRequest) Execute() (*shared.APIResponse, error) { return r.ApiService.DatacentersNetworkloadbalancersForwardingrulesDeleteExecute(r) } @@ -1551,7 +1474,7 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersForwardi /* * Execute executes the request */ -func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersForwardingrulesDeleteExecute(r ApiDatacentersNetworkloadbalancersForwardingrulesDeleteRequest) (*APIResponse, error) { +func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersForwardingrulesDeleteExecute(r ApiDatacentersNetworkloadbalancersForwardingrulesDeleteRequest) (*shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodDelete localVarPostBody interface{} @@ -1562,33 +1485,25 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersForwardi localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "NetworkLoadBalancersApiService.DatacentersNetworkloadbalancersForwardingrulesDelete") if err != nil { - return nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/networkloadbalancers/{networkLoadBalancerId}/forwardingrules/{forwardingRuleId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"networkLoadBalancerId"+"}", _neturl.PathEscape(parameterToString(r.networkLoadBalancerId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"forwardingRuleId"+"}", _neturl.PathEscape(parameterToString(r.forwardingRuleId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"networkLoadBalancerId"+"}", _neturl.PathEscape(parameterValueToString(r.networkLoadBalancerId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"forwardingRuleId"+"}", _neturl.PathEscape(parameterValueToString(r.forwardingRuleId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -1609,11 +1524,11 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersForwardi localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -1632,11 +1547,11 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersForwardi localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersNetworkloadbalancersForwardingrulesDelete", } @@ -1652,18 +1567,17 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersForwardi } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarAPIResponse, newErr } @@ -1694,7 +1608,7 @@ func (r ApiDatacentersNetworkloadbalancersForwardingrulesFindByForwardingRuleIdR return r } -func (r ApiDatacentersNetworkloadbalancersForwardingrulesFindByForwardingRuleIdRequest) Execute() (NetworkLoadBalancerForwardingRule, *APIResponse, error) { +func (r ApiDatacentersNetworkloadbalancersForwardingrulesFindByForwardingRuleIdRequest) Execute() (NetworkLoadBalancerForwardingRule, *shared.APIResponse, error) { return r.ApiService.DatacentersNetworkloadbalancersForwardingrulesFindByForwardingRuleIdExecute(r) } @@ -1721,7 +1635,7 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersForwardi * Execute executes the request * @return NetworkLoadBalancerForwardingRule */ -func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersForwardingrulesFindByForwardingRuleIdExecute(r ApiDatacentersNetworkloadbalancersForwardingrulesFindByForwardingRuleIdRequest) (NetworkLoadBalancerForwardingRule, *APIResponse, error) { +func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersForwardingrulesFindByForwardingRuleIdExecute(r ApiDatacentersNetworkloadbalancersForwardingrulesFindByForwardingRuleIdRequest) (NetworkLoadBalancerForwardingRule, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -1733,33 +1647,25 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersForwardi localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "NetworkLoadBalancersApiService.DatacentersNetworkloadbalancersForwardingrulesFindByForwardingRuleId") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/networkloadbalancers/{networkLoadBalancerId}/forwardingrules/{forwardingRuleId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"networkLoadBalancerId"+"}", _neturl.PathEscape(parameterToString(r.networkLoadBalancerId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"forwardingRuleId"+"}", _neturl.PathEscape(parameterToString(r.forwardingRuleId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"networkLoadBalancerId"+"}", _neturl.PathEscape(parameterValueToString(r.networkLoadBalancerId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"forwardingRuleId"+"}", _neturl.PathEscape(parameterValueToString(r.forwardingRuleId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -1780,11 +1686,11 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersForwardi localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -1803,11 +1709,11 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersForwardi localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersNetworkloadbalancersForwardingrulesFindByForwardingRuleId", } @@ -1823,28 +1729,26 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersForwardi } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -1879,7 +1783,7 @@ func (r ApiDatacentersNetworkloadbalancersForwardingrulesGetRequest) XContractNu // Filters query parameters limit results to those containing a matching value for a specific property. func (r ApiDatacentersNetworkloadbalancersForwardingrulesGetRequest) Filter(key string, value string) ApiDatacentersNetworkloadbalancersForwardingrulesGetRequest { - filterKey := fmt.Sprintf(FilterQueryParam, key) + filterKey := fmt.Sprintf("filter.%s", key) r.filters[filterKey] = append(r.filters[filterKey], value) return r } @@ -1896,7 +1800,7 @@ func (r ApiDatacentersNetworkloadbalancersForwardingrulesGetRequest) MaxResults( return r } -func (r ApiDatacentersNetworkloadbalancersForwardingrulesGetRequest) Execute() (NetworkLoadBalancerForwardingRules, *APIResponse, error) { +func (r ApiDatacentersNetworkloadbalancersForwardingrulesGetRequest) Execute() (NetworkLoadBalancerForwardingRules, *shared.APIResponse, error) { return r.ApiService.DatacentersNetworkloadbalancersForwardingrulesGetExecute(r) } @@ -1922,7 +1826,7 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersForwardi * Execute executes the request * @return NetworkLoadBalancerForwardingRules */ -func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersForwardingrulesGetExecute(r ApiDatacentersNetworkloadbalancersForwardingrulesGetRequest) (NetworkLoadBalancerForwardingRules, *APIResponse, error) { +func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersForwardingrulesGetExecute(r ApiDatacentersNetworkloadbalancersForwardingrulesGetRequest) (NetworkLoadBalancerForwardingRules, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -1934,32 +1838,24 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersForwardi localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "NetworkLoadBalancersApiService.DatacentersNetworkloadbalancersForwardingrulesGet") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/networkloadbalancers/{networkLoadBalancerId}/forwardingrules" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"networkLoadBalancerId"+"}", _neturl.PathEscape(parameterToString(r.networkLoadBalancerId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"networkLoadBalancerId"+"}", _neturl.PathEscape(parameterValueToString(r.networkLoadBalancerId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } if r.orderBy != nil { localVarQueryParams.Add("orderBy", parameterToString(*r.orderBy, "")) @@ -1993,11 +1889,11 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersForwardi localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -2016,11 +1912,11 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersForwardi localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersNetworkloadbalancersForwardingrulesGet", } @@ -2036,28 +1932,26 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersForwardi } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -2093,7 +1987,7 @@ func (r ApiDatacentersNetworkloadbalancersForwardingrulesPatchRequest) XContract return r } -func (r ApiDatacentersNetworkloadbalancersForwardingrulesPatchRequest) Execute() (NetworkLoadBalancerForwardingRule, *APIResponse, error) { +func (r ApiDatacentersNetworkloadbalancersForwardingrulesPatchRequest) Execute() (NetworkLoadBalancerForwardingRule, *shared.APIResponse, error) { return r.ApiService.DatacentersNetworkloadbalancersForwardingrulesPatchExecute(r) } @@ -2120,7 +2014,7 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersForwardi * Execute executes the request * @return NetworkLoadBalancerForwardingRule */ -func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersForwardingrulesPatchExecute(r ApiDatacentersNetworkloadbalancersForwardingrulesPatchRequest) (NetworkLoadBalancerForwardingRule, *APIResponse, error) { +func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersForwardingrulesPatchExecute(r ApiDatacentersNetworkloadbalancersForwardingrulesPatchRequest) (NetworkLoadBalancerForwardingRule, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPatch localVarPostBody interface{} @@ -2132,13 +2026,15 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersForwardi localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "NetworkLoadBalancersApiService.DatacentersNetworkloadbalancersForwardingrulesPatch") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/networkloadbalancers/{networkLoadBalancerId}/forwardingrules/{forwardingRuleId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"networkLoadBalancerId"+"}", _neturl.PathEscape(parameterToString(r.networkLoadBalancerId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"forwardingRuleId"+"}", _neturl.PathEscape(parameterToString(r.forwardingRuleId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"networkLoadBalancerId"+"}", _neturl.PathEscape(parameterValueToString(r.networkLoadBalancerId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"forwardingRuleId"+"}", _neturl.PathEscape(parameterValueToString(r.forwardingRuleId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -2148,20 +2044,10 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersForwardi } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -2182,13 +2068,13 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersForwardi localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.networkLoadBalancerForwardingRuleProperties if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -2207,11 +2093,11 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersForwardi localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersNetworkloadbalancersForwardingrulesPatch", } @@ -2227,28 +2113,26 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersForwardi } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -2283,7 +2167,7 @@ func (r ApiDatacentersNetworkloadbalancersForwardingrulesPostRequest) XContractN return r } -func (r ApiDatacentersNetworkloadbalancersForwardingrulesPostRequest) Execute() (NetworkLoadBalancerForwardingRule, *APIResponse, error) { +func (r ApiDatacentersNetworkloadbalancersForwardingrulesPostRequest) Execute() (NetworkLoadBalancerForwardingRule, *shared.APIResponse, error) { return r.ApiService.DatacentersNetworkloadbalancersForwardingrulesPostExecute(r) } @@ -2308,7 +2192,7 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersForwardi * Execute executes the request * @return NetworkLoadBalancerForwardingRule */ -func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersForwardingrulesPostExecute(r ApiDatacentersNetworkloadbalancersForwardingrulesPostRequest) (NetworkLoadBalancerForwardingRule, *APIResponse, error) { +func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersForwardingrulesPostExecute(r ApiDatacentersNetworkloadbalancersForwardingrulesPostRequest) (NetworkLoadBalancerForwardingRule, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -2320,12 +2204,14 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersForwardi localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "NetworkLoadBalancersApiService.DatacentersNetworkloadbalancersForwardingrulesPost") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/networkloadbalancers/{networkLoadBalancerId}/forwardingrules" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"networkLoadBalancerId"+"}", _neturl.PathEscape(parameterToString(r.networkLoadBalancerId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"networkLoadBalancerId"+"}", _neturl.PathEscape(parameterValueToString(r.networkLoadBalancerId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -2335,20 +2221,10 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersForwardi } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -2369,13 +2245,13 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersForwardi localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.networkLoadBalancerForwardingRule if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -2394,11 +2270,11 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersForwardi localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersNetworkloadbalancersForwardingrulesPost", } @@ -2414,28 +2290,26 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersForwardi } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -2471,7 +2345,7 @@ func (r ApiDatacentersNetworkloadbalancersForwardingrulesPutRequest) XContractNu return r } -func (r ApiDatacentersNetworkloadbalancersForwardingrulesPutRequest) Execute() (NetworkLoadBalancerForwardingRule, *APIResponse, error) { +func (r ApiDatacentersNetworkloadbalancersForwardingrulesPutRequest) Execute() (NetworkLoadBalancerForwardingRule, *shared.APIResponse, error) { return r.ApiService.DatacentersNetworkloadbalancersForwardingrulesPutExecute(r) } @@ -2498,7 +2372,7 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersForwardi * Execute executes the request * @return NetworkLoadBalancerForwardingRule */ -func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersForwardingrulesPutExecute(r ApiDatacentersNetworkloadbalancersForwardingrulesPutRequest) (NetworkLoadBalancerForwardingRule, *APIResponse, error) { +func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersForwardingrulesPutExecute(r ApiDatacentersNetworkloadbalancersForwardingrulesPutRequest) (NetworkLoadBalancerForwardingRule, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPut localVarPostBody interface{} @@ -2510,13 +2384,15 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersForwardi localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "NetworkLoadBalancersApiService.DatacentersNetworkloadbalancersForwardingrulesPut") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/networkloadbalancers/{networkLoadBalancerId}/forwardingrules/{forwardingRuleId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"networkLoadBalancerId"+"}", _neturl.PathEscape(parameterToString(r.networkLoadBalancerId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"forwardingRuleId"+"}", _neturl.PathEscape(parameterToString(r.forwardingRuleId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"networkLoadBalancerId"+"}", _neturl.PathEscape(parameterValueToString(r.networkLoadBalancerId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"forwardingRuleId"+"}", _neturl.PathEscape(parameterValueToString(r.forwardingRuleId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -2526,20 +2402,10 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersForwardi } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -2560,13 +2426,13 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersForwardi localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.networkLoadBalancerForwardingRule if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -2585,11 +2451,11 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersForwardi localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersNetworkloadbalancersForwardingrulesPut", } @@ -2605,28 +2471,26 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersForwardi } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -2670,7 +2534,7 @@ func (r ApiDatacentersNetworkloadbalancersGetRequest) Limit(limit int32) ApiData // Filters query parameters limit results to those containing a matching value for a specific property. func (r ApiDatacentersNetworkloadbalancersGetRequest) Filter(key string, value string) ApiDatacentersNetworkloadbalancersGetRequest { - filterKey := fmt.Sprintf(FilterQueryParam, key) + filterKey := fmt.Sprintf("filter.%s", key) r.filters[filterKey] = append(r.filters[filterKey], value) return r } @@ -2687,7 +2551,7 @@ func (r ApiDatacentersNetworkloadbalancersGetRequest) MaxResults(maxResults int3 return r } -func (r ApiDatacentersNetworkloadbalancersGetRequest) Execute() (NetworkLoadBalancers, *APIResponse, error) { +func (r ApiDatacentersNetworkloadbalancersGetRequest) Execute() (NetworkLoadBalancers, *shared.APIResponse, error) { return r.ApiService.DatacentersNetworkloadbalancersGetExecute(r) } @@ -2711,7 +2575,7 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersGet(ctx * Execute executes the request * @return NetworkLoadBalancers */ -func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersGetExecute(r ApiDatacentersNetworkloadbalancersGetRequest) (NetworkLoadBalancers, *APIResponse, error) { +func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersGetExecute(r ApiDatacentersNetworkloadbalancersGetRequest) (NetworkLoadBalancers, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -2723,47 +2587,29 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersGetExecu localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "NetworkLoadBalancersApiService.DatacentersNetworkloadbalancersGet") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/networkloadbalancers" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } if r.offset != nil { - localVarQueryParams.Add("offset", parameterToString(*r.offset, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("offset") - if defaultQueryParam == "" { - localVarQueryParams.Add("offset", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "offset", r.offset, "") } if r.limit != nil { - localVarQueryParams.Add("limit", parameterToString(*r.limit, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("limit") - if defaultQueryParam == "" { - localVarQueryParams.Add("limit", parameterToString(1000, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "") } if r.orderBy != nil { localVarQueryParams.Add("orderBy", parameterToString(*r.orderBy, "")) @@ -2797,11 +2643,11 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersGetExecu localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -2820,11 +2666,11 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersGetExecu localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersNetworkloadbalancersGet", } @@ -2840,28 +2686,26 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersGetExecu } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -2896,7 +2740,7 @@ func (r ApiDatacentersNetworkloadbalancersPatchRequest) XContractNumber(xContrac return r } -func (r ApiDatacentersNetworkloadbalancersPatchRequest) Execute() (NetworkLoadBalancer, *APIResponse, error) { +func (r ApiDatacentersNetworkloadbalancersPatchRequest) Execute() (NetworkLoadBalancer, *shared.APIResponse, error) { return r.ApiService.DatacentersNetworkloadbalancersPatchExecute(r) } @@ -2921,7 +2765,7 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersPatch(ct * Execute executes the request * @return NetworkLoadBalancer */ -func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersPatchExecute(r ApiDatacentersNetworkloadbalancersPatchRequest) (NetworkLoadBalancer, *APIResponse, error) { +func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersPatchExecute(r ApiDatacentersNetworkloadbalancersPatchRequest) (NetworkLoadBalancer, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPatch localVarPostBody interface{} @@ -2933,12 +2777,14 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersPatchExe localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "NetworkLoadBalancersApiService.DatacentersNetworkloadbalancersPatch") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/networkloadbalancers/{networkLoadBalancerId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"networkLoadBalancerId"+"}", _neturl.PathEscape(parameterToString(r.networkLoadBalancerId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"networkLoadBalancerId"+"}", _neturl.PathEscape(parameterValueToString(r.networkLoadBalancerId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -2948,20 +2794,10 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersPatchExe } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -2982,13 +2818,13 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersPatchExe localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.networkLoadBalancerProperties if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -3007,11 +2843,11 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersPatchExe localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersNetworkloadbalancersPatch", } @@ -3027,28 +2863,26 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersPatchExe } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -3082,7 +2916,7 @@ func (r ApiDatacentersNetworkloadbalancersPostRequest) XContractNumber(xContract return r } -func (r ApiDatacentersNetworkloadbalancersPostRequest) Execute() (NetworkLoadBalancer, *APIResponse, error) { +func (r ApiDatacentersNetworkloadbalancersPostRequest) Execute() (NetworkLoadBalancer, *shared.APIResponse, error) { return r.ApiService.DatacentersNetworkloadbalancersPostExecute(r) } @@ -3105,7 +2939,7 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersPost(ctx * Execute executes the request * @return NetworkLoadBalancer */ -func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersPostExecute(r ApiDatacentersNetworkloadbalancersPostRequest) (NetworkLoadBalancer, *APIResponse, error) { +func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersPostExecute(r ApiDatacentersNetworkloadbalancersPostRequest) (NetworkLoadBalancer, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -3117,11 +2951,13 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersPostExec localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "NetworkLoadBalancersApiService.DatacentersNetworkloadbalancersPost") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/networkloadbalancers" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -3131,20 +2967,10 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersPostExec } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -3165,13 +2991,13 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersPostExec localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.networkLoadBalancer if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -3190,11 +3016,11 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersPostExec localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersNetworkloadbalancersPost", } @@ -3210,28 +3036,26 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersPostExec } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -3266,7 +3090,7 @@ func (r ApiDatacentersNetworkloadbalancersPutRequest) XContractNumber(xContractN return r } -func (r ApiDatacentersNetworkloadbalancersPutRequest) Execute() (NetworkLoadBalancer, *APIResponse, error) { +func (r ApiDatacentersNetworkloadbalancersPutRequest) Execute() (NetworkLoadBalancer, *shared.APIResponse, error) { return r.ApiService.DatacentersNetworkloadbalancersPutExecute(r) } @@ -3291,7 +3115,7 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersPut(ctx * Execute executes the request * @return NetworkLoadBalancer */ -func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersPutExecute(r ApiDatacentersNetworkloadbalancersPutRequest) (NetworkLoadBalancer, *APIResponse, error) { +func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersPutExecute(r ApiDatacentersNetworkloadbalancersPutRequest) (NetworkLoadBalancer, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPut localVarPostBody interface{} @@ -3303,12 +3127,14 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersPutExecu localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "NetworkLoadBalancersApiService.DatacentersNetworkloadbalancersPut") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/networkloadbalancers/{networkLoadBalancerId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"networkLoadBalancerId"+"}", _neturl.PathEscape(parameterToString(r.networkLoadBalancerId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"networkLoadBalancerId"+"}", _neturl.PathEscape(parameterValueToString(r.networkLoadBalancerId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -3318,20 +3144,10 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersPutExecu } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -3352,13 +3168,13 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersPutExecu localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.networkLoadBalancer if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -3377,11 +3193,11 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersPutExecu localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersNetworkloadbalancersPut", } @@ -3397,28 +3213,26 @@ func (a *NetworkLoadBalancersApiService) DatacentersNetworkloadbalancersPutExecu } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/api_requests.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/api_requests.go similarity index 76% rename from vendor/github.com/ionos-cloud/sdk-go/v6/api_requests.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/api_requests.go index b020a790c..4394562b8 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/api_requests.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/api_requests.go @@ -13,6 +13,7 @@ package ionoscloud import ( _context "context" "fmt" + "github.com/ionos-cloud/sdk-go-bundle/shared" "io" _nethttp "net/http" _neturl "net/url" @@ -49,7 +50,7 @@ func (r ApiRequestsFindByIdRequest) XContractNumber(xContractNumber int32) ApiRe return r } -func (r ApiRequestsFindByIdRequest) Execute() (Request, *APIResponse, error) { +func (r ApiRequestsFindByIdRequest) Execute() (Request, *shared.APIResponse, error) { return r.ApiService.RequestsFindByIdExecute(r) } @@ -72,7 +73,7 @@ func (a *RequestsApiService) RequestsFindById(ctx _context.Context, requestId st * Execute executes the request * @return Request */ -func (a *RequestsApiService) RequestsFindByIdExecute(r ApiRequestsFindByIdRequest) (Request, *APIResponse, error) { +func (a *RequestsApiService) RequestsFindByIdExecute(r ApiRequestsFindByIdRequest) (Request, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -84,31 +85,23 @@ func (a *RequestsApiService) RequestsFindByIdExecute(r ApiRequestsFindByIdReques localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "RequestsApiService.RequestsFindById") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/requests/{requestId}" - localVarPath = strings.Replace(localVarPath, "{"+"requestId"+"}", _neturl.PathEscape(parameterToString(r.requestId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"requestId"+"}", _neturl.PathEscape(parameterValueToString(r.requestId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -129,11 +122,11 @@ func (a *RequestsApiService) RequestsFindByIdExecute(r ApiRequestsFindByIdReques localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -152,11 +145,11 @@ func (a *RequestsApiService) RequestsFindByIdExecute(r ApiRequestsFindByIdReques localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "RequestsFindById", } @@ -172,28 +165,26 @@ func (a *RequestsApiService) RequestsFindByIdExecute(r ApiRequestsFindByIdReques } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -291,7 +282,7 @@ func (r ApiRequestsGetRequest) Limit(limit int32) ApiRequestsGetRequest { // Filters query parameters limit results to those containing a matching value for a specific property. func (r ApiRequestsGetRequest) Filter(key string, value string) ApiRequestsGetRequest { - filterKey := fmt.Sprintf(FilterQueryParam, key) + filterKey := fmt.Sprintf("filter.%s", key) r.filters[filterKey] = append(r.filters[filterKey], value) return r } @@ -308,7 +299,7 @@ func (r ApiRequestsGetRequest) MaxResults(maxResults int32) ApiRequestsGetReques return r } -func (r ApiRequestsGetRequest) Execute() (Requests, *APIResponse, error) { +func (r ApiRequestsGetRequest) Execute() (Requests, *shared.APIResponse, error) { return r.ApiService.RequestsGetExecute(r) } @@ -330,7 +321,7 @@ func (a *RequestsApiService) RequestsGet(ctx _context.Context) ApiRequestsGetReq * Execute executes the request * @return Requests */ -func (a *RequestsApiService) RequestsGetExecute(r ApiRequestsGetRequest) (Requests, *APIResponse, error) { +func (a *RequestsApiService) RequestsGetExecute(r ApiRequestsGetRequest) (Requests, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -342,7 +333,9 @@ func (a *RequestsApiService) RequestsGetExecute(r ApiRequestsGetRequest) (Reques localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "RequestsApiService.RequestsGet") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/requests" @@ -352,69 +345,49 @@ func (a *RequestsApiService) RequestsGetExecute(r ApiRequestsGetRequest) (Reques localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } if r.filterStatus != nil { - localVarQueryParams.Add("filter.status", parameterToString(*r.filterStatus, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "filter.status", r.filterStatus, "") } if r.filterCreatedAfter != nil { - localVarQueryParams.Add("filter.createdAfter", parameterToString(*r.filterCreatedAfter, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "filter.createdAfter", r.filterCreatedAfter, "") } if r.filterCreatedBefore != nil { - localVarQueryParams.Add("filter.createdBefore", parameterToString(*r.filterCreatedBefore, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "filter.createdBefore", r.filterCreatedBefore, "") } if r.filterCreatedDate != nil { - localVarQueryParams.Add("filter.createdDate", parameterToString(*r.filterCreatedDate, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "filter.createdDate", r.filterCreatedDate, "") } if r.filterCreatedBy != nil { - localVarQueryParams.Add("filter.createdBy", parameterToString(*r.filterCreatedBy, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "filter.createdBy", r.filterCreatedBy, "") } if r.filterEtag != nil { - localVarQueryParams.Add("filter.etag", parameterToString(*r.filterEtag, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "filter.etag", r.filterEtag, "") } if r.filterRequestStatus != nil { - localVarQueryParams.Add("filter.requestStatus", parameterToString(*r.filterRequestStatus, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "filter.requestStatus", r.filterRequestStatus, "") } if r.filterMethod != nil { - localVarQueryParams.Add("filter.method", parameterToString(*r.filterMethod, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "filter.method", r.filterMethod, "") } if r.filterHeaders != nil { - localVarQueryParams.Add("filter.headers", parameterToString(*r.filterHeaders, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "filter.headers", r.filterHeaders, "") } if r.filterBody != nil { - localVarQueryParams.Add("filter.body", parameterToString(*r.filterBody, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "filter.body", r.filterBody, "") } if r.filterUrl != nil { - localVarQueryParams.Add("filter.url", parameterToString(*r.filterUrl, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "filter.url", r.filterUrl, "") } if r.offset != nil { - localVarQueryParams.Add("offset", parameterToString(*r.offset, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("offset") - if defaultQueryParam == "" { - localVarQueryParams.Add("offset", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "offset", r.offset, "") } if r.limit != nil { - localVarQueryParams.Add("limit", parameterToString(*r.limit, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("limit") - if defaultQueryParam == "" { - localVarQueryParams.Add("limit", parameterToString(1000, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "") } if r.orderBy != nil { localVarQueryParams.Add("orderBy", parameterToString(*r.orderBy, "")) @@ -448,11 +421,11 @@ func (a *RequestsApiService) RequestsGetExecute(r ApiRequestsGetRequest) (Reques localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -471,11 +444,11 @@ func (a *RequestsApiService) RequestsGetExecute(r ApiRequestsGetRequest) (Reques localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "RequestsGet", } @@ -491,28 +464,26 @@ func (a *RequestsApiService) RequestsGetExecute(r ApiRequestsGetRequest) (Reques } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -546,7 +517,7 @@ func (r ApiRequestsStatusGetRequest) XContractNumber(xContractNumber int32) ApiR // Filters query parameters limit results to those containing a matching value for a specific property. func (r ApiRequestsStatusGetRequest) Filter(key string, value string) ApiRequestsStatusGetRequest { - filterKey := fmt.Sprintf(FilterQueryParam, key) + filterKey := fmt.Sprintf("filter.%s", key) r.filters[filterKey] = append(r.filters[filterKey], value) return r } @@ -563,7 +534,7 @@ func (r ApiRequestsStatusGetRequest) MaxResults(maxResults int32) ApiRequestsSta return r } -func (r ApiRequestsStatusGetRequest) Execute() (RequestStatus, *APIResponse, error) { +func (r ApiRequestsStatusGetRequest) Execute() (RequestStatus, *shared.APIResponse, error) { return r.ApiService.RequestsStatusGetExecute(r) } @@ -587,7 +558,7 @@ func (a *RequestsApiService) RequestsStatusGet(ctx _context.Context, requestId s * Execute executes the request * @return RequestStatus */ -func (a *RequestsApiService) RequestsStatusGetExecute(r ApiRequestsStatusGetRequest) (RequestStatus, *APIResponse, error) { +func (a *RequestsApiService) RequestsStatusGetExecute(r ApiRequestsStatusGetRequest) (RequestStatus, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -599,31 +570,23 @@ func (a *RequestsApiService) RequestsStatusGetExecute(r ApiRequestsStatusGetRequ localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "RequestsApiService.RequestsStatusGet") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/requests/{requestId}/status" - localVarPath = strings.Replace(localVarPath, "{"+"requestId"+"}", _neturl.PathEscape(parameterToString(r.requestId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"requestId"+"}", _neturl.PathEscape(parameterValueToString(r.requestId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } if r.orderBy != nil { localVarQueryParams.Add("orderBy", parameterToString(*r.orderBy, "")) @@ -657,11 +620,11 @@ func (a *RequestsApiService) RequestsStatusGetExecute(r ApiRequestsStatusGetRequ localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -680,11 +643,11 @@ func (a *RequestsApiService) RequestsStatusGetExecute(r ApiRequestsStatusGetRequ localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "RequestsStatusGet", } @@ -700,28 +663,26 @@ func (a *RequestsApiService) RequestsStatusGetExecute(r ApiRequestsStatusGetRequ } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/api_security_groups.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/api_security_groups.go similarity index 79% rename from vendor/github.com/ionos-cloud/sdk-go/v6/api_security_groups.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/api_security_groups.go index e3ff252f4..b64416bdf 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/api_security_groups.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/api_security_groups.go @@ -13,6 +13,7 @@ package ionoscloud import ( _context "context" "fmt" + "github.com/ionos-cloud/sdk-go-bundle/shared" "io" _nethttp "net/http" _neturl "net/url" @@ -40,7 +41,7 @@ func (r ApiDatacentersSecuritygroupsDeleteRequest) Pretty(pretty bool) ApiDatace return r } -func (r ApiDatacentersSecuritygroupsDeleteRequest) Execute() (*APIResponse, error) { +func (r ApiDatacentersSecuritygroupsDeleteRequest) Execute() (*shared.APIResponse, error) { return r.ApiService.DatacentersSecuritygroupsDeleteExecute(r) } @@ -64,7 +65,7 @@ func (a *SecurityGroupsApiService) DatacentersSecuritygroupsDelete(ctx _context. /* * Execute executes the request */ -func (a *SecurityGroupsApiService) DatacentersSecuritygroupsDeleteExecute(r ApiDatacentersSecuritygroupsDeleteRequest) (*APIResponse, error) { +func (a *SecurityGroupsApiService) DatacentersSecuritygroupsDeleteExecute(r ApiDatacentersSecuritygroupsDeleteRequest) (*shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodDelete localVarPostBody interface{} @@ -75,24 +76,21 @@ func (a *SecurityGroupsApiService) DatacentersSecuritygroupsDeleteExecute(r ApiD localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SecurityGroupsApiService.DatacentersSecuritygroupsDelete") if err != nil { - return nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/securitygroups/{securityGroupId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"securityGroupId"+"}", _neturl.PathEscape(parameterToString(r.securityGroupId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"securityGroupId"+"}", _neturl.PathEscape(parameterValueToString(r.securityGroupId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } // to determine the Content-Type header @@ -114,7 +112,7 @@ func (a *SecurityGroupsApiService) DatacentersSecuritygroupsDeleteExecute(r ApiD } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -133,11 +131,11 @@ func (a *SecurityGroupsApiService) DatacentersSecuritygroupsDeleteExecute(r ApiD localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersSecuritygroupsDelete", } @@ -153,18 +151,17 @@ func (a *SecurityGroupsApiService) DatacentersSecuritygroupsDeleteExecute(r ApiD } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarAPIResponse, newErr } @@ -189,7 +186,7 @@ func (r ApiDatacentersSecuritygroupsFindByIdRequest) Depth(depth int32) ApiDatac return r } -func (r ApiDatacentersSecuritygroupsFindByIdRequest) Execute() (SecurityGroup, *APIResponse, error) { +func (r ApiDatacentersSecuritygroupsFindByIdRequest) Execute() (SecurityGroup, *shared.APIResponse, error) { return r.ApiService.DatacentersSecuritygroupsFindByIdExecute(r) } @@ -214,7 +211,7 @@ func (a *SecurityGroupsApiService) DatacentersSecuritygroupsFindById(ctx _contex * Execute executes the request * @return SecurityGroup */ -func (a *SecurityGroupsApiService) DatacentersSecuritygroupsFindByIdExecute(r ApiDatacentersSecuritygroupsFindByIdRequest) (SecurityGroup, *APIResponse, error) { +func (a *SecurityGroupsApiService) DatacentersSecuritygroupsFindByIdExecute(r ApiDatacentersSecuritygroupsFindByIdRequest) (SecurityGroup, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -226,32 +223,24 @@ func (a *SecurityGroupsApiService) DatacentersSecuritygroupsFindByIdExecute(r Ap localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SecurityGroupsApiService.DatacentersSecuritygroupsFindById") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/securitygroups/{securityGroupId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"securityGroupId"+"}", _neturl.PathEscape(parameterToString(r.securityGroupId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"securityGroupId"+"}", _neturl.PathEscape(parameterValueToString(r.securityGroupId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -273,7 +262,7 @@ func (a *SecurityGroupsApiService) DatacentersSecuritygroupsFindByIdExecute(r Ap } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -292,11 +281,11 @@ func (a *SecurityGroupsApiService) DatacentersSecuritygroupsFindByIdExecute(r Ap localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersSecuritygroupsFindById", } @@ -312,28 +301,26 @@ func (a *SecurityGroupsApiService) DatacentersSecuritygroupsFindByIdExecute(r Ap } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -348,7 +335,7 @@ type ApiDatacentersSecuritygroupsFirewallrulesDeleteRequest struct { ruleId string } -func (r ApiDatacentersSecuritygroupsFirewallrulesDeleteRequest) Execute() (*APIResponse, error) { +func (r ApiDatacentersSecuritygroupsFirewallrulesDeleteRequest) Execute() (*shared.APIResponse, error) { return r.ApiService.DatacentersSecuritygroupsFirewallrulesDeleteExecute(r) } @@ -374,7 +361,7 @@ func (a *SecurityGroupsApiService) DatacentersSecuritygroupsFirewallrulesDelete( /* * Execute executes the request */ -func (a *SecurityGroupsApiService) DatacentersSecuritygroupsFirewallrulesDeleteExecute(r ApiDatacentersSecuritygroupsFirewallrulesDeleteRequest) (*APIResponse, error) { +func (a *SecurityGroupsApiService) DatacentersSecuritygroupsFirewallrulesDeleteExecute(r ApiDatacentersSecuritygroupsFirewallrulesDeleteRequest) (*shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodDelete localVarPostBody interface{} @@ -385,13 +372,15 @@ func (a *SecurityGroupsApiService) DatacentersSecuritygroupsFirewallrulesDeleteE localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SecurityGroupsApiService.DatacentersSecuritygroupsFirewallrulesDelete") if err != nil { - return nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/securitygroups/{securityGroupId}/rules/{ruleId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"securityGroupId"+"}", _neturl.PathEscape(parameterToString(r.securityGroupId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"ruleId"+"}", _neturl.PathEscape(parameterToString(r.ruleId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"securityGroupId"+"}", _neturl.PathEscape(parameterValueToString(r.securityGroupId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"ruleId"+"}", _neturl.PathEscape(parameterValueToString(r.ruleId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -416,7 +405,7 @@ func (a *SecurityGroupsApiService) DatacentersSecuritygroupsFirewallrulesDeleteE } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -435,11 +424,11 @@ func (a *SecurityGroupsApiService) DatacentersSecuritygroupsFirewallrulesDeleteE localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersSecuritygroupsFirewallrulesDelete", } @@ -455,18 +444,17 @@ func (a *SecurityGroupsApiService) DatacentersSecuritygroupsFirewallrulesDeleteE } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarAPIResponse, newErr } @@ -486,7 +474,7 @@ func (r ApiDatacentersSecuritygroupsFirewallrulesPostRequest) FirewallRule(firew return r } -func (r ApiDatacentersSecuritygroupsFirewallrulesPostRequest) Execute() (FirewallRule, *APIResponse, error) { +func (r ApiDatacentersSecuritygroupsFirewallrulesPostRequest) Execute() (FirewallRule, *shared.APIResponse, error) { return r.ApiService.DatacentersSecuritygroupsFirewallrulesPostExecute(r) } @@ -511,7 +499,7 @@ func (a *SecurityGroupsApiService) DatacentersSecuritygroupsFirewallrulesPost(ct * Execute executes the request * @return FirewallRule */ -func (a *SecurityGroupsApiService) DatacentersSecuritygroupsFirewallrulesPostExecute(r ApiDatacentersSecuritygroupsFirewallrulesPostRequest) (FirewallRule, *APIResponse, error) { +func (a *SecurityGroupsApiService) DatacentersSecuritygroupsFirewallrulesPostExecute(r ApiDatacentersSecuritygroupsFirewallrulesPostRequest) (FirewallRule, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -523,12 +511,14 @@ func (a *SecurityGroupsApiService) DatacentersSecuritygroupsFirewallrulesPostExe localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SecurityGroupsApiService.DatacentersSecuritygroupsFirewallrulesPost") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/securitygroups/{securityGroupId}/rules" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"securityGroupId"+"}", _neturl.PathEscape(parameterToString(r.securityGroupId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"securityGroupId"+"}", _neturl.PathEscape(parameterValueToString(r.securityGroupId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -558,7 +548,7 @@ func (a *SecurityGroupsApiService) DatacentersSecuritygroupsFirewallrulesPostExe localVarPostBody = r.firewallRule if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -577,11 +567,11 @@ func (a *SecurityGroupsApiService) DatacentersSecuritygroupsFirewallrulesPostExe localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersSecuritygroupsFirewallrulesPost", } @@ -597,28 +587,26 @@ func (a *SecurityGroupsApiService) DatacentersSecuritygroupsFirewallrulesPostExe } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -657,7 +645,7 @@ func (r ApiDatacentersSecuritygroupsGetRequest) Limit(limit int32) ApiDatacenter // Filters query parameters limit results to those containing a matching value for a specific property. func (r ApiDatacentersSecuritygroupsGetRequest) Filter(key string, value string) ApiDatacentersSecuritygroupsGetRequest { - filterKey := fmt.Sprintf(FilterQueryParam, key) + filterKey := fmt.Sprintf("filter.%s", key) r.filters[filterKey] = append(r.filters[filterKey], value) return r } @@ -674,7 +662,7 @@ func (r ApiDatacentersSecuritygroupsGetRequest) MaxResults(maxResults int32) Api return r } -func (r ApiDatacentersSecuritygroupsGetRequest) Execute() (SecurityGroups, *APIResponse, error) { +func (r ApiDatacentersSecuritygroupsGetRequest) Execute() (SecurityGroups, *shared.APIResponse, error) { return r.ApiService.DatacentersSecuritygroupsGetExecute(r) } @@ -698,7 +686,7 @@ func (a *SecurityGroupsApiService) DatacentersSecuritygroupsGet(ctx _context.Con * Execute executes the request * @return SecurityGroups */ -func (a *SecurityGroupsApiService) DatacentersSecuritygroupsGetExecute(r ApiDatacentersSecuritygroupsGetRequest) (SecurityGroups, *APIResponse, error) { +func (a *SecurityGroupsApiService) DatacentersSecuritygroupsGetExecute(r ApiDatacentersSecuritygroupsGetRequest) (SecurityGroups, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -710,47 +698,29 @@ func (a *SecurityGroupsApiService) DatacentersSecuritygroupsGetExecute(r ApiData localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SecurityGroupsApiService.DatacentersSecuritygroupsGet") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/securitygroups" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } if r.offset != nil { - localVarQueryParams.Add("offset", parameterToString(*r.offset, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("offset") - if defaultQueryParam == "" { - localVarQueryParams.Add("offset", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "offset", r.offset, "") } if r.limit != nil { - localVarQueryParams.Add("limit", parameterToString(*r.limit, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("limit") - if defaultQueryParam == "" { - localVarQueryParams.Add("limit", parameterToString(1000, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "") } if r.orderBy != nil { localVarQueryParams.Add("orderBy", parameterToString(*r.orderBy, "")) @@ -785,7 +755,7 @@ func (a *SecurityGroupsApiService) DatacentersSecuritygroupsGetExecute(r ApiData } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -804,11 +774,11 @@ func (a *SecurityGroupsApiService) DatacentersSecuritygroupsGetExecute(r ApiData localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersSecuritygroupsGet", } @@ -824,28 +794,26 @@ func (a *SecurityGroupsApiService) DatacentersSecuritygroupsGetExecute(r ApiData } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -875,7 +843,7 @@ func (r ApiDatacentersSecuritygroupsPatchRequest) Depth(depth int32) ApiDatacent return r } -func (r ApiDatacentersSecuritygroupsPatchRequest) Execute() (SecurityGroup, *APIResponse, error) { +func (r ApiDatacentersSecuritygroupsPatchRequest) Execute() (SecurityGroup, *shared.APIResponse, error) { return r.ApiService.DatacentersSecuritygroupsPatchExecute(r) } @@ -900,7 +868,7 @@ func (a *SecurityGroupsApiService) DatacentersSecuritygroupsPatch(ctx _context.C * Execute executes the request * @return SecurityGroup */ -func (a *SecurityGroupsApiService) DatacentersSecuritygroupsPatchExecute(r ApiDatacentersSecuritygroupsPatchRequest) (SecurityGroup, *APIResponse, error) { +func (a *SecurityGroupsApiService) DatacentersSecuritygroupsPatchExecute(r ApiDatacentersSecuritygroupsPatchRequest) (SecurityGroup, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPatch localVarPostBody interface{} @@ -912,12 +880,14 @@ func (a *SecurityGroupsApiService) DatacentersSecuritygroupsPatchExecute(r ApiDa localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SecurityGroupsApiService.DatacentersSecuritygroupsPatch") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/securitygroups/{securityGroupId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"securityGroupId"+"}", _neturl.PathEscape(parameterToString(r.securityGroupId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"securityGroupId"+"}", _neturl.PathEscape(parameterValueToString(r.securityGroupId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -927,20 +897,10 @@ func (a *SecurityGroupsApiService) DatacentersSecuritygroupsPatchExecute(r ApiDa } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -964,7 +924,7 @@ func (a *SecurityGroupsApiService) DatacentersSecuritygroupsPatchExecute(r ApiDa localVarPostBody = r.securityGroup if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -983,11 +943,11 @@ func (a *SecurityGroupsApiService) DatacentersSecuritygroupsPatchExecute(r ApiDa localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersSecuritygroupsPatch", } @@ -1003,28 +963,26 @@ func (a *SecurityGroupsApiService) DatacentersSecuritygroupsPatchExecute(r ApiDa } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -1053,7 +1011,7 @@ func (r ApiDatacentersSecuritygroupsPostRequest) Depth(depth int32) ApiDatacente return r } -func (r ApiDatacentersSecuritygroupsPostRequest) Execute() (SecurityGroup, *APIResponse, error) { +func (r ApiDatacentersSecuritygroupsPostRequest) Execute() (SecurityGroup, *shared.APIResponse, error) { return r.ApiService.DatacentersSecuritygroupsPostExecute(r) } @@ -1076,7 +1034,7 @@ func (a *SecurityGroupsApiService) DatacentersSecuritygroupsPost(ctx _context.Co * Execute executes the request * @return SecurityGroup */ -func (a *SecurityGroupsApiService) DatacentersSecuritygroupsPostExecute(r ApiDatacentersSecuritygroupsPostRequest) (SecurityGroup, *APIResponse, error) { +func (a *SecurityGroupsApiService) DatacentersSecuritygroupsPostExecute(r ApiDatacentersSecuritygroupsPostRequest) (SecurityGroup, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -1088,11 +1046,13 @@ func (a *SecurityGroupsApiService) DatacentersSecuritygroupsPostExecute(r ApiDat localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SecurityGroupsApiService.DatacentersSecuritygroupsPost") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/securitygroups" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -1102,20 +1062,10 @@ func (a *SecurityGroupsApiService) DatacentersSecuritygroupsPostExecute(r ApiDat } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -1139,7 +1089,7 @@ func (a *SecurityGroupsApiService) DatacentersSecuritygroupsPostExecute(r ApiDat localVarPostBody = r.securityGroup if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -1158,11 +1108,11 @@ func (a *SecurityGroupsApiService) DatacentersSecuritygroupsPostExecute(r ApiDat localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersSecuritygroupsPost", } @@ -1178,28 +1128,26 @@ func (a *SecurityGroupsApiService) DatacentersSecuritygroupsPostExecute(r ApiDat } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -1229,7 +1177,7 @@ func (r ApiDatacentersSecuritygroupsPutRequest) Depth(depth int32) ApiDatacenter return r } -func (r ApiDatacentersSecuritygroupsPutRequest) Execute() (SecurityGroup, *APIResponse, error) { +func (r ApiDatacentersSecuritygroupsPutRequest) Execute() (SecurityGroup, *shared.APIResponse, error) { return r.ApiService.DatacentersSecuritygroupsPutExecute(r) } @@ -1254,7 +1202,7 @@ func (a *SecurityGroupsApiService) DatacentersSecuritygroupsPut(ctx _context.Con * Execute executes the request * @return SecurityGroup */ -func (a *SecurityGroupsApiService) DatacentersSecuritygroupsPutExecute(r ApiDatacentersSecuritygroupsPutRequest) (SecurityGroup, *APIResponse, error) { +func (a *SecurityGroupsApiService) DatacentersSecuritygroupsPutExecute(r ApiDatacentersSecuritygroupsPutRequest) (SecurityGroup, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPut localVarPostBody interface{} @@ -1266,12 +1214,14 @@ func (a *SecurityGroupsApiService) DatacentersSecuritygroupsPutExecute(r ApiData localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SecurityGroupsApiService.DatacentersSecuritygroupsPut") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/securitygroups/{securityGroupId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"securityGroupId"+"}", _neturl.PathEscape(parameterToString(r.securityGroupId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"securityGroupId"+"}", _neturl.PathEscape(parameterValueToString(r.securityGroupId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -1281,20 +1231,10 @@ func (a *SecurityGroupsApiService) DatacentersSecuritygroupsPutExecute(r ApiData } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -1318,7 +1258,7 @@ func (a *SecurityGroupsApiService) DatacentersSecuritygroupsPutExecute(r ApiData localVarPostBody = r.securityGroup if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -1337,11 +1277,11 @@ func (a *SecurityGroupsApiService) DatacentersSecuritygroupsPutExecute(r ApiData localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersSecuritygroupsPut", } @@ -1357,28 +1297,26 @@ func (a *SecurityGroupsApiService) DatacentersSecuritygroupsPutExecute(r ApiData } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -1404,7 +1342,7 @@ func (r ApiDatacentersSecuritygroupsRulesFindByIdRequest) Depth(depth int32) Api return r } -func (r ApiDatacentersSecuritygroupsRulesFindByIdRequest) Execute() (FirewallRule, *APIResponse, error) { +func (r ApiDatacentersSecuritygroupsRulesFindByIdRequest) Execute() (FirewallRule, *shared.APIResponse, error) { return r.ApiService.DatacentersSecuritygroupsRulesFindByIdExecute(r) } @@ -1431,7 +1369,7 @@ func (a *SecurityGroupsApiService) DatacentersSecuritygroupsRulesFindById(ctx _c * Execute executes the request * @return FirewallRule */ -func (a *SecurityGroupsApiService) DatacentersSecuritygroupsRulesFindByIdExecute(r ApiDatacentersSecuritygroupsRulesFindByIdRequest) (FirewallRule, *APIResponse, error) { +func (a *SecurityGroupsApiService) DatacentersSecuritygroupsRulesFindByIdExecute(r ApiDatacentersSecuritygroupsRulesFindByIdRequest) (FirewallRule, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -1443,33 +1381,25 @@ func (a *SecurityGroupsApiService) DatacentersSecuritygroupsRulesFindByIdExecute localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SecurityGroupsApiService.DatacentersSecuritygroupsRulesFindById") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/securitygroups/{securityGroupId}/rules/{ruleId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"securityGroupId"+"}", _neturl.PathEscape(parameterToString(r.securityGroupId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"ruleId"+"}", _neturl.PathEscape(parameterToString(r.ruleId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"securityGroupId"+"}", _neturl.PathEscape(parameterValueToString(r.securityGroupId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"ruleId"+"}", _neturl.PathEscape(parameterValueToString(r.ruleId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -1491,7 +1421,7 @@ func (a *SecurityGroupsApiService) DatacentersSecuritygroupsRulesFindByIdExecute } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -1510,11 +1440,11 @@ func (a *SecurityGroupsApiService) DatacentersSecuritygroupsRulesFindByIdExecute localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersSecuritygroupsRulesFindById", } @@ -1530,28 +1460,26 @@ func (a *SecurityGroupsApiService) DatacentersSecuritygroupsRulesFindByIdExecute } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -1591,7 +1519,7 @@ func (r ApiDatacentersSecuritygroupsRulesGetRequest) Limit(limit int32) ApiDatac // Filters query parameters limit results to those containing a matching value for a specific property. func (r ApiDatacentersSecuritygroupsRulesGetRequest) Filter(key string, value string) ApiDatacentersSecuritygroupsRulesGetRequest { - filterKey := fmt.Sprintf(FilterQueryParam, key) + filterKey := fmt.Sprintf("filter.%s", key) r.filters[filterKey] = append(r.filters[filterKey], value) return r } @@ -1608,7 +1536,7 @@ func (r ApiDatacentersSecuritygroupsRulesGetRequest) MaxResults(maxResults int32 return r } -func (r ApiDatacentersSecuritygroupsRulesGetRequest) Execute() (FirewallRules, *APIResponse, error) { +func (r ApiDatacentersSecuritygroupsRulesGetRequest) Execute() (FirewallRules, *shared.APIResponse, error) { return r.ApiService.DatacentersSecuritygroupsRulesGetExecute(r) } @@ -1634,7 +1562,7 @@ func (a *SecurityGroupsApiService) DatacentersSecuritygroupsRulesGet(ctx _contex * Execute executes the request * @return FirewallRules */ -func (a *SecurityGroupsApiService) DatacentersSecuritygroupsRulesGetExecute(r ApiDatacentersSecuritygroupsRulesGetRequest) (FirewallRules, *APIResponse, error) { +func (a *SecurityGroupsApiService) DatacentersSecuritygroupsRulesGetExecute(r ApiDatacentersSecuritygroupsRulesGetRequest) (FirewallRules, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -1646,48 +1574,30 @@ func (a *SecurityGroupsApiService) DatacentersSecuritygroupsRulesGetExecute(r Ap localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SecurityGroupsApiService.DatacentersSecuritygroupsRulesGet") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/securitygroups/{securityGroupId}/rules" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"securityGroupId"+"}", _neturl.PathEscape(parameterToString(r.securityGroupId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"securityGroupId"+"}", _neturl.PathEscape(parameterValueToString(r.securityGroupId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } if r.offset != nil { - localVarQueryParams.Add("offset", parameterToString(*r.offset, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("offset") - if defaultQueryParam == "" { - localVarQueryParams.Add("offset", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "offset", r.offset, "") } if r.limit != nil { - localVarQueryParams.Add("limit", parameterToString(*r.limit, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("limit") - if defaultQueryParam == "" { - localVarQueryParams.Add("limit", parameterToString(1000, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "") } if r.orderBy != nil { localVarQueryParams.Add("orderBy", parameterToString(*r.orderBy, "")) @@ -1722,7 +1632,7 @@ func (a *SecurityGroupsApiService) DatacentersSecuritygroupsRulesGetExecute(r Ap } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -1741,11 +1651,11 @@ func (a *SecurityGroupsApiService) DatacentersSecuritygroupsRulesGetExecute(r Ap localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersSecuritygroupsRulesGet", } @@ -1761,28 +1671,26 @@ func (a *SecurityGroupsApiService) DatacentersSecuritygroupsRulesGetExecute(r Ap } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -1813,7 +1721,7 @@ func (r ApiDatacentersSecuritygroupsRulesPatchRequest) Depth(depth int32) ApiDat return r } -func (r ApiDatacentersSecuritygroupsRulesPatchRequest) Execute() (FirewallRule, *APIResponse, error) { +func (r ApiDatacentersSecuritygroupsRulesPatchRequest) Execute() (FirewallRule, *shared.APIResponse, error) { return r.ApiService.DatacentersSecuritygroupsRulesPatchExecute(r) } @@ -1840,7 +1748,7 @@ func (a *SecurityGroupsApiService) DatacentersSecuritygroupsRulesPatch(ctx _cont * Execute executes the request * @return FirewallRule */ -func (a *SecurityGroupsApiService) DatacentersSecuritygroupsRulesPatchExecute(r ApiDatacentersSecuritygroupsRulesPatchRequest) (FirewallRule, *APIResponse, error) { +func (a *SecurityGroupsApiService) DatacentersSecuritygroupsRulesPatchExecute(r ApiDatacentersSecuritygroupsRulesPatchRequest) (FirewallRule, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPatch localVarPostBody interface{} @@ -1852,13 +1760,15 @@ func (a *SecurityGroupsApiService) DatacentersSecuritygroupsRulesPatchExecute(r localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SecurityGroupsApiService.DatacentersSecuritygroupsRulesPatch") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/securitygroups/{securityGroupId}/rules/{ruleId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"securityGroupId"+"}", _neturl.PathEscape(parameterToString(r.securityGroupId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"ruleId"+"}", _neturl.PathEscape(parameterToString(r.ruleId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"securityGroupId"+"}", _neturl.PathEscape(parameterValueToString(r.securityGroupId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"ruleId"+"}", _neturl.PathEscape(parameterValueToString(r.ruleId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -1868,20 +1778,10 @@ func (a *SecurityGroupsApiService) DatacentersSecuritygroupsRulesPatchExecute(r } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -1905,7 +1805,7 @@ func (a *SecurityGroupsApiService) DatacentersSecuritygroupsRulesPatchExecute(r localVarPostBody = r.rule if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -1924,11 +1824,11 @@ func (a *SecurityGroupsApiService) DatacentersSecuritygroupsRulesPatchExecute(r localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersSecuritygroupsRulesPatch", } @@ -1944,28 +1844,26 @@ func (a *SecurityGroupsApiService) DatacentersSecuritygroupsRulesPatchExecute(r } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -1996,7 +1894,7 @@ func (r ApiDatacentersSecuritygroupsRulesPutRequest) Depth(depth int32) ApiDatac return r } -func (r ApiDatacentersSecuritygroupsRulesPutRequest) Execute() (FirewallRule, *APIResponse, error) { +func (r ApiDatacentersSecuritygroupsRulesPutRequest) Execute() (FirewallRule, *shared.APIResponse, error) { return r.ApiService.DatacentersSecuritygroupsRulesPutExecute(r) } @@ -2023,7 +1921,7 @@ func (a *SecurityGroupsApiService) DatacentersSecuritygroupsRulesPut(ctx _contex * Execute executes the request * @return FirewallRule */ -func (a *SecurityGroupsApiService) DatacentersSecuritygroupsRulesPutExecute(r ApiDatacentersSecuritygroupsRulesPutRequest) (FirewallRule, *APIResponse, error) { +func (a *SecurityGroupsApiService) DatacentersSecuritygroupsRulesPutExecute(r ApiDatacentersSecuritygroupsRulesPutRequest) (FirewallRule, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPut localVarPostBody interface{} @@ -2035,13 +1933,15 @@ func (a *SecurityGroupsApiService) DatacentersSecuritygroupsRulesPutExecute(r Ap localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SecurityGroupsApiService.DatacentersSecuritygroupsRulesPut") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/securitygroups/{securityGroupId}/rules/{ruleId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"securityGroupId"+"}", _neturl.PathEscape(parameterToString(r.securityGroupId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"ruleId"+"}", _neturl.PathEscape(parameterToString(r.ruleId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"securityGroupId"+"}", _neturl.PathEscape(parameterValueToString(r.securityGroupId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"ruleId"+"}", _neturl.PathEscape(parameterValueToString(r.ruleId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -2051,20 +1951,10 @@ func (a *SecurityGroupsApiService) DatacentersSecuritygroupsRulesPutExecute(r Ap } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -2088,7 +1978,7 @@ func (a *SecurityGroupsApiService) DatacentersSecuritygroupsRulesPutExecute(r Ap localVarPostBody = r.rule if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -2107,11 +1997,11 @@ func (a *SecurityGroupsApiService) DatacentersSecuritygroupsRulesPutExecute(r Ap localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersSecuritygroupsRulesPut", } @@ -2127,28 +2017,26 @@ func (a *SecurityGroupsApiService) DatacentersSecuritygroupsRulesPutExecute(r Ap } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -2179,7 +2067,7 @@ func (r ApiDatacentersServersNicsSecuritygroupsPutRequest) Depth(depth int32) Ap return r } -func (r ApiDatacentersServersNicsSecuritygroupsPutRequest) Execute() (SecurityGroups, *APIResponse, error) { +func (r ApiDatacentersServersNicsSecuritygroupsPutRequest) Execute() (SecurityGroups, *shared.APIResponse, error) { return r.ApiService.DatacentersServersNicsSecuritygroupsPutExecute(r) } @@ -2206,7 +2094,7 @@ func (a *SecurityGroupsApiService) DatacentersServersNicsSecuritygroupsPut(ctx _ * Execute executes the request * @return SecurityGroups */ -func (a *SecurityGroupsApiService) DatacentersServersNicsSecuritygroupsPutExecute(r ApiDatacentersServersNicsSecuritygroupsPutRequest) (SecurityGroups, *APIResponse, error) { +func (a *SecurityGroupsApiService) DatacentersServersNicsSecuritygroupsPutExecute(r ApiDatacentersServersNicsSecuritygroupsPutRequest) (SecurityGroups, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPut localVarPostBody interface{} @@ -2218,13 +2106,15 @@ func (a *SecurityGroupsApiService) DatacentersServersNicsSecuritygroupsPutExecut localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SecurityGroupsApiService.DatacentersServersNicsSecuritygroupsPut") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/servers/{serverId}/nics/{nicId}/securitygroups" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterToString(r.serverId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"nicId"+"}", _neturl.PathEscape(parameterToString(r.nicId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterValueToString(r.serverId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nicId"+"}", _neturl.PathEscape(parameterValueToString(r.nicId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -2234,20 +2124,10 @@ func (a *SecurityGroupsApiService) DatacentersServersNicsSecuritygroupsPutExecut } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -2271,7 +2151,7 @@ func (a *SecurityGroupsApiService) DatacentersServersNicsSecuritygroupsPutExecut localVarPostBody = r.securitygroups if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -2290,11 +2170,11 @@ func (a *SecurityGroupsApiService) DatacentersServersNicsSecuritygroupsPutExecut localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersServersNicsSecuritygroupsPut", } @@ -2310,28 +2190,26 @@ func (a *SecurityGroupsApiService) DatacentersServersNicsSecuritygroupsPutExecut } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -2361,7 +2239,7 @@ func (r ApiDatacentersServersSecuritygroupsPutRequest) Depth(depth int32) ApiDat return r } -func (r ApiDatacentersServersSecuritygroupsPutRequest) Execute() (SecurityGroups, *APIResponse, error) { +func (r ApiDatacentersServersSecuritygroupsPutRequest) Execute() (SecurityGroups, *shared.APIResponse, error) { return r.ApiService.DatacentersServersSecuritygroupsPutExecute(r) } @@ -2386,7 +2264,7 @@ func (a *SecurityGroupsApiService) DatacentersServersSecuritygroupsPut(ctx _cont * Execute executes the request * @return SecurityGroups */ -func (a *SecurityGroupsApiService) DatacentersServersSecuritygroupsPutExecute(r ApiDatacentersServersSecuritygroupsPutRequest) (SecurityGroups, *APIResponse, error) { +func (a *SecurityGroupsApiService) DatacentersServersSecuritygroupsPutExecute(r ApiDatacentersServersSecuritygroupsPutRequest) (SecurityGroups, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPut localVarPostBody interface{} @@ -2398,12 +2276,14 @@ func (a *SecurityGroupsApiService) DatacentersServersSecuritygroupsPutExecute(r localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SecurityGroupsApiService.DatacentersServersSecuritygroupsPut") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/servers/{serverId}/securitygroups" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterToString(r.serverId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterValueToString(r.serverId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -2413,20 +2293,10 @@ func (a *SecurityGroupsApiService) DatacentersServersSecuritygroupsPutExecute(r } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -2450,7 +2320,7 @@ func (a *SecurityGroupsApiService) DatacentersServersSecuritygroupsPutExecute(r localVarPostBody = r.securitygroups if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -2469,11 +2339,11 @@ func (a *SecurityGroupsApiService) DatacentersServersSecuritygroupsPutExecute(r localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersServersSecuritygroupsPut", } @@ -2489,28 +2359,26 @@ func (a *SecurityGroupsApiService) DatacentersServersSecuritygroupsPutExecute(r } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/api_servers.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/api_servers.go similarity index 77% rename from vendor/github.com/ionos-cloud/sdk-go/v6/api_servers.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/api_servers.go index 8c1faf2e7..8235c06fc 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/api_servers.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/api_servers.go @@ -13,6 +13,7 @@ package ionoscloud import ( _context "context" "fmt" + "github.com/ionos-cloud/sdk-go-bundle/shared" "io" _nethttp "net/http" _neturl "net/url" @@ -51,7 +52,7 @@ func (r ApiDatacentersServersCdromsDeleteRequest) XContractNumber(xContractNumbe return r } -func (r ApiDatacentersServersCdromsDeleteRequest) Execute() (*APIResponse, error) { +func (r ApiDatacentersServersCdromsDeleteRequest) Execute() (*shared.APIResponse, error) { return r.ApiService.DatacentersServersCdromsDeleteExecute(r) } @@ -81,7 +82,7 @@ func (a *ServersApiService) DatacentersServersCdromsDelete(ctx _context.Context, /* * Execute executes the request */ -func (a *ServersApiService) DatacentersServersCdromsDeleteExecute(r ApiDatacentersServersCdromsDeleteRequest) (*APIResponse, error) { +func (a *ServersApiService) DatacentersServersCdromsDeleteExecute(r ApiDatacentersServersCdromsDeleteRequest) (*shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodDelete localVarPostBody interface{} @@ -92,33 +93,25 @@ func (a *ServersApiService) DatacentersServersCdromsDeleteExecute(r ApiDatacente localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ServersApiService.DatacentersServersCdromsDelete") if err != nil { - return nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/servers/{serverId}/cdroms/{cdromId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterToString(r.serverId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"cdromId"+"}", _neturl.PathEscape(parameterToString(r.cdromId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterValueToString(r.serverId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"cdromId"+"}", _neturl.PathEscape(parameterValueToString(r.cdromId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -139,11 +132,11 @@ func (a *ServersApiService) DatacentersServersCdromsDeleteExecute(r ApiDatacente localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -162,11 +155,11 @@ func (a *ServersApiService) DatacentersServersCdromsDeleteExecute(r ApiDatacente localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersServersCdromsDelete", } @@ -182,18 +175,17 @@ func (a *ServersApiService) DatacentersServersCdromsDeleteExecute(r ApiDatacente } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarAPIResponse, newErr } @@ -224,7 +216,7 @@ func (r ApiDatacentersServersCdromsFindByIdRequest) XContractNumber(xContractNum return r } -func (r ApiDatacentersServersCdromsFindByIdRequest) Execute() (Image, *APIResponse, error) { +func (r ApiDatacentersServersCdromsFindByIdRequest) Execute() (Image, *shared.APIResponse, error) { return r.ApiService.DatacentersServersCdromsFindByIdExecute(r) } @@ -251,7 +243,7 @@ func (a *ServersApiService) DatacentersServersCdromsFindById(ctx _context.Contex * Execute executes the request * @return Image */ -func (a *ServersApiService) DatacentersServersCdromsFindByIdExecute(r ApiDatacentersServersCdromsFindByIdRequest) (Image, *APIResponse, error) { +func (a *ServersApiService) DatacentersServersCdromsFindByIdExecute(r ApiDatacentersServersCdromsFindByIdRequest) (Image, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -263,33 +255,25 @@ func (a *ServersApiService) DatacentersServersCdromsFindByIdExecute(r ApiDatacen localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ServersApiService.DatacentersServersCdromsFindById") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/servers/{serverId}/cdroms/{cdromId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterToString(r.serverId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"cdromId"+"}", _neturl.PathEscape(parameterToString(r.cdromId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterValueToString(r.serverId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"cdromId"+"}", _neturl.PathEscape(parameterValueToString(r.cdromId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -310,11 +294,11 @@ func (a *ServersApiService) DatacentersServersCdromsFindByIdExecute(r ApiDatacen localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -333,11 +317,11 @@ func (a *ServersApiService) DatacentersServersCdromsFindByIdExecute(r ApiDatacen localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersServersCdromsFindById", } @@ -353,28 +337,26 @@ func (a *ServersApiService) DatacentersServersCdromsFindByIdExecute(r ApiDatacen } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -419,7 +401,7 @@ func (r ApiDatacentersServersCdromsGetRequest) Limit(limit int32) ApiDatacenters // Filters query parameters limit results to those containing a matching value for a specific property. func (r ApiDatacentersServersCdromsGetRequest) Filter(key string, value string) ApiDatacentersServersCdromsGetRequest { - filterKey := fmt.Sprintf(FilterQueryParam, key) + filterKey := fmt.Sprintf("filter.%s", key) r.filters[filterKey] = append(r.filters[filterKey], value) return r } @@ -436,7 +418,7 @@ func (r ApiDatacentersServersCdromsGetRequest) MaxResults(maxResults int32) ApiD return r } -func (r ApiDatacentersServersCdromsGetRequest) Execute() (Cdroms, *APIResponse, error) { +func (r ApiDatacentersServersCdromsGetRequest) Execute() (Cdroms, *shared.APIResponse, error) { return r.ApiService.DatacentersServersCdromsGetExecute(r) } @@ -462,7 +444,7 @@ func (a *ServersApiService) DatacentersServersCdromsGet(ctx _context.Context, da * Execute executes the request * @return Cdroms */ -func (a *ServersApiService) DatacentersServersCdromsGetExecute(r ApiDatacentersServersCdromsGetRequest) (Cdroms, *APIResponse, error) { +func (a *ServersApiService) DatacentersServersCdromsGetExecute(r ApiDatacentersServersCdromsGetRequest) (Cdroms, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -474,48 +456,30 @@ func (a *ServersApiService) DatacentersServersCdromsGetExecute(r ApiDatacentersS localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ServersApiService.DatacentersServersCdromsGet") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/servers/{serverId}/cdroms" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterToString(r.serverId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterValueToString(r.serverId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } if r.offset != nil { - localVarQueryParams.Add("offset", parameterToString(*r.offset, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("offset") - if defaultQueryParam == "" { - localVarQueryParams.Add("offset", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "offset", r.offset, "") } if r.limit != nil { - localVarQueryParams.Add("limit", parameterToString(*r.limit, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("limit") - if defaultQueryParam == "" { - localVarQueryParams.Add("limit", parameterToString(1000, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "") } if r.orderBy != nil { localVarQueryParams.Add("orderBy", parameterToString(*r.orderBy, "")) @@ -549,11 +513,11 @@ func (a *ServersApiService) DatacentersServersCdromsGetExecute(r ApiDatacentersS localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -572,11 +536,11 @@ func (a *ServersApiService) DatacentersServersCdromsGetExecute(r ApiDatacentersS localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersServersCdromsGet", } @@ -592,28 +556,26 @@ func (a *ServersApiService) DatacentersServersCdromsGetExecute(r ApiDatacentersS } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -648,7 +610,7 @@ func (r ApiDatacentersServersCdromsPostRequest) XContractNumber(xContractNumber return r } -func (r ApiDatacentersServersCdromsPostRequest) Execute() (Image, *APIResponse, error) { +func (r ApiDatacentersServersCdromsPostRequest) Execute() (Image, *shared.APIResponse, error) { return r.ApiService.DatacentersServersCdromsPostExecute(r) } @@ -677,7 +639,7 @@ func (a *ServersApiService) DatacentersServersCdromsPost(ctx _context.Context, d * Execute executes the request * @return Image */ -func (a *ServersApiService) DatacentersServersCdromsPostExecute(r ApiDatacentersServersCdromsPostRequest) (Image, *APIResponse, error) { +func (a *ServersApiService) DatacentersServersCdromsPostExecute(r ApiDatacentersServersCdromsPostRequest) (Image, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -689,12 +651,14 @@ func (a *ServersApiService) DatacentersServersCdromsPostExecute(r ApiDatacenters localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ServersApiService.DatacentersServersCdromsPost") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/servers/{serverId}/cdroms" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterToString(r.serverId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterValueToString(r.serverId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -704,20 +668,10 @@ func (a *ServersApiService) DatacentersServersCdromsPostExecute(r ApiDatacenters } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -738,13 +692,13 @@ func (a *ServersApiService) DatacentersServersCdromsPostExecute(r ApiDatacenters localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.cdrom if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -763,11 +717,11 @@ func (a *ServersApiService) DatacentersServersCdromsPostExecute(r ApiDatacenters localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersServersCdromsPost", } @@ -783,28 +737,26 @@ func (a *ServersApiService) DatacentersServersCdromsPostExecute(r ApiDatacenters } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -839,7 +791,7 @@ func (r ApiDatacentersServersDeleteRequest) DeleteVolumes(deleteVolumes bool) Ap return r } -func (r ApiDatacentersServersDeleteRequest) Execute() (*APIResponse, error) { +func (r ApiDatacentersServersDeleteRequest) Execute() (*shared.APIResponse, error) { return r.ApiService.DatacentersServersDeleteExecute(r) } @@ -863,7 +815,7 @@ func (a *ServersApiService) DatacentersServersDelete(ctx _context.Context, datac /* * Execute executes the request */ -func (a *ServersApiService) DatacentersServersDeleteExecute(r ApiDatacentersServersDeleteRequest) (*APIResponse, error) { +func (a *ServersApiService) DatacentersServersDeleteExecute(r ApiDatacentersServersDeleteRequest) (*shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodDelete localVarPostBody interface{} @@ -874,35 +826,27 @@ func (a *ServersApiService) DatacentersServersDeleteExecute(r ApiDatacentersServ localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ServersApiService.DatacentersServersDelete") if err != nil { - return nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/servers/{serverId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterToString(r.serverId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterValueToString(r.serverId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } if r.deleteVolumes != nil { - localVarQueryParams.Add("deleteVolumes", parameterToString(*r.deleteVolumes, "")) + parameterAddToHeaderOrQuery(localVarQueryParams, "deleteVolumes", r.deleteVolumes, "") } // to determine the Content-Type header @@ -923,11 +867,11 @@ func (a *ServersApiService) DatacentersServersDeleteExecute(r ApiDatacentersServ localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -946,11 +890,11 @@ func (a *ServersApiService) DatacentersServersDeleteExecute(r ApiDatacentersServ localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersServersDelete", } @@ -966,18 +910,17 @@ func (a *ServersApiService) DatacentersServersDeleteExecute(r ApiDatacentersServ } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarAPIResponse, newErr } @@ -1007,7 +950,7 @@ func (r ApiDatacentersServersFindByIdRequest) XContractNumber(xContractNumber in return r } -func (r ApiDatacentersServersFindByIdRequest) Execute() (Server, *APIResponse, error) { +func (r ApiDatacentersServersFindByIdRequest) Execute() (Server, *shared.APIResponse, error) { return r.ApiService.DatacentersServersFindByIdExecute(r) } @@ -1032,7 +975,7 @@ func (a *ServersApiService) DatacentersServersFindById(ctx _context.Context, dat * Execute executes the request * @return Server */ -func (a *ServersApiService) DatacentersServersFindByIdExecute(r ApiDatacentersServersFindByIdRequest) (Server, *APIResponse, error) { +func (a *ServersApiService) DatacentersServersFindByIdExecute(r ApiDatacentersServersFindByIdRequest) (Server, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -1044,32 +987,24 @@ func (a *ServersApiService) DatacentersServersFindByIdExecute(r ApiDatacentersSe localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ServersApiService.DatacentersServersFindById") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/servers/{serverId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterToString(r.serverId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterValueToString(r.serverId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -1090,11 +1025,11 @@ func (a *ServersApiService) DatacentersServersFindByIdExecute(r ApiDatacentersSe localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -1113,11 +1048,11 @@ func (a *ServersApiService) DatacentersServersFindByIdExecute(r ApiDatacentersSe localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersServersFindById", } @@ -1133,28 +1068,26 @@ func (a *ServersApiService) DatacentersServersFindByIdExecute(r ApiDatacentersSe } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -1198,7 +1131,7 @@ func (r ApiDatacentersServersGetRequest) Limit(limit int32) ApiDatacentersServer // Filters query parameters limit results to those containing a matching value for a specific property. func (r ApiDatacentersServersGetRequest) Filter(key string, value string) ApiDatacentersServersGetRequest { - filterKey := fmt.Sprintf(FilterQueryParam, key) + filterKey := fmt.Sprintf("filter.%s", key) r.filters[filterKey] = append(r.filters[filterKey], value) return r } @@ -1215,7 +1148,7 @@ func (r ApiDatacentersServersGetRequest) MaxResults(maxResults int32) ApiDatacen return r } -func (r ApiDatacentersServersGetRequest) Execute() (Servers, *APIResponse, error) { +func (r ApiDatacentersServersGetRequest) Execute() (Servers, *shared.APIResponse, error) { return r.ApiService.DatacentersServersGetExecute(r) } @@ -1239,7 +1172,7 @@ func (a *ServersApiService) DatacentersServersGet(ctx _context.Context, datacent * Execute executes the request * @return Servers */ -func (a *ServersApiService) DatacentersServersGetExecute(r ApiDatacentersServersGetRequest) (Servers, *APIResponse, error) { +func (a *ServersApiService) DatacentersServersGetExecute(r ApiDatacentersServersGetRequest) (Servers, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -1251,47 +1184,29 @@ func (a *ServersApiService) DatacentersServersGetExecute(r ApiDatacentersServers localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ServersApiService.DatacentersServersGet") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/servers" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } if r.offset != nil { - localVarQueryParams.Add("offset", parameterToString(*r.offset, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("offset") - if defaultQueryParam == "" { - localVarQueryParams.Add("offset", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "offset", r.offset, "") } if r.limit != nil { - localVarQueryParams.Add("limit", parameterToString(*r.limit, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("limit") - if defaultQueryParam == "" { - localVarQueryParams.Add("limit", parameterToString(1000, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "") } if r.orderBy != nil { localVarQueryParams.Add("orderBy", parameterToString(*r.orderBy, "")) @@ -1325,11 +1240,11 @@ func (a *ServersApiService) DatacentersServersGetExecute(r ApiDatacentersServers localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -1348,11 +1263,11 @@ func (a *ServersApiService) DatacentersServersGetExecute(r ApiDatacentersServers localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersServersGet", } @@ -1368,28 +1283,26 @@ func (a *ServersApiService) DatacentersServersGetExecute(r ApiDatacentersServers } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -1424,7 +1337,7 @@ func (r ApiDatacentersServersPatchRequest) XContractNumber(xContractNumber int32 return r } -func (r ApiDatacentersServersPatchRequest) Execute() (Server, *APIResponse, error) { +func (r ApiDatacentersServersPatchRequest) Execute() (Server, *shared.APIResponse, error) { return r.ApiService.DatacentersServersPatchExecute(r) } @@ -1449,7 +1362,7 @@ func (a *ServersApiService) DatacentersServersPatch(ctx _context.Context, datace * Execute executes the request * @return Server */ -func (a *ServersApiService) DatacentersServersPatchExecute(r ApiDatacentersServersPatchRequest) (Server, *APIResponse, error) { +func (a *ServersApiService) DatacentersServersPatchExecute(r ApiDatacentersServersPatchRequest) (Server, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPatch localVarPostBody interface{} @@ -1461,12 +1374,14 @@ func (a *ServersApiService) DatacentersServersPatchExecute(r ApiDatacentersServe localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ServersApiService.DatacentersServersPatch") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/servers/{serverId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterToString(r.serverId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterValueToString(r.serverId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -1476,20 +1391,10 @@ func (a *ServersApiService) DatacentersServersPatchExecute(r ApiDatacentersServe } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -1510,13 +1415,13 @@ func (a *ServersApiService) DatacentersServersPatchExecute(r ApiDatacentersServe localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.server if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -1535,11 +1440,11 @@ func (a *ServersApiService) DatacentersServersPatchExecute(r ApiDatacentersServe localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersServersPatch", } @@ -1555,28 +1460,26 @@ func (a *ServersApiService) DatacentersServersPatchExecute(r ApiDatacentersServe } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -1610,7 +1513,7 @@ func (r ApiDatacentersServersPostRequest) XContractNumber(xContractNumber int32) return r } -func (r ApiDatacentersServersPostRequest) Execute() (Server, *APIResponse, error) { +func (r ApiDatacentersServersPostRequest) Execute() (Server, *shared.APIResponse, error) { return r.ApiService.DatacentersServersPostExecute(r) } @@ -1633,7 +1536,7 @@ func (a *ServersApiService) DatacentersServersPost(ctx _context.Context, datacen * Execute executes the request * @return Server */ -func (a *ServersApiService) DatacentersServersPostExecute(r ApiDatacentersServersPostRequest) (Server, *APIResponse, error) { +func (a *ServersApiService) DatacentersServersPostExecute(r ApiDatacentersServersPostRequest) (Server, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -1645,11 +1548,13 @@ func (a *ServersApiService) DatacentersServersPostExecute(r ApiDatacentersServer localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ServersApiService.DatacentersServersPost") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/servers" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -1659,20 +1564,10 @@ func (a *ServersApiService) DatacentersServersPostExecute(r ApiDatacentersServer } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -1693,13 +1588,13 @@ func (a *ServersApiService) DatacentersServersPostExecute(r ApiDatacentersServer localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.server if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -1718,11 +1613,11 @@ func (a *ServersApiService) DatacentersServersPostExecute(r ApiDatacentersServer localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersServersPost", } @@ -1738,28 +1633,26 @@ func (a *ServersApiService) DatacentersServersPostExecute(r ApiDatacentersServer } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -1794,7 +1687,7 @@ func (r ApiDatacentersServersPutRequest) XContractNumber(xContractNumber int32) return r } -func (r ApiDatacentersServersPutRequest) Execute() (Server, *APIResponse, error) { +func (r ApiDatacentersServersPutRequest) Execute() (Server, *shared.APIResponse, error) { return r.ApiService.DatacentersServersPutExecute(r) } @@ -1821,7 +1714,7 @@ func (a *ServersApiService) DatacentersServersPut(ctx _context.Context, datacent * Execute executes the request * @return Server */ -func (a *ServersApiService) DatacentersServersPutExecute(r ApiDatacentersServersPutRequest) (Server, *APIResponse, error) { +func (a *ServersApiService) DatacentersServersPutExecute(r ApiDatacentersServersPutRequest) (Server, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPut localVarPostBody interface{} @@ -1833,12 +1726,14 @@ func (a *ServersApiService) DatacentersServersPutExecute(r ApiDatacentersServers localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ServersApiService.DatacentersServersPut") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/servers/{serverId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterToString(r.serverId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterValueToString(r.serverId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -1848,20 +1743,10 @@ func (a *ServersApiService) DatacentersServersPutExecute(r ApiDatacentersServers } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -1882,13 +1767,13 @@ func (a *ServersApiService) DatacentersServersPutExecute(r ApiDatacentersServers localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.server if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -1907,11 +1792,11 @@ func (a *ServersApiService) DatacentersServersPutExecute(r ApiDatacentersServers localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersServersPut", } @@ -1927,28 +1812,26 @@ func (a *ServersApiService) DatacentersServersPutExecute(r ApiDatacentersServers } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -1978,7 +1861,7 @@ func (r ApiDatacentersServersRebootPostRequest) XContractNumber(xContractNumber return r } -func (r ApiDatacentersServersRebootPostRequest) Execute() (*APIResponse, error) { +func (r ApiDatacentersServersRebootPostRequest) Execute() (*shared.APIResponse, error) { return r.ApiService.DatacentersServersRebootPostExecute(r) } @@ -2002,7 +1885,7 @@ func (a *ServersApiService) DatacentersServersRebootPost(ctx _context.Context, d /* * Execute executes the request */ -func (a *ServersApiService) DatacentersServersRebootPostExecute(r ApiDatacentersServersRebootPostRequest) (*APIResponse, error) { +func (a *ServersApiService) DatacentersServersRebootPostExecute(r ApiDatacentersServersRebootPostRequest) (*shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -2013,32 +1896,24 @@ func (a *ServersApiService) DatacentersServersRebootPostExecute(r ApiDatacenters localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ServersApiService.DatacentersServersRebootPost") if err != nil { - return nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/servers/{serverId}/reboot" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterToString(r.serverId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterValueToString(r.serverId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -2059,11 +1934,11 @@ func (a *ServersApiService) DatacentersServersRebootPostExecute(r ApiDatacenters localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -2082,11 +1957,11 @@ func (a *ServersApiService) DatacentersServersRebootPostExecute(r ApiDatacenters localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersServersRebootPost", } @@ -2102,18 +1977,17 @@ func (a *ServersApiService) DatacentersServersRebootPostExecute(r ApiDatacenters } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarAPIResponse, newErr } @@ -2148,7 +2022,7 @@ func (r ApiDatacentersServersRemoteConsoleGetRequest) XContractNumber(xContractN // Filters query parameters limit results to those containing a matching value for a specific property. func (r ApiDatacentersServersRemoteConsoleGetRequest) Filter(key string, value string) ApiDatacentersServersRemoteConsoleGetRequest { - filterKey := fmt.Sprintf(FilterQueryParam, key) + filterKey := fmt.Sprintf("filter.%s", key) r.filters[filterKey] = append(r.filters[filterKey], value) return r } @@ -2165,7 +2039,7 @@ func (r ApiDatacentersServersRemoteConsoleGetRequest) MaxResults(maxResults int3 return r } -func (r ApiDatacentersServersRemoteConsoleGetRequest) Execute() (RemoteConsoleUrl, *APIResponse, error) { +func (r ApiDatacentersServersRemoteConsoleGetRequest) Execute() (RemoteConsoleUrl, *shared.APIResponse, error) { return r.ApiService.DatacentersServersRemoteConsoleGetExecute(r) } @@ -2191,7 +2065,7 @@ func (a *ServersApiService) DatacentersServersRemoteConsoleGet(ctx _context.Cont * Execute executes the request * @return RemoteConsoleUrl */ -func (a *ServersApiService) DatacentersServersRemoteConsoleGetExecute(r ApiDatacentersServersRemoteConsoleGetRequest) (RemoteConsoleUrl, *APIResponse, error) { +func (a *ServersApiService) DatacentersServersRemoteConsoleGetExecute(r ApiDatacentersServersRemoteConsoleGetRequest) (RemoteConsoleUrl, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -2203,32 +2077,24 @@ func (a *ServersApiService) DatacentersServersRemoteConsoleGetExecute(r ApiDatac localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ServersApiService.DatacentersServersRemoteConsoleGet") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/servers/{serverId}/remoteconsole" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterToString(r.serverId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterValueToString(r.serverId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } if r.orderBy != nil { localVarQueryParams.Add("orderBy", parameterToString(*r.orderBy, "")) @@ -2262,11 +2128,11 @@ func (a *ServersApiService) DatacentersServersRemoteConsoleGetExecute(r ApiDatac localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -2285,11 +2151,11 @@ func (a *ServersApiService) DatacentersServersRemoteConsoleGetExecute(r ApiDatac localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersServersRemoteConsoleGet", } @@ -2305,28 +2171,26 @@ func (a *ServersApiService) DatacentersServersRemoteConsoleGetExecute(r ApiDatac } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -2356,7 +2220,7 @@ func (r ApiDatacentersServersResumePostRequest) XContractNumber(xContractNumber return r } -func (r ApiDatacentersServersResumePostRequest) Execute() (*APIResponse, error) { +func (r ApiDatacentersServersResumePostRequest) Execute() (*shared.APIResponse, error) { return r.ApiService.DatacentersServersResumePostExecute(r) } @@ -2384,7 +2248,7 @@ func (a *ServersApiService) DatacentersServersResumePost(ctx _context.Context, d /* * Execute executes the request */ -func (a *ServersApiService) DatacentersServersResumePostExecute(r ApiDatacentersServersResumePostRequest) (*APIResponse, error) { +func (a *ServersApiService) DatacentersServersResumePostExecute(r ApiDatacentersServersResumePostRequest) (*shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -2395,32 +2259,24 @@ func (a *ServersApiService) DatacentersServersResumePostExecute(r ApiDatacenters localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ServersApiService.DatacentersServersResumePost") if err != nil { - return nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/servers/{serverId}/resume" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterToString(r.serverId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterValueToString(r.serverId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -2441,11 +2297,11 @@ func (a *ServersApiService) DatacentersServersResumePostExecute(r ApiDatacenters localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -2464,11 +2320,11 @@ func (a *ServersApiService) DatacentersServersResumePostExecute(r ApiDatacenters localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersServersResumePost", } @@ -2484,18 +2340,17 @@ func (a *ServersApiService) DatacentersServersResumePostExecute(r ApiDatacenters } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarAPIResponse, newErr } @@ -2525,7 +2380,7 @@ func (r ApiDatacentersServersStartPostRequest) XContractNumber(xContractNumber i return r } -func (r ApiDatacentersServersStartPostRequest) Execute() (*APIResponse, error) { +func (r ApiDatacentersServersStartPostRequest) Execute() (*shared.APIResponse, error) { return r.ApiService.DatacentersServersStartPostExecute(r) } @@ -2557,7 +2412,7 @@ func (a *ServersApiService) DatacentersServersStartPost(ctx _context.Context, da /* * Execute executes the request */ -func (a *ServersApiService) DatacentersServersStartPostExecute(r ApiDatacentersServersStartPostRequest) (*APIResponse, error) { +func (a *ServersApiService) DatacentersServersStartPostExecute(r ApiDatacentersServersStartPostRequest) (*shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -2568,32 +2423,24 @@ func (a *ServersApiService) DatacentersServersStartPostExecute(r ApiDatacentersS localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ServersApiService.DatacentersServersStartPost") if err != nil { - return nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/servers/{serverId}/start" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterToString(r.serverId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterValueToString(r.serverId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -2614,11 +2461,11 @@ func (a *ServersApiService) DatacentersServersStartPostExecute(r ApiDatacentersS localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -2637,11 +2484,11 @@ func (a *ServersApiService) DatacentersServersStartPostExecute(r ApiDatacentersS localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersServersStartPost", } @@ -2657,18 +2504,17 @@ func (a *ServersApiService) DatacentersServersStartPostExecute(r ApiDatacentersS } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarAPIResponse, newErr } @@ -2698,7 +2544,7 @@ func (r ApiDatacentersServersStopPostRequest) XContractNumber(xContractNumber in return r } -func (r ApiDatacentersServersStopPostRequest) Execute() (*APIResponse, error) { +func (r ApiDatacentersServersStopPostRequest) Execute() (*shared.APIResponse, error) { return r.ApiService.DatacentersServersStopPostExecute(r) } @@ -2730,7 +2576,7 @@ func (a *ServersApiService) DatacentersServersStopPost(ctx _context.Context, dat /* * Execute executes the request */ -func (a *ServersApiService) DatacentersServersStopPostExecute(r ApiDatacentersServersStopPostRequest) (*APIResponse, error) { +func (a *ServersApiService) DatacentersServersStopPostExecute(r ApiDatacentersServersStopPostRequest) (*shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -2741,32 +2587,24 @@ func (a *ServersApiService) DatacentersServersStopPostExecute(r ApiDatacentersSe localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ServersApiService.DatacentersServersStopPost") if err != nil { - return nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/servers/{serverId}/stop" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterToString(r.serverId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterValueToString(r.serverId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -2787,11 +2625,11 @@ func (a *ServersApiService) DatacentersServersStopPostExecute(r ApiDatacentersSe localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -2810,11 +2648,11 @@ func (a *ServersApiService) DatacentersServersStopPostExecute(r ApiDatacentersSe localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersServersStopPost", } @@ -2830,18 +2668,17 @@ func (a *ServersApiService) DatacentersServersStopPostExecute(r ApiDatacentersSe } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarAPIResponse, newErr } @@ -2871,7 +2708,7 @@ func (r ApiDatacentersServersSuspendPostRequest) XContractNumber(xContractNumber return r } -func (r ApiDatacentersServersSuspendPostRequest) Execute() (*APIResponse, error) { +func (r ApiDatacentersServersSuspendPostRequest) Execute() (*shared.APIResponse, error) { return r.ApiService.DatacentersServersSuspendPostExecute(r) } @@ -2899,7 +2736,7 @@ func (a *ServersApiService) DatacentersServersSuspendPost(ctx _context.Context, /* * Execute executes the request */ -func (a *ServersApiService) DatacentersServersSuspendPostExecute(r ApiDatacentersServersSuspendPostRequest) (*APIResponse, error) { +func (a *ServersApiService) DatacentersServersSuspendPostExecute(r ApiDatacentersServersSuspendPostRequest) (*shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -2910,32 +2747,24 @@ func (a *ServersApiService) DatacentersServersSuspendPostExecute(r ApiDatacenter localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ServersApiService.DatacentersServersSuspendPost") if err != nil { - return nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/servers/{serverId}/suspend" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterToString(r.serverId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterValueToString(r.serverId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -2956,11 +2785,11 @@ func (a *ServersApiService) DatacentersServersSuspendPostExecute(r ApiDatacenter localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -2979,11 +2808,11 @@ func (a *ServersApiService) DatacentersServersSuspendPostExecute(r ApiDatacenter localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersServersSuspendPost", } @@ -2999,18 +2828,17 @@ func (a *ServersApiService) DatacentersServersSuspendPostExecute(r ApiDatacenter } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarAPIResponse, newErr } @@ -3045,7 +2873,7 @@ func (r ApiDatacentersServersTokenGetRequest) XContractNumber(xContractNumber in // Filters query parameters limit results to those containing a matching value for a specific property. func (r ApiDatacentersServersTokenGetRequest) Filter(key string, value string) ApiDatacentersServersTokenGetRequest { - filterKey := fmt.Sprintf(FilterQueryParam, key) + filterKey := fmt.Sprintf("filter.%s", key) r.filters[filterKey] = append(r.filters[filterKey], value) return r } @@ -3062,7 +2890,7 @@ func (r ApiDatacentersServersTokenGetRequest) MaxResults(maxResults int32) ApiDa return r } -func (r ApiDatacentersServersTokenGetRequest) Execute() (Token, *APIResponse, error) { +func (r ApiDatacentersServersTokenGetRequest) Execute() (Token, *shared.APIResponse, error) { return r.ApiService.DatacentersServersTokenGetExecute(r) } @@ -3088,7 +2916,7 @@ func (a *ServersApiService) DatacentersServersTokenGet(ctx _context.Context, dat * Execute executes the request * @return Token */ -func (a *ServersApiService) DatacentersServersTokenGetExecute(r ApiDatacentersServersTokenGetRequest) (Token, *APIResponse, error) { +func (a *ServersApiService) DatacentersServersTokenGetExecute(r ApiDatacentersServersTokenGetRequest) (Token, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -3100,32 +2928,24 @@ func (a *ServersApiService) DatacentersServersTokenGetExecute(r ApiDatacentersSe localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ServersApiService.DatacentersServersTokenGet") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/servers/{serverId}/token" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterToString(r.serverId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterValueToString(r.serverId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } if r.orderBy != nil { localVarQueryParams.Add("orderBy", parameterToString(*r.orderBy, "")) @@ -3159,11 +2979,11 @@ func (a *ServersApiService) DatacentersServersTokenGetExecute(r ApiDatacentersSe localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -3182,11 +3002,11 @@ func (a *ServersApiService) DatacentersServersTokenGetExecute(r ApiDatacentersSe localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersServersTokenGet", } @@ -3202,28 +3022,26 @@ func (a *ServersApiService) DatacentersServersTokenGetExecute(r ApiDatacentersSe } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -3253,7 +3071,7 @@ func (r ApiDatacentersServersUpgradePostRequest) XContractNumber(xContractNumber return r } -func (r ApiDatacentersServersUpgradePostRequest) Execute() (*APIResponse, error) { +func (r ApiDatacentersServersUpgradePostRequest) Execute() (*shared.APIResponse, error) { return r.ApiService.DatacentersServersUpgradePostExecute(r) } @@ -3277,7 +3095,7 @@ func (a *ServersApiService) DatacentersServersUpgradePost(ctx _context.Context, /* * Execute executes the request */ -func (a *ServersApiService) DatacentersServersUpgradePostExecute(r ApiDatacentersServersUpgradePostRequest) (*APIResponse, error) { +func (a *ServersApiService) DatacentersServersUpgradePostExecute(r ApiDatacentersServersUpgradePostRequest) (*shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -3288,32 +3106,24 @@ func (a *ServersApiService) DatacentersServersUpgradePostExecute(r ApiDatacenter localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ServersApiService.DatacentersServersUpgradePost") if err != nil { - return nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/servers/{serverId}/upgrade" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterToString(r.serverId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterValueToString(r.serverId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -3334,11 +3144,11 @@ func (a *ServersApiService) DatacentersServersUpgradePostExecute(r ApiDatacenter localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -3357,11 +3167,11 @@ func (a *ServersApiService) DatacentersServersUpgradePostExecute(r ApiDatacenter localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersServersUpgradePost", } @@ -3377,18 +3187,17 @@ func (a *ServersApiService) DatacentersServersUpgradePostExecute(r ApiDatacenter } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarAPIResponse, newErr } @@ -3419,7 +3228,7 @@ func (r ApiDatacentersServersVolumesDeleteRequest) XContractNumber(xContractNumb return r } -func (r ApiDatacentersServersVolumesDeleteRequest) Execute() (*APIResponse, error) { +func (r ApiDatacentersServersVolumesDeleteRequest) Execute() (*shared.APIResponse, error) { return r.ApiService.DatacentersServersVolumesDeleteExecute(r) } @@ -3447,7 +3256,7 @@ func (a *ServersApiService) DatacentersServersVolumesDelete(ctx _context.Context /* * Execute executes the request */ -func (a *ServersApiService) DatacentersServersVolumesDeleteExecute(r ApiDatacentersServersVolumesDeleteRequest) (*APIResponse, error) { +func (a *ServersApiService) DatacentersServersVolumesDeleteExecute(r ApiDatacentersServersVolumesDeleteRequest) (*shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodDelete localVarPostBody interface{} @@ -3458,33 +3267,25 @@ func (a *ServersApiService) DatacentersServersVolumesDeleteExecute(r ApiDatacent localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ServersApiService.DatacentersServersVolumesDelete") if err != nil { - return nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/servers/{serverId}/volumes/{volumeId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterToString(r.serverId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"volumeId"+"}", _neturl.PathEscape(parameterToString(r.volumeId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterValueToString(r.serverId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"volumeId"+"}", _neturl.PathEscape(parameterValueToString(r.volumeId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -3505,11 +3306,11 @@ func (a *ServersApiService) DatacentersServersVolumesDeleteExecute(r ApiDatacent localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -3528,11 +3329,11 @@ func (a *ServersApiService) DatacentersServersVolumesDeleteExecute(r ApiDatacent localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersServersVolumesDelete", } @@ -3548,18 +3349,17 @@ func (a *ServersApiService) DatacentersServersVolumesDeleteExecute(r ApiDatacent } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarAPIResponse, newErr } @@ -3590,7 +3390,7 @@ func (r ApiDatacentersServersVolumesFindByIdRequest) XContractNumber(xContractNu return r } -func (r ApiDatacentersServersVolumesFindByIdRequest) Execute() (Volume, *APIResponse, error) { +func (r ApiDatacentersServersVolumesFindByIdRequest) Execute() (Volume, *shared.APIResponse, error) { return r.ApiService.DatacentersServersVolumesFindByIdExecute(r) } @@ -3617,7 +3417,7 @@ func (a *ServersApiService) DatacentersServersVolumesFindById(ctx _context.Conte * Execute executes the request * @return Volume */ -func (a *ServersApiService) DatacentersServersVolumesFindByIdExecute(r ApiDatacentersServersVolumesFindByIdRequest) (Volume, *APIResponse, error) { +func (a *ServersApiService) DatacentersServersVolumesFindByIdExecute(r ApiDatacentersServersVolumesFindByIdRequest) (Volume, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -3629,33 +3429,25 @@ func (a *ServersApiService) DatacentersServersVolumesFindByIdExecute(r ApiDatace localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ServersApiService.DatacentersServersVolumesFindById") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/servers/{serverId}/volumes/{volumeId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterToString(r.serverId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"volumeId"+"}", _neturl.PathEscape(parameterToString(r.volumeId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterValueToString(r.serverId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"volumeId"+"}", _neturl.PathEscape(parameterValueToString(r.volumeId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -3676,11 +3468,11 @@ func (a *ServersApiService) DatacentersServersVolumesFindByIdExecute(r ApiDatace localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -3699,11 +3491,11 @@ func (a *ServersApiService) DatacentersServersVolumesFindByIdExecute(r ApiDatace localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersServersVolumesFindById", } @@ -3719,28 +3511,26 @@ func (a *ServersApiService) DatacentersServersVolumesFindByIdExecute(r ApiDatace } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -3785,7 +3575,7 @@ func (r ApiDatacentersServersVolumesGetRequest) Limit(limit int32) ApiDatacenter // Filters query parameters limit results to those containing a matching value for a specific property. func (r ApiDatacentersServersVolumesGetRequest) Filter(key string, value string) ApiDatacentersServersVolumesGetRequest { - filterKey := fmt.Sprintf(FilterQueryParam, key) + filterKey := fmt.Sprintf("filter.%s", key) r.filters[filterKey] = append(r.filters[filterKey], value) return r } @@ -3802,7 +3592,7 @@ func (r ApiDatacentersServersVolumesGetRequest) MaxResults(maxResults int32) Api return r } -func (r ApiDatacentersServersVolumesGetRequest) Execute() (AttachedVolumes, *APIResponse, error) { +func (r ApiDatacentersServersVolumesGetRequest) Execute() (AttachedVolumes, *shared.APIResponse, error) { return r.ApiService.DatacentersServersVolumesGetExecute(r) } @@ -3828,7 +3618,7 @@ func (a *ServersApiService) DatacentersServersVolumesGet(ctx _context.Context, d * Execute executes the request * @return AttachedVolumes */ -func (a *ServersApiService) DatacentersServersVolumesGetExecute(r ApiDatacentersServersVolumesGetRequest) (AttachedVolumes, *APIResponse, error) { +func (a *ServersApiService) DatacentersServersVolumesGetExecute(r ApiDatacentersServersVolumesGetRequest) (AttachedVolumes, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -3840,48 +3630,30 @@ func (a *ServersApiService) DatacentersServersVolumesGetExecute(r ApiDatacenters localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ServersApiService.DatacentersServersVolumesGet") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/servers/{serverId}/volumes" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterToString(r.serverId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterValueToString(r.serverId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } if r.offset != nil { - localVarQueryParams.Add("offset", parameterToString(*r.offset, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("offset") - if defaultQueryParam == "" { - localVarQueryParams.Add("offset", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "offset", r.offset, "") } if r.limit != nil { - localVarQueryParams.Add("limit", parameterToString(*r.limit, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("limit") - if defaultQueryParam == "" { - localVarQueryParams.Add("limit", parameterToString(1000, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "") } if r.orderBy != nil { localVarQueryParams.Add("orderBy", parameterToString(*r.orderBy, "")) @@ -3915,11 +3687,11 @@ func (a *ServersApiService) DatacentersServersVolumesGetExecute(r ApiDatacenters localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -3938,11 +3710,11 @@ func (a *ServersApiService) DatacentersServersVolumesGetExecute(r ApiDatacenters localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersServersVolumesGet", } @@ -3958,28 +3730,26 @@ func (a *ServersApiService) DatacentersServersVolumesGetExecute(r ApiDatacenters } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -4014,7 +3784,7 @@ func (r ApiDatacentersServersVolumesPostRequest) XContractNumber(xContractNumber return r } -func (r ApiDatacentersServersVolumesPostRequest) Execute() (Volume, *APIResponse, error) { +func (r ApiDatacentersServersVolumesPostRequest) Execute() (Volume, *shared.APIResponse, error) { return r.ApiService.DatacentersServersVolumesPostExecute(r) } @@ -4045,7 +3815,7 @@ func (a *ServersApiService) DatacentersServersVolumesPost(ctx _context.Context, * Execute executes the request * @return Volume */ -func (a *ServersApiService) DatacentersServersVolumesPostExecute(r ApiDatacentersServersVolumesPostRequest) (Volume, *APIResponse, error) { +func (a *ServersApiService) DatacentersServersVolumesPostExecute(r ApiDatacentersServersVolumesPostRequest) (Volume, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -4057,12 +3827,14 @@ func (a *ServersApiService) DatacentersServersVolumesPostExecute(r ApiDatacenter localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ServersApiService.DatacentersServersVolumesPost") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/servers/{serverId}/volumes" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterToString(r.serverId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"serverId"+"}", _neturl.PathEscape(parameterValueToString(r.serverId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -4072,20 +3844,10 @@ func (a *ServersApiService) DatacentersServersVolumesPostExecute(r ApiDatacenter } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -4106,13 +3868,13 @@ func (a *ServersApiService) DatacentersServersVolumesPostExecute(r ApiDatacenter localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.volume if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -4131,11 +3893,11 @@ func (a *ServersApiService) DatacentersServersVolumesPostExecute(r ApiDatacenter localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersServersVolumesPost", } @@ -4151,28 +3913,26 @@ func (a *ServersApiService) DatacentersServersVolumesPostExecute(r ApiDatacenter } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/api_snapshots.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/api_snapshots.go similarity index 77% rename from vendor/github.com/ionos-cloud/sdk-go/v6/api_snapshots.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/api_snapshots.go index b5cf94a33..23e65503d 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/api_snapshots.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/api_snapshots.go @@ -13,6 +13,7 @@ package ionoscloud import ( _context "context" "fmt" + "github.com/ionos-cloud/sdk-go-bundle/shared" "io" _nethttp "net/http" _neturl "net/url" @@ -49,7 +50,7 @@ func (r ApiSnapshotsDeleteRequest) XContractNumber(xContractNumber int32) ApiSna return r } -func (r ApiSnapshotsDeleteRequest) Execute() (*APIResponse, error) { +func (r ApiSnapshotsDeleteRequest) Execute() (*shared.APIResponse, error) { return r.ApiService.SnapshotsDeleteExecute(r) } @@ -71,7 +72,7 @@ func (a *SnapshotsApiService) SnapshotsDelete(ctx _context.Context, snapshotId s /* * Execute executes the request */ -func (a *SnapshotsApiService) SnapshotsDeleteExecute(r ApiSnapshotsDeleteRequest) (*APIResponse, error) { +func (a *SnapshotsApiService) SnapshotsDeleteExecute(r ApiSnapshotsDeleteRequest) (*shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodDelete localVarPostBody interface{} @@ -82,31 +83,23 @@ func (a *SnapshotsApiService) SnapshotsDeleteExecute(r ApiSnapshotsDeleteRequest localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SnapshotsApiService.SnapshotsDelete") if err != nil { - return nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return nil, gerr } localVarPath := localBasePath + "/snapshots/{snapshotId}" - localVarPath = strings.Replace(localVarPath, "{"+"snapshotId"+"}", _neturl.PathEscape(parameterToString(r.snapshotId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"snapshotId"+"}", _neturl.PathEscape(parameterValueToString(r.snapshotId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -127,11 +120,11 @@ func (a *SnapshotsApiService) SnapshotsDeleteExecute(r ApiSnapshotsDeleteRequest localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -150,11 +143,11 @@ func (a *SnapshotsApiService) SnapshotsDeleteExecute(r ApiSnapshotsDeleteRequest localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "SnapshotsDelete", } @@ -170,18 +163,17 @@ func (a *SnapshotsApiService) SnapshotsDeleteExecute(r ApiSnapshotsDeleteRequest } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarAPIResponse, newErr } @@ -210,7 +202,7 @@ func (r ApiSnapshotsFindByIdRequest) XContractNumber(xContractNumber int32) ApiS return r } -func (r ApiSnapshotsFindByIdRequest) Execute() (Snapshot, *APIResponse, error) { +func (r ApiSnapshotsFindByIdRequest) Execute() (Snapshot, *shared.APIResponse, error) { return r.ApiService.SnapshotsFindByIdExecute(r) } @@ -233,7 +225,7 @@ func (a *SnapshotsApiService) SnapshotsFindById(ctx _context.Context, snapshotId * Execute executes the request * @return Snapshot */ -func (a *SnapshotsApiService) SnapshotsFindByIdExecute(r ApiSnapshotsFindByIdRequest) (Snapshot, *APIResponse, error) { +func (a *SnapshotsApiService) SnapshotsFindByIdExecute(r ApiSnapshotsFindByIdRequest) (Snapshot, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -245,31 +237,23 @@ func (a *SnapshotsApiService) SnapshotsFindByIdExecute(r ApiSnapshotsFindByIdReq localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SnapshotsApiService.SnapshotsFindById") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/snapshots/{snapshotId}" - localVarPath = strings.Replace(localVarPath, "{"+"snapshotId"+"}", _neturl.PathEscape(parameterToString(r.snapshotId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"snapshotId"+"}", _neturl.PathEscape(parameterValueToString(r.snapshotId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -290,11 +274,11 @@ func (a *SnapshotsApiService) SnapshotsFindByIdExecute(r ApiSnapshotsFindByIdReq localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -313,11 +297,11 @@ func (a *SnapshotsApiService) SnapshotsFindByIdExecute(r ApiSnapshotsFindByIdReq localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "SnapshotsFindById", } @@ -333,28 +317,26 @@ func (a *SnapshotsApiService) SnapshotsFindByIdExecute(r ApiSnapshotsFindByIdReq } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -387,7 +369,7 @@ func (r ApiSnapshotsGetRequest) XContractNumber(xContractNumber int32) ApiSnapsh // Filters query parameters limit results to those containing a matching value for a specific property. func (r ApiSnapshotsGetRequest) Filter(key string, value string) ApiSnapshotsGetRequest { - filterKey := fmt.Sprintf(FilterQueryParam, key) + filterKey := fmt.Sprintf("filter.%s", key) r.filters[filterKey] = append(r.filters[filterKey], value) return r } @@ -404,7 +386,7 @@ func (r ApiSnapshotsGetRequest) MaxResults(maxResults int32) ApiSnapshotsGetRequ return r } -func (r ApiSnapshotsGetRequest) Execute() (Snapshots, *APIResponse, error) { +func (r ApiSnapshotsGetRequest) Execute() (Snapshots, *shared.APIResponse, error) { return r.ApiService.SnapshotsGetExecute(r) } @@ -426,7 +408,7 @@ func (a *SnapshotsApiService) SnapshotsGet(ctx _context.Context) ApiSnapshotsGet * Execute executes the request * @return Snapshots */ -func (a *SnapshotsApiService) SnapshotsGetExecute(r ApiSnapshotsGetRequest) (Snapshots, *APIResponse, error) { +func (a *SnapshotsApiService) SnapshotsGetExecute(r ApiSnapshotsGetRequest) (Snapshots, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -438,7 +420,9 @@ func (a *SnapshotsApiService) SnapshotsGetExecute(r ApiSnapshotsGetRequest) (Sna localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SnapshotsApiService.SnapshotsGet") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/snapshots" @@ -448,20 +432,10 @@ func (a *SnapshotsApiService) SnapshotsGetExecute(r ApiSnapshotsGetRequest) (Sna localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } if r.orderBy != nil { localVarQueryParams.Add("orderBy", parameterToString(*r.orderBy, "")) @@ -495,11 +469,11 @@ func (a *SnapshotsApiService) SnapshotsGetExecute(r ApiSnapshotsGetRequest) (Sna localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -518,11 +492,11 @@ func (a *SnapshotsApiService) SnapshotsGetExecute(r ApiSnapshotsGetRequest) (Sna localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "SnapshotsGet", } @@ -538,28 +512,26 @@ func (a *SnapshotsApiService) SnapshotsGetExecute(r ApiSnapshotsGetRequest) (Sna } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -593,7 +565,7 @@ func (r ApiSnapshotsPatchRequest) XContractNumber(xContractNumber int32) ApiSnap return r } -func (r ApiSnapshotsPatchRequest) Execute() (Snapshot, *APIResponse, error) { +func (r ApiSnapshotsPatchRequest) Execute() (Snapshot, *shared.APIResponse, error) { return r.ApiService.SnapshotsPatchExecute(r) } @@ -616,7 +588,7 @@ func (a *SnapshotsApiService) SnapshotsPatch(ctx _context.Context, snapshotId st * Execute executes the request * @return Snapshot */ -func (a *SnapshotsApiService) SnapshotsPatchExecute(r ApiSnapshotsPatchRequest) (Snapshot, *APIResponse, error) { +func (a *SnapshotsApiService) SnapshotsPatchExecute(r ApiSnapshotsPatchRequest) (Snapshot, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPatch localVarPostBody interface{} @@ -628,11 +600,13 @@ func (a *SnapshotsApiService) SnapshotsPatchExecute(r ApiSnapshotsPatchRequest) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SnapshotsApiService.SnapshotsPatch") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/snapshots/{snapshotId}" - localVarPath = strings.Replace(localVarPath, "{"+"snapshotId"+"}", _neturl.PathEscape(parameterToString(r.snapshotId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"snapshotId"+"}", _neturl.PathEscape(parameterValueToString(r.snapshotId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -642,20 +616,10 @@ func (a *SnapshotsApiService) SnapshotsPatchExecute(r ApiSnapshotsPatchRequest) } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -676,13 +640,13 @@ func (a *SnapshotsApiService) SnapshotsPatchExecute(r ApiSnapshotsPatchRequest) localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.snapshot if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -701,11 +665,11 @@ func (a *SnapshotsApiService) SnapshotsPatchExecute(r ApiSnapshotsPatchRequest) localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "SnapshotsPatch", } @@ -721,28 +685,26 @@ func (a *SnapshotsApiService) SnapshotsPatchExecute(r ApiSnapshotsPatchRequest) } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -776,7 +738,7 @@ func (r ApiSnapshotsPutRequest) XContractNumber(xContractNumber int32) ApiSnapsh return r } -func (r ApiSnapshotsPutRequest) Execute() (Snapshot, *APIResponse, error) { +func (r ApiSnapshotsPutRequest) Execute() (Snapshot, *shared.APIResponse, error) { return r.ApiService.SnapshotsPutExecute(r) } @@ -799,7 +761,7 @@ func (a *SnapshotsApiService) SnapshotsPut(ctx _context.Context, snapshotId stri * Execute executes the request * @return Snapshot */ -func (a *SnapshotsApiService) SnapshotsPutExecute(r ApiSnapshotsPutRequest) (Snapshot, *APIResponse, error) { +func (a *SnapshotsApiService) SnapshotsPutExecute(r ApiSnapshotsPutRequest) (Snapshot, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPut localVarPostBody interface{} @@ -811,11 +773,13 @@ func (a *SnapshotsApiService) SnapshotsPutExecute(r ApiSnapshotsPutRequest) (Sna localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SnapshotsApiService.SnapshotsPut") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/snapshots/{snapshotId}" - localVarPath = strings.Replace(localVarPath, "{"+"snapshotId"+"}", _neturl.PathEscape(parameterToString(r.snapshotId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"snapshotId"+"}", _neturl.PathEscape(parameterValueToString(r.snapshotId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -825,20 +789,10 @@ func (a *SnapshotsApiService) SnapshotsPutExecute(r ApiSnapshotsPutRequest) (Sna } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -859,13 +813,13 @@ func (a *SnapshotsApiService) SnapshotsPutExecute(r ApiSnapshotsPutRequest) (Sna localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.snapshot if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -884,11 +838,11 @@ func (a *SnapshotsApiService) SnapshotsPutExecute(r ApiSnapshotsPutRequest) (Sna localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "SnapshotsPut", } @@ -904,28 +858,26 @@ func (a *SnapshotsApiService) SnapshotsPutExecute(r ApiSnapshotsPutRequest) (Sna } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/api_target_groups.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/api_target_groups.go similarity index 76% rename from vendor/github.com/ionos-cloud/sdk-go/v6/api_target_groups.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/api_target_groups.go index 1a9b1ca56..1d33f50e9 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/api_target_groups.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/api_target_groups.go @@ -13,6 +13,7 @@ package ionoscloud import ( _context "context" "fmt" + "github.com/ionos-cloud/sdk-go-bundle/shared" "io" _nethttp "net/http" _neturl "net/url" @@ -49,7 +50,7 @@ func (r ApiTargetGroupsDeleteRequest) XContractNumber(xContractNumber int32) Api return r } -func (r ApiTargetGroupsDeleteRequest) Execute() (*APIResponse, error) { +func (r ApiTargetGroupsDeleteRequest) Execute() (*shared.APIResponse, error) { return r.ApiService.TargetGroupsDeleteExecute(r) } @@ -71,7 +72,7 @@ func (a *TargetGroupsApiService) TargetGroupsDelete(ctx _context.Context, target /* * Execute executes the request */ -func (a *TargetGroupsApiService) TargetGroupsDeleteExecute(r ApiTargetGroupsDeleteRequest) (*APIResponse, error) { +func (a *TargetGroupsApiService) TargetGroupsDeleteExecute(r ApiTargetGroupsDeleteRequest) (*shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodDelete localVarPostBody interface{} @@ -82,31 +83,23 @@ func (a *TargetGroupsApiService) TargetGroupsDeleteExecute(r ApiTargetGroupsDele localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TargetGroupsApiService.TargetGroupsDelete") if err != nil { - return nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return nil, gerr } localVarPath := localBasePath + "/targetgroups/{targetGroupId}" - localVarPath = strings.Replace(localVarPath, "{"+"targetGroupId"+"}", _neturl.PathEscape(parameterToString(r.targetGroupId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"targetGroupId"+"}", _neturl.PathEscape(parameterValueToString(r.targetGroupId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -127,11 +120,11 @@ func (a *TargetGroupsApiService) TargetGroupsDeleteExecute(r ApiTargetGroupsDele localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -150,11 +143,11 @@ func (a *TargetGroupsApiService) TargetGroupsDeleteExecute(r ApiTargetGroupsDele localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "TargetGroupsDelete", } @@ -170,18 +163,17 @@ func (a *TargetGroupsApiService) TargetGroupsDeleteExecute(r ApiTargetGroupsDele } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarAPIResponse, newErr } @@ -210,7 +202,7 @@ func (r ApiTargetgroupsFindByTargetGroupIdRequest) XContractNumber(xContractNumb return r } -func (r ApiTargetgroupsFindByTargetGroupIdRequest) Execute() (TargetGroup, *APIResponse, error) { +func (r ApiTargetgroupsFindByTargetGroupIdRequest) Execute() (TargetGroup, *shared.APIResponse, error) { return r.ApiService.TargetgroupsFindByTargetGroupIdExecute(r) } @@ -233,7 +225,7 @@ func (a *TargetGroupsApiService) TargetgroupsFindByTargetGroupId(ctx _context.Co * Execute executes the request * @return TargetGroup */ -func (a *TargetGroupsApiService) TargetgroupsFindByTargetGroupIdExecute(r ApiTargetgroupsFindByTargetGroupIdRequest) (TargetGroup, *APIResponse, error) { +func (a *TargetGroupsApiService) TargetgroupsFindByTargetGroupIdExecute(r ApiTargetgroupsFindByTargetGroupIdRequest) (TargetGroup, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -245,31 +237,23 @@ func (a *TargetGroupsApiService) TargetgroupsFindByTargetGroupIdExecute(r ApiTar localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TargetGroupsApiService.TargetgroupsFindByTargetGroupId") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/targetgroups/{targetGroupId}" - localVarPath = strings.Replace(localVarPath, "{"+"targetGroupId"+"}", _neturl.PathEscape(parameterToString(r.targetGroupId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"targetGroupId"+"}", _neturl.PathEscape(parameterValueToString(r.targetGroupId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -290,11 +274,11 @@ func (a *TargetGroupsApiService) TargetgroupsFindByTargetGroupIdExecute(r ApiTar localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -313,11 +297,11 @@ func (a *TargetGroupsApiService) TargetgroupsFindByTargetGroupIdExecute(r ApiTar localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "TargetgroupsFindByTargetGroupId", } @@ -333,28 +317,26 @@ func (a *TargetGroupsApiService) TargetgroupsFindByTargetGroupIdExecute(r ApiTar } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -397,7 +379,7 @@ func (r ApiTargetgroupsGetRequest) Limit(limit int32) ApiTargetgroupsGetRequest // Filters query parameters limit results to those containing a matching value for a specific property. func (r ApiTargetgroupsGetRequest) Filter(key string, value string) ApiTargetgroupsGetRequest { - filterKey := fmt.Sprintf(FilterQueryParam, key) + filterKey := fmt.Sprintf("filter.%s", key) r.filters[filterKey] = append(r.filters[filterKey], value) return r } @@ -414,7 +396,7 @@ func (r ApiTargetgroupsGetRequest) MaxResults(maxResults int32) ApiTargetgroupsG return r } -func (r ApiTargetgroupsGetRequest) Execute() (TargetGroups, *APIResponse, error) { +func (r ApiTargetgroupsGetRequest) Execute() (TargetGroups, *shared.APIResponse, error) { return r.ApiService.TargetgroupsGetExecute(r) } @@ -438,7 +420,7 @@ func (a *TargetGroupsApiService) TargetgroupsGet(ctx _context.Context) ApiTarget * Execute executes the request * @return TargetGroups */ -func (a *TargetGroupsApiService) TargetgroupsGetExecute(r ApiTargetgroupsGetRequest) (TargetGroups, *APIResponse, error) { +func (a *TargetGroupsApiService) TargetgroupsGetExecute(r ApiTargetgroupsGetRequest) (TargetGroups, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -450,7 +432,9 @@ func (a *TargetGroupsApiService) TargetgroupsGetExecute(r ApiTargetgroupsGetRequ localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TargetGroupsApiService.TargetgroupsGet") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/targetgroups" @@ -460,36 +444,16 @@ func (a *TargetGroupsApiService) TargetgroupsGetExecute(r ApiTargetgroupsGetRequ localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } if r.offset != nil { - localVarQueryParams.Add("offset", parameterToString(*r.offset, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("offset") - if defaultQueryParam == "" { - localVarQueryParams.Add("offset", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "offset", r.offset, "") } if r.limit != nil { - localVarQueryParams.Add("limit", parameterToString(*r.limit, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("limit") - if defaultQueryParam == "" { - localVarQueryParams.Add("limit", parameterToString(100, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "") } if r.orderBy != nil { localVarQueryParams.Add("orderBy", parameterToString(*r.orderBy, "")) @@ -523,11 +487,11 @@ func (a *TargetGroupsApiService) TargetgroupsGetExecute(r ApiTargetgroupsGetRequ localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -546,11 +510,11 @@ func (a *TargetGroupsApiService) TargetgroupsGetExecute(r ApiTargetgroupsGetRequ localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "TargetgroupsGet", } @@ -566,28 +530,26 @@ func (a *TargetGroupsApiService) TargetgroupsGetExecute(r ApiTargetgroupsGetRequ } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -621,7 +583,7 @@ func (r ApiTargetgroupsPatchRequest) XContractNumber(xContractNumber int32) ApiT return r } -func (r ApiTargetgroupsPatchRequest) Execute() (TargetGroup, *APIResponse, error) { +func (r ApiTargetgroupsPatchRequest) Execute() (TargetGroup, *shared.APIResponse, error) { return r.ApiService.TargetgroupsPatchExecute(r) } @@ -644,7 +606,7 @@ func (a *TargetGroupsApiService) TargetgroupsPatch(ctx _context.Context, targetG * Execute executes the request * @return TargetGroup */ -func (a *TargetGroupsApiService) TargetgroupsPatchExecute(r ApiTargetgroupsPatchRequest) (TargetGroup, *APIResponse, error) { +func (a *TargetGroupsApiService) TargetgroupsPatchExecute(r ApiTargetgroupsPatchRequest) (TargetGroup, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPatch localVarPostBody interface{} @@ -656,11 +618,13 @@ func (a *TargetGroupsApiService) TargetgroupsPatchExecute(r ApiTargetgroupsPatch localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TargetGroupsApiService.TargetgroupsPatch") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/targetgroups/{targetGroupId}" - localVarPath = strings.Replace(localVarPath, "{"+"targetGroupId"+"}", _neturl.PathEscape(parameterToString(r.targetGroupId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"targetGroupId"+"}", _neturl.PathEscape(parameterValueToString(r.targetGroupId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -670,20 +634,10 @@ func (a *TargetGroupsApiService) TargetgroupsPatchExecute(r ApiTargetgroupsPatch } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -704,13 +658,13 @@ func (a *TargetGroupsApiService) TargetgroupsPatchExecute(r ApiTargetgroupsPatch localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.targetGroupProperties if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -729,11 +683,11 @@ func (a *TargetGroupsApiService) TargetgroupsPatchExecute(r ApiTargetgroupsPatch localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "TargetgroupsPatch", } @@ -749,28 +703,26 @@ func (a *TargetGroupsApiService) TargetgroupsPatchExecute(r ApiTargetgroupsPatch } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -803,7 +755,7 @@ func (r ApiTargetgroupsPostRequest) XContractNumber(xContractNumber int32) ApiTa return r } -func (r ApiTargetgroupsPostRequest) Execute() (TargetGroup, *APIResponse, error) { +func (r ApiTargetgroupsPostRequest) Execute() (TargetGroup, *shared.APIResponse, error) { return r.ApiService.TargetgroupsPostExecute(r) } @@ -824,7 +776,7 @@ func (a *TargetGroupsApiService) TargetgroupsPost(ctx _context.Context) ApiTarge * Execute executes the request * @return TargetGroup */ -func (a *TargetGroupsApiService) TargetgroupsPostExecute(r ApiTargetgroupsPostRequest) (TargetGroup, *APIResponse, error) { +func (a *TargetGroupsApiService) TargetgroupsPostExecute(r ApiTargetgroupsPostRequest) (TargetGroup, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -836,7 +788,9 @@ func (a *TargetGroupsApiService) TargetgroupsPostExecute(r ApiTargetgroupsPostRe localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TargetGroupsApiService.TargetgroupsPost") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/targetgroups" @@ -849,20 +803,10 @@ func (a *TargetGroupsApiService) TargetgroupsPostExecute(r ApiTargetgroupsPostRe } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -883,13 +827,13 @@ func (a *TargetGroupsApiService) TargetgroupsPostExecute(r ApiTargetgroupsPostRe localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.targetGroup if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -908,11 +852,11 @@ func (a *TargetGroupsApiService) TargetgroupsPostExecute(r ApiTargetgroupsPostRe localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "TargetgroupsPost", } @@ -928,28 +872,26 @@ func (a *TargetGroupsApiService) TargetgroupsPostExecute(r ApiTargetgroupsPostRe } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -983,7 +925,7 @@ func (r ApiTargetgroupsPutRequest) XContractNumber(xContractNumber int32) ApiTar return r } -func (r ApiTargetgroupsPutRequest) Execute() (TargetGroup, *APIResponse, error) { +func (r ApiTargetgroupsPutRequest) Execute() (TargetGroup, *shared.APIResponse, error) { return r.ApiService.TargetgroupsPutExecute(r) } @@ -1006,7 +948,7 @@ func (a *TargetGroupsApiService) TargetgroupsPut(ctx _context.Context, targetGro * Execute executes the request * @return TargetGroup */ -func (a *TargetGroupsApiService) TargetgroupsPutExecute(r ApiTargetgroupsPutRequest) (TargetGroup, *APIResponse, error) { +func (a *TargetGroupsApiService) TargetgroupsPutExecute(r ApiTargetgroupsPutRequest) (TargetGroup, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPut localVarPostBody interface{} @@ -1018,11 +960,13 @@ func (a *TargetGroupsApiService) TargetgroupsPutExecute(r ApiTargetgroupsPutRequ localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TargetGroupsApiService.TargetgroupsPut") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/targetgroups/{targetGroupId}" - localVarPath = strings.Replace(localVarPath, "{"+"targetGroupId"+"}", _neturl.PathEscape(parameterToString(r.targetGroupId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"targetGroupId"+"}", _neturl.PathEscape(parameterValueToString(r.targetGroupId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -1032,20 +976,10 @@ func (a *TargetGroupsApiService) TargetgroupsPutExecute(r ApiTargetgroupsPutRequ } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -1066,13 +1000,13 @@ func (a *TargetGroupsApiService) TargetgroupsPutExecute(r ApiTargetgroupsPutRequ localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.targetGroup if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -1091,11 +1025,11 @@ func (a *TargetGroupsApiService) TargetgroupsPutExecute(r ApiTargetgroupsPutRequ localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "TargetgroupsPut", } @@ -1111,28 +1045,26 @@ func (a *TargetGroupsApiService) TargetgroupsPutExecute(r ApiTargetgroupsPutRequ } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/api_templates.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/api_templates.go similarity index 81% rename from vendor/github.com/ionos-cloud/sdk-go/v6/api_templates.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/api_templates.go index 35e74d301..55d14878d 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/api_templates.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/api_templates.go @@ -13,6 +13,7 @@ package ionoscloud import ( _context "context" "fmt" + "github.com/ionos-cloud/sdk-go-bundle/shared" "io" _nethttp "net/http" _neturl "net/url" @@ -39,7 +40,7 @@ func (r ApiTemplatesFindByIdRequest) Depth(depth int32) ApiTemplatesFindByIdRequ return r } -func (r ApiTemplatesFindByIdRequest) Execute() (Template, *APIResponse, error) { +func (r ApiTemplatesFindByIdRequest) Execute() (Template, *shared.APIResponse, error) { return r.ApiService.TemplatesFindByIdExecute(r) } @@ -62,7 +63,7 @@ func (a *TemplatesApiService) TemplatesFindById(ctx _context.Context, templateId * Execute executes the request * @return Template */ -func (a *TemplatesApiService) TemplatesFindByIdExecute(r ApiTemplatesFindByIdRequest) (Template, *APIResponse, error) { +func (a *TemplatesApiService) TemplatesFindByIdExecute(r ApiTemplatesFindByIdRequest) (Template, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -74,23 +75,20 @@ func (a *TemplatesApiService) TemplatesFindByIdExecute(r ApiTemplatesFindByIdReq localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TemplatesApiService.TemplatesFindById") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/templates/{templateId}" - localVarPath = strings.Replace(localVarPath, "{"+"templateId"+"}", _neturl.PathEscape(parameterToString(r.templateId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"templateId"+"}", _neturl.PathEscape(parameterValueToString(r.templateId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -112,7 +110,7 @@ func (a *TemplatesApiService) TemplatesFindByIdExecute(r ApiTemplatesFindByIdReq } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -131,11 +129,11 @@ func (a *TemplatesApiService) TemplatesFindByIdExecute(r ApiTemplatesFindByIdReq localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "TemplatesFindById", } @@ -151,28 +149,26 @@ func (a *TemplatesApiService) TemplatesFindByIdExecute(r ApiTemplatesFindByIdReq } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -195,7 +191,7 @@ func (r ApiTemplatesGetRequest) Depth(depth int32) ApiTemplatesGetRequest { // Filters query parameters limit results to those containing a matching value for a specific property. func (r ApiTemplatesGetRequest) Filter(key string, value string) ApiTemplatesGetRequest { - filterKey := fmt.Sprintf(FilterQueryParam, key) + filterKey := fmt.Sprintf("filter.%s", key) r.filters[filterKey] = append(r.filters[filterKey], value) return r } @@ -212,7 +208,7 @@ func (r ApiTemplatesGetRequest) MaxResults(maxResults int32) ApiTemplatesGetRequ return r } -func (r ApiTemplatesGetRequest) Execute() (Templates, *APIResponse, error) { +func (r ApiTemplatesGetRequest) Execute() (Templates, *shared.APIResponse, error) { return r.ApiService.TemplatesGetExecute(r) } @@ -238,7 +234,7 @@ func (a *TemplatesApiService) TemplatesGet(ctx _context.Context) ApiTemplatesGet * Execute executes the request * @return Templates */ -func (a *TemplatesApiService) TemplatesGetExecute(r ApiTemplatesGetRequest) (Templates, *APIResponse, error) { +func (a *TemplatesApiService) TemplatesGetExecute(r ApiTemplatesGetRequest) (Templates, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -250,7 +246,9 @@ func (a *TemplatesApiService) TemplatesGetExecute(r ApiTemplatesGetRequest) (Tem localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TemplatesApiService.TemplatesGet") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/templates" @@ -260,12 +258,7 @@ func (a *TemplatesApiService) TemplatesGetExecute(r ApiTemplatesGetRequest) (Tem localVarFormParams := _neturl.Values{} if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } if r.orderBy != nil { localVarQueryParams.Add("orderBy", parameterToString(*r.orderBy, "")) @@ -300,7 +293,7 @@ func (a *TemplatesApiService) TemplatesGetExecute(r ApiTemplatesGetRequest) (Tem } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -319,11 +312,11 @@ func (a *TemplatesApiService) TemplatesGetExecute(r ApiTemplatesGetRequest) (Tem localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "TemplatesGet", } @@ -339,28 +332,26 @@ func (a *TemplatesApiService) TemplatesGetExecute(r ApiTemplatesGetRequest) (Tem } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/api_user_management.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/api_user_management.go similarity index 77% rename from vendor/github.com/ionos-cloud/sdk-go/v6/api_user_management.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/api_user_management.go index 37fbcb0e0..02e74cf63 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/api_user_management.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/api_user_management.go @@ -13,6 +13,7 @@ package ionoscloud import ( _context "context" "fmt" + "github.com/ionos-cloud/sdk-go-bundle/shared" "io" _nethttp "net/http" _neturl "net/url" @@ -49,7 +50,7 @@ func (r ApiUmGroupsDeleteRequest) XContractNumber(xContractNumber int32) ApiUmGr return r } -func (r ApiUmGroupsDeleteRequest) Execute() (*APIResponse, error) { +func (r ApiUmGroupsDeleteRequest) Execute() (*shared.APIResponse, error) { return r.ApiService.UmGroupsDeleteExecute(r) } @@ -71,7 +72,7 @@ func (a *UserManagementApiService) UmGroupsDelete(ctx _context.Context, groupId /* * Execute executes the request */ -func (a *UserManagementApiService) UmGroupsDeleteExecute(r ApiUmGroupsDeleteRequest) (*APIResponse, error) { +func (a *UserManagementApiService) UmGroupsDeleteExecute(r ApiUmGroupsDeleteRequest) (*shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodDelete localVarPostBody interface{} @@ -82,31 +83,23 @@ func (a *UserManagementApiService) UmGroupsDeleteExecute(r ApiUmGroupsDeleteRequ localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserManagementApiService.UmGroupsDelete") if err != nil { - return nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return nil, gerr } localVarPath := localBasePath + "/um/groups/{groupId}" - localVarPath = strings.Replace(localVarPath, "{"+"groupId"+"}", _neturl.PathEscape(parameterToString(r.groupId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"groupId"+"}", _neturl.PathEscape(parameterValueToString(r.groupId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -127,11 +120,11 @@ func (a *UserManagementApiService) UmGroupsDeleteExecute(r ApiUmGroupsDeleteRequ localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -150,11 +143,11 @@ func (a *UserManagementApiService) UmGroupsDeleteExecute(r ApiUmGroupsDeleteRequ localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "UmGroupsDelete", } @@ -170,18 +163,17 @@ func (a *UserManagementApiService) UmGroupsDeleteExecute(r ApiUmGroupsDeleteRequ } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarAPIResponse, newErr } @@ -210,7 +202,7 @@ func (r ApiUmGroupsFindByIdRequest) XContractNumber(xContractNumber int32) ApiUm return r } -func (r ApiUmGroupsFindByIdRequest) Execute() (Group, *APIResponse, error) { +func (r ApiUmGroupsFindByIdRequest) Execute() (Group, *shared.APIResponse, error) { return r.ApiService.UmGroupsFindByIdExecute(r) } @@ -233,7 +225,7 @@ func (a *UserManagementApiService) UmGroupsFindById(ctx _context.Context, groupI * Execute executes the request * @return Group */ -func (a *UserManagementApiService) UmGroupsFindByIdExecute(r ApiUmGroupsFindByIdRequest) (Group, *APIResponse, error) { +func (a *UserManagementApiService) UmGroupsFindByIdExecute(r ApiUmGroupsFindByIdRequest) (Group, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -245,31 +237,23 @@ func (a *UserManagementApiService) UmGroupsFindByIdExecute(r ApiUmGroupsFindById localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserManagementApiService.UmGroupsFindById") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/um/groups/{groupId}" - localVarPath = strings.Replace(localVarPath, "{"+"groupId"+"}", _neturl.PathEscape(parameterToString(r.groupId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"groupId"+"}", _neturl.PathEscape(parameterValueToString(r.groupId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -290,11 +274,11 @@ func (a *UserManagementApiService) UmGroupsFindByIdExecute(r ApiUmGroupsFindById localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -313,11 +297,11 @@ func (a *UserManagementApiService) UmGroupsFindByIdExecute(r ApiUmGroupsFindById localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "UmGroupsFindById", } @@ -333,28 +317,26 @@ func (a *UserManagementApiService) UmGroupsFindByIdExecute(r ApiUmGroupsFindById } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -387,7 +369,7 @@ func (r ApiUmGroupsGetRequest) XContractNumber(xContractNumber int32) ApiUmGroup // Filters query parameters limit results to those containing a matching value for a specific property. func (r ApiUmGroupsGetRequest) Filter(key string, value string) ApiUmGroupsGetRequest { - filterKey := fmt.Sprintf(FilterQueryParam, key) + filterKey := fmt.Sprintf("filter.%s", key) r.filters[filterKey] = append(r.filters[filterKey], value) return r } @@ -404,7 +386,7 @@ func (r ApiUmGroupsGetRequest) MaxResults(maxResults int32) ApiUmGroupsGetReques return r } -func (r ApiUmGroupsGetRequest) Execute() (Groups, *APIResponse, error) { +func (r ApiUmGroupsGetRequest) Execute() (Groups, *shared.APIResponse, error) { return r.ApiService.UmGroupsGetExecute(r) } @@ -426,7 +408,7 @@ func (a *UserManagementApiService) UmGroupsGet(ctx _context.Context) ApiUmGroups * Execute executes the request * @return Groups */ -func (a *UserManagementApiService) UmGroupsGetExecute(r ApiUmGroupsGetRequest) (Groups, *APIResponse, error) { +func (a *UserManagementApiService) UmGroupsGetExecute(r ApiUmGroupsGetRequest) (Groups, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -438,7 +420,9 @@ func (a *UserManagementApiService) UmGroupsGetExecute(r ApiUmGroupsGetRequest) ( localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserManagementApiService.UmGroupsGet") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/um/groups" @@ -448,20 +432,10 @@ func (a *UserManagementApiService) UmGroupsGetExecute(r ApiUmGroupsGetRequest) ( localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } if r.orderBy != nil { localVarQueryParams.Add("orderBy", parameterToString(*r.orderBy, "")) @@ -495,11 +469,11 @@ func (a *UserManagementApiService) UmGroupsGetExecute(r ApiUmGroupsGetRequest) ( localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -518,11 +492,11 @@ func (a *UserManagementApiService) UmGroupsGetExecute(r ApiUmGroupsGetRequest) ( localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "UmGroupsGet", } @@ -538,28 +512,26 @@ func (a *UserManagementApiService) UmGroupsGetExecute(r ApiUmGroupsGetRequest) ( } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -592,7 +564,7 @@ func (r ApiUmGroupsPostRequest) XContractNumber(xContractNumber int32) ApiUmGrou return r } -func (r ApiUmGroupsPostRequest) Execute() (Group, *APIResponse, error) { +func (r ApiUmGroupsPostRequest) Execute() (Group, *shared.APIResponse, error) { return r.ApiService.UmGroupsPostExecute(r) } @@ -613,7 +585,7 @@ func (a *UserManagementApiService) UmGroupsPost(ctx _context.Context) ApiUmGroup * Execute executes the request * @return Group */ -func (a *UserManagementApiService) UmGroupsPostExecute(r ApiUmGroupsPostRequest) (Group, *APIResponse, error) { +func (a *UserManagementApiService) UmGroupsPostExecute(r ApiUmGroupsPostRequest) (Group, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -625,7 +597,9 @@ func (a *UserManagementApiService) UmGroupsPostExecute(r ApiUmGroupsPostRequest) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserManagementApiService.UmGroupsPost") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/um/groups" @@ -638,20 +612,10 @@ func (a *UserManagementApiService) UmGroupsPostExecute(r ApiUmGroupsPostRequest) } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -672,13 +636,13 @@ func (a *UserManagementApiService) UmGroupsPostExecute(r ApiUmGroupsPostRequest) localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.group if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -697,11 +661,11 @@ func (a *UserManagementApiService) UmGroupsPostExecute(r ApiUmGroupsPostRequest) localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "UmGroupsPost", } @@ -717,28 +681,26 @@ func (a *UserManagementApiService) UmGroupsPostExecute(r ApiUmGroupsPostRequest) } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -772,7 +734,7 @@ func (r ApiUmGroupsPutRequest) XContractNumber(xContractNumber int32) ApiUmGroup return r } -func (r ApiUmGroupsPutRequest) Execute() (Group, *APIResponse, error) { +func (r ApiUmGroupsPutRequest) Execute() (Group, *shared.APIResponse, error) { return r.ApiService.UmGroupsPutExecute(r) } @@ -795,7 +757,7 @@ func (a *UserManagementApiService) UmGroupsPut(ctx _context.Context, groupId str * Execute executes the request * @return Group */ -func (a *UserManagementApiService) UmGroupsPutExecute(r ApiUmGroupsPutRequest) (Group, *APIResponse, error) { +func (a *UserManagementApiService) UmGroupsPutExecute(r ApiUmGroupsPutRequest) (Group, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPut localVarPostBody interface{} @@ -807,11 +769,13 @@ func (a *UserManagementApiService) UmGroupsPutExecute(r ApiUmGroupsPutRequest) ( localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserManagementApiService.UmGroupsPut") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/um/groups/{groupId}" - localVarPath = strings.Replace(localVarPath, "{"+"groupId"+"}", _neturl.PathEscape(parameterToString(r.groupId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"groupId"+"}", _neturl.PathEscape(parameterValueToString(r.groupId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -821,20 +785,10 @@ func (a *UserManagementApiService) UmGroupsPutExecute(r ApiUmGroupsPutRequest) ( } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -855,13 +809,13 @@ func (a *UserManagementApiService) UmGroupsPutExecute(r ApiUmGroupsPutRequest) ( localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.group if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -880,11 +834,11 @@ func (a *UserManagementApiService) UmGroupsPutExecute(r ApiUmGroupsPutRequest) ( localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "UmGroupsPut", } @@ -900,28 +854,26 @@ func (a *UserManagementApiService) UmGroupsPutExecute(r ApiUmGroupsPutRequest) ( } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -955,7 +907,7 @@ func (r ApiUmGroupsResourcesGetRequest) XContractNumber(xContractNumber int32) A // Filters query parameters limit results to those containing a matching value for a specific property. func (r ApiUmGroupsResourcesGetRequest) Filter(key string, value string) ApiUmGroupsResourcesGetRequest { - filterKey := fmt.Sprintf(FilterQueryParam, key) + filterKey := fmt.Sprintf("filter.%s", key) r.filters[filterKey] = append(r.filters[filterKey], value) return r } @@ -972,7 +924,7 @@ func (r ApiUmGroupsResourcesGetRequest) MaxResults(maxResults int32) ApiUmGroups return r } -func (r ApiUmGroupsResourcesGetRequest) Execute() (ResourceGroups, *APIResponse, error) { +func (r ApiUmGroupsResourcesGetRequest) Execute() (ResourceGroups, *shared.APIResponse, error) { return r.ApiService.UmGroupsResourcesGetExecute(r) } @@ -996,7 +948,7 @@ func (a *UserManagementApiService) UmGroupsResourcesGet(ctx _context.Context, gr * Execute executes the request * @return ResourceGroups */ -func (a *UserManagementApiService) UmGroupsResourcesGetExecute(r ApiUmGroupsResourcesGetRequest) (ResourceGroups, *APIResponse, error) { +func (a *UserManagementApiService) UmGroupsResourcesGetExecute(r ApiUmGroupsResourcesGetRequest) (ResourceGroups, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -1008,31 +960,23 @@ func (a *UserManagementApiService) UmGroupsResourcesGetExecute(r ApiUmGroupsReso localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserManagementApiService.UmGroupsResourcesGet") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/um/groups/{groupId}/resources" - localVarPath = strings.Replace(localVarPath, "{"+"groupId"+"}", _neturl.PathEscape(parameterToString(r.groupId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"groupId"+"}", _neturl.PathEscape(parameterValueToString(r.groupId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } if r.orderBy != nil { localVarQueryParams.Add("orderBy", parameterToString(*r.orderBy, "")) @@ -1066,11 +1010,11 @@ func (a *UserManagementApiService) UmGroupsResourcesGetExecute(r ApiUmGroupsReso localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -1089,11 +1033,11 @@ func (a *UserManagementApiService) UmGroupsResourcesGetExecute(r ApiUmGroupsReso localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "UmGroupsResourcesGet", } @@ -1109,28 +1053,26 @@ func (a *UserManagementApiService) UmGroupsResourcesGetExecute(r ApiUmGroupsReso } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -1160,7 +1102,7 @@ func (r ApiUmGroupsSharesDeleteRequest) XContractNumber(xContractNumber int32) A return r } -func (r ApiUmGroupsSharesDeleteRequest) Execute() (*APIResponse, error) { +func (r ApiUmGroupsSharesDeleteRequest) Execute() (*shared.APIResponse, error) { return r.ApiService.UmGroupsSharesDeleteExecute(r) } @@ -1184,7 +1126,7 @@ func (a *UserManagementApiService) UmGroupsSharesDelete(ctx _context.Context, gr /* * Execute executes the request */ -func (a *UserManagementApiService) UmGroupsSharesDeleteExecute(r ApiUmGroupsSharesDeleteRequest) (*APIResponse, error) { +func (a *UserManagementApiService) UmGroupsSharesDeleteExecute(r ApiUmGroupsSharesDeleteRequest) (*shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodDelete localVarPostBody interface{} @@ -1195,32 +1137,24 @@ func (a *UserManagementApiService) UmGroupsSharesDeleteExecute(r ApiUmGroupsShar localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserManagementApiService.UmGroupsSharesDelete") if err != nil { - return nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return nil, gerr } localVarPath := localBasePath + "/um/groups/{groupId}/shares/{resourceId}" - localVarPath = strings.Replace(localVarPath, "{"+"groupId"+"}", _neturl.PathEscape(parameterToString(r.groupId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"resourceId"+"}", _neturl.PathEscape(parameterToString(r.resourceId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"groupId"+"}", _neturl.PathEscape(parameterValueToString(r.groupId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"resourceId"+"}", _neturl.PathEscape(parameterValueToString(r.resourceId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -1241,11 +1175,11 @@ func (a *UserManagementApiService) UmGroupsSharesDeleteExecute(r ApiUmGroupsShar localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -1264,11 +1198,11 @@ func (a *UserManagementApiService) UmGroupsSharesDeleteExecute(r ApiUmGroupsShar localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "UmGroupsSharesDelete", } @@ -1284,18 +1218,17 @@ func (a *UserManagementApiService) UmGroupsSharesDeleteExecute(r ApiUmGroupsShar } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarAPIResponse, newErr } @@ -1325,7 +1258,7 @@ func (r ApiUmGroupsSharesFindByResourceIdRequest) XContractNumber(xContractNumbe return r } -func (r ApiUmGroupsSharesFindByResourceIdRequest) Execute() (GroupShare, *APIResponse, error) { +func (r ApiUmGroupsSharesFindByResourceIdRequest) Execute() (GroupShare, *shared.APIResponse, error) { return r.ApiService.UmGroupsSharesFindByResourceIdExecute(r) } @@ -1350,7 +1283,7 @@ func (a *UserManagementApiService) UmGroupsSharesFindByResourceId(ctx _context.C * Execute executes the request * @return GroupShare */ -func (a *UserManagementApiService) UmGroupsSharesFindByResourceIdExecute(r ApiUmGroupsSharesFindByResourceIdRequest) (GroupShare, *APIResponse, error) { +func (a *UserManagementApiService) UmGroupsSharesFindByResourceIdExecute(r ApiUmGroupsSharesFindByResourceIdRequest) (GroupShare, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -1362,32 +1295,24 @@ func (a *UserManagementApiService) UmGroupsSharesFindByResourceIdExecute(r ApiUm localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserManagementApiService.UmGroupsSharesFindByResourceId") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/um/groups/{groupId}/shares/{resourceId}" - localVarPath = strings.Replace(localVarPath, "{"+"groupId"+"}", _neturl.PathEscape(parameterToString(r.groupId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"resourceId"+"}", _neturl.PathEscape(parameterToString(r.resourceId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"groupId"+"}", _neturl.PathEscape(parameterValueToString(r.groupId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"resourceId"+"}", _neturl.PathEscape(parameterValueToString(r.resourceId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -1408,11 +1333,11 @@ func (a *UserManagementApiService) UmGroupsSharesFindByResourceIdExecute(r ApiUm localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -1431,11 +1356,11 @@ func (a *UserManagementApiService) UmGroupsSharesFindByResourceIdExecute(r ApiUm localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "UmGroupsSharesFindByResourceId", } @@ -1451,28 +1376,26 @@ func (a *UserManagementApiService) UmGroupsSharesFindByResourceIdExecute(r ApiUm } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -1506,7 +1429,7 @@ func (r ApiUmGroupsSharesGetRequest) XContractNumber(xContractNumber int32) ApiU // Filters query parameters limit results to those containing a matching value for a specific property. func (r ApiUmGroupsSharesGetRequest) Filter(key string, value string) ApiUmGroupsSharesGetRequest { - filterKey := fmt.Sprintf(FilterQueryParam, key) + filterKey := fmt.Sprintf("filter.%s", key) r.filters[filterKey] = append(r.filters[filterKey], value) return r } @@ -1523,7 +1446,7 @@ func (r ApiUmGroupsSharesGetRequest) MaxResults(maxResults int32) ApiUmGroupsSha return r } -func (r ApiUmGroupsSharesGetRequest) Execute() (GroupShares, *APIResponse, error) { +func (r ApiUmGroupsSharesGetRequest) Execute() (GroupShares, *shared.APIResponse, error) { return r.ApiService.UmGroupsSharesGetExecute(r) } @@ -1547,7 +1470,7 @@ func (a *UserManagementApiService) UmGroupsSharesGet(ctx _context.Context, group * Execute executes the request * @return GroupShares */ -func (a *UserManagementApiService) UmGroupsSharesGetExecute(r ApiUmGroupsSharesGetRequest) (GroupShares, *APIResponse, error) { +func (a *UserManagementApiService) UmGroupsSharesGetExecute(r ApiUmGroupsSharesGetRequest) (GroupShares, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -1559,31 +1482,23 @@ func (a *UserManagementApiService) UmGroupsSharesGetExecute(r ApiUmGroupsSharesG localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserManagementApiService.UmGroupsSharesGet") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/um/groups/{groupId}/shares" - localVarPath = strings.Replace(localVarPath, "{"+"groupId"+"}", _neturl.PathEscape(parameterToString(r.groupId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"groupId"+"}", _neturl.PathEscape(parameterValueToString(r.groupId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } if r.orderBy != nil { localVarQueryParams.Add("orderBy", parameterToString(*r.orderBy, "")) @@ -1617,11 +1532,11 @@ func (a *UserManagementApiService) UmGroupsSharesGetExecute(r ApiUmGroupsSharesG localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -1640,11 +1555,11 @@ func (a *UserManagementApiService) UmGroupsSharesGetExecute(r ApiUmGroupsSharesG localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "UmGroupsSharesGet", } @@ -1660,28 +1575,26 @@ func (a *UserManagementApiService) UmGroupsSharesGetExecute(r ApiUmGroupsSharesG } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -1716,7 +1629,7 @@ func (r ApiUmGroupsSharesPostRequest) XContractNumber(xContractNumber int32) Api return r } -func (r ApiUmGroupsSharesPostRequest) Execute() (GroupShare, *APIResponse, error) { +func (r ApiUmGroupsSharesPostRequest) Execute() (GroupShare, *shared.APIResponse, error) { return r.ApiService.UmGroupsSharesPostExecute(r) } @@ -1741,7 +1654,7 @@ func (a *UserManagementApiService) UmGroupsSharesPost(ctx _context.Context, grou * Execute executes the request * @return GroupShare */ -func (a *UserManagementApiService) UmGroupsSharesPostExecute(r ApiUmGroupsSharesPostRequest) (GroupShare, *APIResponse, error) { +func (a *UserManagementApiService) UmGroupsSharesPostExecute(r ApiUmGroupsSharesPostRequest) (GroupShare, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -1753,12 +1666,14 @@ func (a *UserManagementApiService) UmGroupsSharesPostExecute(r ApiUmGroupsShares localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserManagementApiService.UmGroupsSharesPost") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/um/groups/{groupId}/shares/{resourceId}" - localVarPath = strings.Replace(localVarPath, "{"+"groupId"+"}", _neturl.PathEscape(parameterToString(r.groupId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"resourceId"+"}", _neturl.PathEscape(parameterToString(r.resourceId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"groupId"+"}", _neturl.PathEscape(parameterValueToString(r.groupId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"resourceId"+"}", _neturl.PathEscape(parameterValueToString(r.resourceId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -1768,20 +1683,10 @@ func (a *UserManagementApiService) UmGroupsSharesPostExecute(r ApiUmGroupsShares } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -1802,13 +1707,13 @@ func (a *UserManagementApiService) UmGroupsSharesPostExecute(r ApiUmGroupsShares localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.resource if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -1827,11 +1732,11 @@ func (a *UserManagementApiService) UmGroupsSharesPostExecute(r ApiUmGroupsShares localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "UmGroupsSharesPost", } @@ -1847,28 +1752,26 @@ func (a *UserManagementApiService) UmGroupsSharesPostExecute(r ApiUmGroupsShares } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -1903,7 +1806,7 @@ func (r ApiUmGroupsSharesPutRequest) XContractNumber(xContractNumber int32) ApiU return r } -func (r ApiUmGroupsSharesPutRequest) Execute() (GroupShare, *APIResponse, error) { +func (r ApiUmGroupsSharesPutRequest) Execute() (GroupShare, *shared.APIResponse, error) { return r.ApiService.UmGroupsSharesPutExecute(r) } @@ -1928,7 +1831,7 @@ func (a *UserManagementApiService) UmGroupsSharesPut(ctx _context.Context, group * Execute executes the request * @return GroupShare */ -func (a *UserManagementApiService) UmGroupsSharesPutExecute(r ApiUmGroupsSharesPutRequest) (GroupShare, *APIResponse, error) { +func (a *UserManagementApiService) UmGroupsSharesPutExecute(r ApiUmGroupsSharesPutRequest) (GroupShare, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPut localVarPostBody interface{} @@ -1940,12 +1843,14 @@ func (a *UserManagementApiService) UmGroupsSharesPutExecute(r ApiUmGroupsSharesP localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserManagementApiService.UmGroupsSharesPut") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/um/groups/{groupId}/shares/{resourceId}" - localVarPath = strings.Replace(localVarPath, "{"+"groupId"+"}", _neturl.PathEscape(parameterToString(r.groupId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"resourceId"+"}", _neturl.PathEscape(parameterToString(r.resourceId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"groupId"+"}", _neturl.PathEscape(parameterValueToString(r.groupId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"resourceId"+"}", _neturl.PathEscape(parameterValueToString(r.resourceId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -1955,20 +1860,10 @@ func (a *UserManagementApiService) UmGroupsSharesPutExecute(r ApiUmGroupsSharesP } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -1989,13 +1884,13 @@ func (a *UserManagementApiService) UmGroupsSharesPutExecute(r ApiUmGroupsSharesP localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.resource if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -2014,11 +1909,11 @@ func (a *UserManagementApiService) UmGroupsSharesPutExecute(r ApiUmGroupsSharesP localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "UmGroupsSharesPut", } @@ -2034,28 +1929,26 @@ func (a *UserManagementApiService) UmGroupsSharesPutExecute(r ApiUmGroupsSharesP } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -2085,7 +1978,7 @@ func (r ApiUmGroupsUsersDeleteRequest) XContractNumber(xContractNumber int32) Ap return r } -func (r ApiUmGroupsUsersDeleteRequest) Execute() (*APIResponse, error) { +func (r ApiUmGroupsUsersDeleteRequest) Execute() (*shared.APIResponse, error) { return r.ApiService.UmGroupsUsersDeleteExecute(r) } @@ -2109,7 +2002,7 @@ func (a *UserManagementApiService) UmGroupsUsersDelete(ctx _context.Context, gro /* * Execute executes the request */ -func (a *UserManagementApiService) UmGroupsUsersDeleteExecute(r ApiUmGroupsUsersDeleteRequest) (*APIResponse, error) { +func (a *UserManagementApiService) UmGroupsUsersDeleteExecute(r ApiUmGroupsUsersDeleteRequest) (*shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodDelete localVarPostBody interface{} @@ -2120,32 +2013,24 @@ func (a *UserManagementApiService) UmGroupsUsersDeleteExecute(r ApiUmGroupsUsers localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserManagementApiService.UmGroupsUsersDelete") if err != nil { - return nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return nil, gerr } localVarPath := localBasePath + "/um/groups/{groupId}/users/{userId}" - localVarPath = strings.Replace(localVarPath, "{"+"groupId"+"}", _neturl.PathEscape(parameterToString(r.groupId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"userId"+"}", _neturl.PathEscape(parameterToString(r.userId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"groupId"+"}", _neturl.PathEscape(parameterValueToString(r.groupId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"userId"+"}", _neturl.PathEscape(parameterValueToString(r.userId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -2166,11 +2051,11 @@ func (a *UserManagementApiService) UmGroupsUsersDeleteExecute(r ApiUmGroupsUsers localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -2189,11 +2074,11 @@ func (a *UserManagementApiService) UmGroupsUsersDeleteExecute(r ApiUmGroupsUsers localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "UmGroupsUsersDelete", } @@ -2209,18 +2094,17 @@ func (a *UserManagementApiService) UmGroupsUsersDeleteExecute(r ApiUmGroupsUsers } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarAPIResponse, newErr } @@ -2254,7 +2138,7 @@ func (r ApiUmGroupsUsersGetRequest) XContractNumber(xContractNumber int32) ApiUm // Filters query parameters limit results to those containing a matching value for a specific property. func (r ApiUmGroupsUsersGetRequest) Filter(key string, value string) ApiUmGroupsUsersGetRequest { - filterKey := fmt.Sprintf(FilterQueryParam, key) + filterKey := fmt.Sprintf("filter.%s", key) r.filters[filterKey] = append(r.filters[filterKey], value) return r } @@ -2271,7 +2155,7 @@ func (r ApiUmGroupsUsersGetRequest) MaxResults(maxResults int32) ApiUmGroupsUser return r } -func (r ApiUmGroupsUsersGetRequest) Execute() (GroupMembers, *APIResponse, error) { +func (r ApiUmGroupsUsersGetRequest) Execute() (GroupMembers, *shared.APIResponse, error) { return r.ApiService.UmGroupsUsersGetExecute(r) } @@ -2295,7 +2179,7 @@ func (a *UserManagementApiService) UmGroupsUsersGet(ctx _context.Context, groupI * Execute executes the request * @return GroupMembers */ -func (a *UserManagementApiService) UmGroupsUsersGetExecute(r ApiUmGroupsUsersGetRequest) (GroupMembers, *APIResponse, error) { +func (a *UserManagementApiService) UmGroupsUsersGetExecute(r ApiUmGroupsUsersGetRequest) (GroupMembers, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -2307,31 +2191,23 @@ func (a *UserManagementApiService) UmGroupsUsersGetExecute(r ApiUmGroupsUsersGet localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserManagementApiService.UmGroupsUsersGet") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/um/groups/{groupId}/users" - localVarPath = strings.Replace(localVarPath, "{"+"groupId"+"}", _neturl.PathEscape(parameterToString(r.groupId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"groupId"+"}", _neturl.PathEscape(parameterValueToString(r.groupId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } if r.orderBy != nil { localVarQueryParams.Add("orderBy", parameterToString(*r.orderBy, "")) @@ -2365,11 +2241,11 @@ func (a *UserManagementApiService) UmGroupsUsersGetExecute(r ApiUmGroupsUsersGet localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -2388,11 +2264,11 @@ func (a *UserManagementApiService) UmGroupsUsersGetExecute(r ApiUmGroupsUsersGet localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "UmGroupsUsersGet", } @@ -2408,28 +2284,26 @@ func (a *UserManagementApiService) UmGroupsUsersGetExecute(r ApiUmGroupsUsersGet } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -2463,7 +2337,7 @@ func (r ApiUmGroupsUsersPostRequest) XContractNumber(xContractNumber int32) ApiU return r } -func (r ApiUmGroupsUsersPostRequest) Execute() (User, *APIResponse, error) { +func (r ApiUmGroupsUsersPostRequest) Execute() (User, *shared.APIResponse, error) { return r.ApiService.UmGroupsUsersPostExecute(r) } @@ -2486,7 +2360,7 @@ func (a *UserManagementApiService) UmGroupsUsersPost(ctx _context.Context, group * Execute executes the request * @return User */ -func (a *UserManagementApiService) UmGroupsUsersPostExecute(r ApiUmGroupsUsersPostRequest) (User, *APIResponse, error) { +func (a *UserManagementApiService) UmGroupsUsersPostExecute(r ApiUmGroupsUsersPostRequest) (User, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -2498,11 +2372,13 @@ func (a *UserManagementApiService) UmGroupsUsersPostExecute(r ApiUmGroupsUsersPo localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserManagementApiService.UmGroupsUsersPost") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/um/groups/{groupId}/users" - localVarPath = strings.Replace(localVarPath, "{"+"groupId"+"}", _neturl.PathEscape(parameterToString(r.groupId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"groupId"+"}", _neturl.PathEscape(parameterValueToString(r.groupId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -2512,20 +2388,10 @@ func (a *UserManagementApiService) UmGroupsUsersPostExecute(r ApiUmGroupsUsersPo } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -2546,13 +2412,13 @@ func (a *UserManagementApiService) UmGroupsUsersPostExecute(r ApiUmGroupsUsersPo localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.user if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -2571,11 +2437,11 @@ func (a *UserManagementApiService) UmGroupsUsersPostExecute(r ApiUmGroupsUsersPo localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "UmGroupsUsersPost", } @@ -2591,28 +2457,26 @@ func (a *UserManagementApiService) UmGroupsUsersPostExecute(r ApiUmGroupsUsersPo } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -2641,7 +2505,7 @@ func (r ApiUmResourcesFindByTypeRequest) XContractNumber(xContractNumber int32) return r } -func (r ApiUmResourcesFindByTypeRequest) Execute() (Resources, *APIResponse, error) { +func (r ApiUmResourcesFindByTypeRequest) Execute() (Resources, *shared.APIResponse, error) { return r.ApiService.UmResourcesFindByTypeExecute(r) } @@ -2668,7 +2532,7 @@ func (a *UserManagementApiService) UmResourcesFindByType(ctx _context.Context, r * Execute executes the request * @return Resources */ -func (a *UserManagementApiService) UmResourcesFindByTypeExecute(r ApiUmResourcesFindByTypeRequest) (Resources, *APIResponse, error) { +func (a *UserManagementApiService) UmResourcesFindByTypeExecute(r ApiUmResourcesFindByTypeRequest) (Resources, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -2680,31 +2544,23 @@ func (a *UserManagementApiService) UmResourcesFindByTypeExecute(r ApiUmResources localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserManagementApiService.UmResourcesFindByType") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/um/resources/{resourceType}" - localVarPath = strings.Replace(localVarPath, "{"+"resourceType"+"}", _neturl.PathEscape(parameterToString(r.resourceType, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"resourceType"+"}", _neturl.PathEscape(parameterValueToString(r.resourceType, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -2725,11 +2581,11 @@ func (a *UserManagementApiService) UmResourcesFindByTypeExecute(r ApiUmResources localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -2748,11 +2604,11 @@ func (a *UserManagementApiService) UmResourcesFindByTypeExecute(r ApiUmResources localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "UmResourcesFindByType", } @@ -2768,28 +2624,26 @@ func (a *UserManagementApiService) UmResourcesFindByTypeExecute(r ApiUmResources } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -2819,7 +2673,7 @@ func (r ApiUmResourcesFindByTypeAndIdRequest) XContractNumber(xContractNumber in return r } -func (r ApiUmResourcesFindByTypeAndIdRequest) Execute() (Resource, *APIResponse, error) { +func (r ApiUmResourcesFindByTypeAndIdRequest) Execute() (Resource, *shared.APIResponse, error) { return r.ApiService.UmResourcesFindByTypeAndIdExecute(r) } @@ -2848,7 +2702,7 @@ func (a *UserManagementApiService) UmResourcesFindByTypeAndId(ctx _context.Conte * Execute executes the request * @return Resource */ -func (a *UserManagementApiService) UmResourcesFindByTypeAndIdExecute(r ApiUmResourcesFindByTypeAndIdRequest) (Resource, *APIResponse, error) { +func (a *UserManagementApiService) UmResourcesFindByTypeAndIdExecute(r ApiUmResourcesFindByTypeAndIdRequest) (Resource, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -2860,32 +2714,24 @@ func (a *UserManagementApiService) UmResourcesFindByTypeAndIdExecute(r ApiUmReso localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserManagementApiService.UmResourcesFindByTypeAndId") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/um/resources/{resourceType}/{resourceId}" - localVarPath = strings.Replace(localVarPath, "{"+"resourceType"+"}", _neturl.PathEscape(parameterToString(r.resourceType, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"resourceId"+"}", _neturl.PathEscape(parameterToString(r.resourceId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"resourceType"+"}", _neturl.PathEscape(parameterValueToString(r.resourceType, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"resourceId"+"}", _neturl.PathEscape(parameterValueToString(r.resourceId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -2906,11 +2752,11 @@ func (a *UserManagementApiService) UmResourcesFindByTypeAndIdExecute(r ApiUmReso localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -2929,11 +2775,11 @@ func (a *UserManagementApiService) UmResourcesFindByTypeAndIdExecute(r ApiUmReso localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "UmResourcesFindByTypeAndId", } @@ -2949,28 +2795,26 @@ func (a *UserManagementApiService) UmResourcesFindByTypeAndIdExecute(r ApiUmReso } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -3003,7 +2847,7 @@ func (r ApiUmResourcesGetRequest) XContractNumber(xContractNumber int32) ApiUmRe // Filters query parameters limit results to those containing a matching value for a specific property. func (r ApiUmResourcesGetRequest) Filter(key string, value string) ApiUmResourcesGetRequest { - filterKey := fmt.Sprintf(FilterQueryParam, key) + filterKey := fmt.Sprintf("filter.%s", key) r.filters[filterKey] = append(r.filters[filterKey], value) return r } @@ -3020,7 +2864,7 @@ func (r ApiUmResourcesGetRequest) MaxResults(maxResults int32) ApiUmResourcesGet return r } -func (r ApiUmResourcesGetRequest) Execute() (Resources, *APIResponse, error) { +func (r ApiUmResourcesGetRequest) Execute() (Resources, *shared.APIResponse, error) { return r.ApiService.UmResourcesGetExecute(r) } @@ -3042,7 +2886,7 @@ func (a *UserManagementApiService) UmResourcesGet(ctx _context.Context) ApiUmRes * Execute executes the request * @return Resources */ -func (a *UserManagementApiService) UmResourcesGetExecute(r ApiUmResourcesGetRequest) (Resources, *APIResponse, error) { +func (a *UserManagementApiService) UmResourcesGetExecute(r ApiUmResourcesGetRequest) (Resources, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -3054,7 +2898,9 @@ func (a *UserManagementApiService) UmResourcesGetExecute(r ApiUmResourcesGetRequ localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserManagementApiService.UmResourcesGet") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/um/resources" @@ -3064,20 +2910,10 @@ func (a *UserManagementApiService) UmResourcesGetExecute(r ApiUmResourcesGetRequ localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } if r.orderBy != nil { localVarQueryParams.Add("orderBy", parameterToString(*r.orderBy, "")) @@ -3111,11 +2947,11 @@ func (a *UserManagementApiService) UmResourcesGetExecute(r ApiUmResourcesGetRequ localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -3134,11 +2970,11 @@ func (a *UserManagementApiService) UmResourcesGetExecute(r ApiUmResourcesGetRequ localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "UmResourcesGet", } @@ -3154,28 +2990,26 @@ func (a *UserManagementApiService) UmResourcesGetExecute(r ApiUmResourcesGetRequ } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -3204,7 +3038,7 @@ func (r ApiUmUsersDeleteRequest) XContractNumber(xContractNumber int32) ApiUmUse return r } -func (r ApiUmUsersDeleteRequest) Execute() (*APIResponse, error) { +func (r ApiUmUsersDeleteRequest) Execute() (*shared.APIResponse, error) { return r.ApiService.UmUsersDeleteExecute(r) } @@ -3226,7 +3060,7 @@ func (a *UserManagementApiService) UmUsersDelete(ctx _context.Context, userId st /* * Execute executes the request */ -func (a *UserManagementApiService) UmUsersDeleteExecute(r ApiUmUsersDeleteRequest) (*APIResponse, error) { +func (a *UserManagementApiService) UmUsersDeleteExecute(r ApiUmUsersDeleteRequest) (*shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodDelete localVarPostBody interface{} @@ -3237,31 +3071,23 @@ func (a *UserManagementApiService) UmUsersDeleteExecute(r ApiUmUsersDeleteReques localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserManagementApiService.UmUsersDelete") if err != nil { - return nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return nil, gerr } localVarPath := localBasePath + "/um/users/{userId}" - localVarPath = strings.Replace(localVarPath, "{"+"userId"+"}", _neturl.PathEscape(parameterToString(r.userId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"userId"+"}", _neturl.PathEscape(parameterValueToString(r.userId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -3282,11 +3108,11 @@ func (a *UserManagementApiService) UmUsersDeleteExecute(r ApiUmUsersDeleteReques localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -3305,11 +3131,11 @@ func (a *UserManagementApiService) UmUsersDeleteExecute(r ApiUmUsersDeleteReques localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "UmUsersDelete", } @@ -3325,18 +3151,17 @@ func (a *UserManagementApiService) UmUsersDeleteExecute(r ApiUmUsersDeleteReques } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarAPIResponse, newErr } @@ -3365,7 +3190,7 @@ func (r ApiUmUsersFindByIdRequest) XContractNumber(xContractNumber int32) ApiUmU return r } -func (r ApiUmUsersFindByIdRequest) Execute() (User, *APIResponse, error) { +func (r ApiUmUsersFindByIdRequest) Execute() (User, *shared.APIResponse, error) { return r.ApiService.UmUsersFindByIdExecute(r) } @@ -3388,7 +3213,7 @@ func (a *UserManagementApiService) UmUsersFindById(ctx _context.Context, userId * Execute executes the request * @return User */ -func (a *UserManagementApiService) UmUsersFindByIdExecute(r ApiUmUsersFindByIdRequest) (User, *APIResponse, error) { +func (a *UserManagementApiService) UmUsersFindByIdExecute(r ApiUmUsersFindByIdRequest) (User, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -3400,31 +3225,23 @@ func (a *UserManagementApiService) UmUsersFindByIdExecute(r ApiUmUsersFindByIdRe localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserManagementApiService.UmUsersFindById") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/um/users/{userId}" - localVarPath = strings.Replace(localVarPath, "{"+"userId"+"}", _neturl.PathEscape(parameterToString(r.userId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"userId"+"}", _neturl.PathEscape(parameterValueToString(r.userId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -3445,11 +3262,11 @@ func (a *UserManagementApiService) UmUsersFindByIdExecute(r ApiUmUsersFindByIdRe localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -3468,11 +3285,11 @@ func (a *UserManagementApiService) UmUsersFindByIdExecute(r ApiUmUsersFindByIdRe localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "UmUsersFindById", } @@ -3488,28 +3305,26 @@ func (a *UserManagementApiService) UmUsersFindByIdExecute(r ApiUmUsersFindByIdRe } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -3552,7 +3367,7 @@ func (r ApiUmUsersGetRequest) Limit(limit int32) ApiUmUsersGetRequest { // Filters query parameters limit results to those containing a matching value for a specific property. func (r ApiUmUsersGetRequest) Filter(key string, value string) ApiUmUsersGetRequest { - filterKey := fmt.Sprintf(FilterQueryParam, key) + filterKey := fmt.Sprintf("filter.%s", key) r.filters[filterKey] = append(r.filters[filterKey], value) return r } @@ -3569,7 +3384,7 @@ func (r ApiUmUsersGetRequest) MaxResults(maxResults int32) ApiUmUsersGetRequest return r } -func (r ApiUmUsersGetRequest) Execute() (Users, *APIResponse, error) { +func (r ApiUmUsersGetRequest) Execute() (Users, *shared.APIResponse, error) { return r.ApiService.UmUsersGetExecute(r) } @@ -3591,7 +3406,7 @@ func (a *UserManagementApiService) UmUsersGet(ctx _context.Context) ApiUmUsersGe * Execute executes the request * @return Users */ -func (a *UserManagementApiService) UmUsersGetExecute(r ApiUmUsersGetRequest) (Users, *APIResponse, error) { +func (a *UserManagementApiService) UmUsersGetExecute(r ApiUmUsersGetRequest) (Users, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -3603,7 +3418,9 @@ func (a *UserManagementApiService) UmUsersGetExecute(r ApiUmUsersGetRequest) (Us localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserManagementApiService.UmUsersGet") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/um/users" @@ -3613,36 +3430,16 @@ func (a *UserManagementApiService) UmUsersGetExecute(r ApiUmUsersGetRequest) (Us localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } if r.offset != nil { - localVarQueryParams.Add("offset", parameterToString(*r.offset, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("offset") - if defaultQueryParam == "" { - localVarQueryParams.Add("offset", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "offset", r.offset, "") } if r.limit != nil { - localVarQueryParams.Add("limit", parameterToString(*r.limit, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("limit") - if defaultQueryParam == "" { - localVarQueryParams.Add("limit", parameterToString(100, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "") } if r.orderBy != nil { localVarQueryParams.Add("orderBy", parameterToString(*r.orderBy, "")) @@ -3676,11 +3473,11 @@ func (a *UserManagementApiService) UmUsersGetExecute(r ApiUmUsersGetRequest) (Us localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -3699,11 +3496,11 @@ func (a *UserManagementApiService) UmUsersGetExecute(r ApiUmUsersGetRequest) (Us localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "UmUsersGet", } @@ -3719,28 +3516,26 @@ func (a *UserManagementApiService) UmUsersGetExecute(r ApiUmUsersGetRequest) (Us } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -3774,7 +3569,7 @@ func (r ApiUmUsersGroupsGetRequest) XContractNumber(xContractNumber int32) ApiUm // Filters query parameters limit results to those containing a matching value for a specific property. func (r ApiUmUsersGroupsGetRequest) Filter(key string, value string) ApiUmUsersGroupsGetRequest { - filterKey := fmt.Sprintf(FilterQueryParam, key) + filterKey := fmt.Sprintf("filter.%s", key) r.filters[filterKey] = append(r.filters[filterKey], value) return r } @@ -3791,7 +3586,7 @@ func (r ApiUmUsersGroupsGetRequest) MaxResults(maxResults int32) ApiUmUsersGroup return r } -func (r ApiUmUsersGroupsGetRequest) Execute() (ResourceGroups, *APIResponse, error) { +func (r ApiUmUsersGroupsGetRequest) Execute() (ResourceGroups, *shared.APIResponse, error) { return r.ApiService.UmUsersGroupsGetExecute(r) } @@ -3815,7 +3610,7 @@ func (a *UserManagementApiService) UmUsersGroupsGet(ctx _context.Context, userId * Execute executes the request * @return ResourceGroups */ -func (a *UserManagementApiService) UmUsersGroupsGetExecute(r ApiUmUsersGroupsGetRequest) (ResourceGroups, *APIResponse, error) { +func (a *UserManagementApiService) UmUsersGroupsGetExecute(r ApiUmUsersGroupsGetRequest) (ResourceGroups, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -3827,31 +3622,23 @@ func (a *UserManagementApiService) UmUsersGroupsGetExecute(r ApiUmUsersGroupsGet localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserManagementApiService.UmUsersGroupsGet") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/um/users/{userId}/groups" - localVarPath = strings.Replace(localVarPath, "{"+"userId"+"}", _neturl.PathEscape(parameterToString(r.userId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"userId"+"}", _neturl.PathEscape(parameterValueToString(r.userId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } if r.orderBy != nil { localVarQueryParams.Add("orderBy", parameterToString(*r.orderBy, "")) @@ -3885,11 +3672,11 @@ func (a *UserManagementApiService) UmUsersGroupsGetExecute(r ApiUmUsersGroupsGet localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -3908,11 +3695,11 @@ func (a *UserManagementApiService) UmUsersGroupsGetExecute(r ApiUmUsersGroupsGet localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "UmUsersGroupsGet", } @@ -3928,28 +3715,26 @@ func (a *UserManagementApiService) UmUsersGroupsGetExecute(r ApiUmUsersGroupsGet } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -3983,7 +3768,7 @@ func (r ApiUmUsersOwnsGetRequest) XContractNumber(xContractNumber int32) ApiUmUs // Filters query parameters limit results to those containing a matching value for a specific property. func (r ApiUmUsersOwnsGetRequest) Filter(key string, value string) ApiUmUsersOwnsGetRequest { - filterKey := fmt.Sprintf(FilterQueryParam, key) + filterKey := fmt.Sprintf("filter.%s", key) r.filters[filterKey] = append(r.filters[filterKey], value) return r } @@ -4000,7 +3785,7 @@ func (r ApiUmUsersOwnsGetRequest) MaxResults(maxResults int32) ApiUmUsersOwnsGet return r } -func (r ApiUmUsersOwnsGetRequest) Execute() (ResourcesUsers, *APIResponse, error) { +func (r ApiUmUsersOwnsGetRequest) Execute() (ResourcesUsers, *shared.APIResponse, error) { return r.ApiService.UmUsersOwnsGetExecute(r) } @@ -4024,7 +3809,7 @@ func (a *UserManagementApiService) UmUsersOwnsGet(ctx _context.Context, userId s * Execute executes the request * @return ResourcesUsers */ -func (a *UserManagementApiService) UmUsersOwnsGetExecute(r ApiUmUsersOwnsGetRequest) (ResourcesUsers, *APIResponse, error) { +func (a *UserManagementApiService) UmUsersOwnsGetExecute(r ApiUmUsersOwnsGetRequest) (ResourcesUsers, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -4036,31 +3821,23 @@ func (a *UserManagementApiService) UmUsersOwnsGetExecute(r ApiUmUsersOwnsGetRequ localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserManagementApiService.UmUsersOwnsGet") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/um/users/{userId}/owns" - localVarPath = strings.Replace(localVarPath, "{"+"userId"+"}", _neturl.PathEscape(parameterToString(r.userId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"userId"+"}", _neturl.PathEscape(parameterValueToString(r.userId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } if r.orderBy != nil { localVarQueryParams.Add("orderBy", parameterToString(*r.orderBy, "")) @@ -4094,11 +3871,11 @@ func (a *UserManagementApiService) UmUsersOwnsGetExecute(r ApiUmUsersOwnsGetRequ localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -4117,11 +3894,11 @@ func (a *UserManagementApiService) UmUsersOwnsGetExecute(r ApiUmUsersOwnsGetRequ localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "UmUsersOwnsGet", } @@ -4137,28 +3914,26 @@ func (a *UserManagementApiService) UmUsersOwnsGetExecute(r ApiUmUsersOwnsGetRequ } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -4191,7 +3966,7 @@ func (r ApiUmUsersPostRequest) XContractNumber(xContractNumber int32) ApiUmUsers return r } -func (r ApiUmUsersPostRequest) Execute() (User, *APIResponse, error) { +func (r ApiUmUsersPostRequest) Execute() (User, *shared.APIResponse, error) { return r.ApiService.UmUsersPostExecute(r) } @@ -4212,7 +3987,7 @@ func (a *UserManagementApiService) UmUsersPost(ctx _context.Context) ApiUmUsersP * Execute executes the request * @return User */ -func (a *UserManagementApiService) UmUsersPostExecute(r ApiUmUsersPostRequest) (User, *APIResponse, error) { +func (a *UserManagementApiService) UmUsersPostExecute(r ApiUmUsersPostRequest) (User, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -4224,7 +3999,9 @@ func (a *UserManagementApiService) UmUsersPostExecute(r ApiUmUsersPostRequest) ( localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserManagementApiService.UmUsersPost") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/um/users" @@ -4237,20 +4014,10 @@ func (a *UserManagementApiService) UmUsersPostExecute(r ApiUmUsersPostRequest) ( } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -4271,13 +4038,13 @@ func (a *UserManagementApiService) UmUsersPostExecute(r ApiUmUsersPostRequest) ( localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.user if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -4296,11 +4063,11 @@ func (a *UserManagementApiService) UmUsersPostExecute(r ApiUmUsersPostRequest) ( localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "UmUsersPost", } @@ -4316,28 +4083,26 @@ func (a *UserManagementApiService) UmUsersPostExecute(r ApiUmUsersPostRequest) ( } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -4371,7 +4136,7 @@ func (r ApiUmUsersPutRequest) XContractNumber(xContractNumber int32) ApiUmUsersP return r } -func (r ApiUmUsersPutRequest) Execute() (User, *APIResponse, error) { +func (r ApiUmUsersPutRequest) Execute() (User, *shared.APIResponse, error) { return r.ApiService.UmUsersPutExecute(r) } @@ -4394,7 +4159,7 @@ func (a *UserManagementApiService) UmUsersPut(ctx _context.Context, userId strin * Execute executes the request * @return User */ -func (a *UserManagementApiService) UmUsersPutExecute(r ApiUmUsersPutRequest) (User, *APIResponse, error) { +func (a *UserManagementApiService) UmUsersPutExecute(r ApiUmUsersPutRequest) (User, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPut localVarPostBody interface{} @@ -4406,11 +4171,13 @@ func (a *UserManagementApiService) UmUsersPutExecute(r ApiUmUsersPutRequest) (Us localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserManagementApiService.UmUsersPut") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/um/users/{userId}" - localVarPath = strings.Replace(localVarPath, "{"+"userId"+"}", _neturl.PathEscape(parameterToString(r.userId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"userId"+"}", _neturl.PathEscape(parameterValueToString(r.userId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -4420,20 +4187,10 @@ func (a *UserManagementApiService) UmUsersPutExecute(r ApiUmUsersPutRequest) (Us } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -4454,13 +4211,13 @@ func (a *UserManagementApiService) UmUsersPutExecute(r ApiUmUsersPutRequest) (Us localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.user if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -4479,11 +4236,11 @@ func (a *UserManagementApiService) UmUsersPutExecute(r ApiUmUsersPutRequest) (Us localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "UmUsersPut", } @@ -4499,28 +4256,26 @@ func (a *UserManagementApiService) UmUsersPutExecute(r ApiUmUsersPutRequest) (Us } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/api_user_s3_keys.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/api_user_s3_keys.go similarity index 78% rename from vendor/github.com/ionos-cloud/sdk-go/v6/api_user_s3_keys.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/api_user_s3_keys.go index 536e6f8cf..5cd3ce807 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/api_user_s3_keys.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/api_user_s3_keys.go @@ -13,6 +13,7 @@ package ionoscloud import ( _context "context" "fmt" + "github.com/ionos-cloud/sdk-go-bundle/shared" "io" _nethttp "net/http" _neturl "net/url" @@ -50,7 +51,7 @@ func (r ApiUmUsersS3keysDeleteRequest) XContractNumber(xContractNumber int32) Ap return r } -func (r ApiUmUsersS3keysDeleteRequest) Execute() (*APIResponse, error) { +func (r ApiUmUsersS3keysDeleteRequest) Execute() (*shared.APIResponse, error) { return r.ApiService.UmUsersS3keysDeleteExecute(r) } @@ -74,7 +75,7 @@ func (a *UserS3KeysApiService) UmUsersS3keysDelete(ctx _context.Context, userId /* * Execute executes the request */ -func (a *UserS3KeysApiService) UmUsersS3keysDeleteExecute(r ApiUmUsersS3keysDeleteRequest) (*APIResponse, error) { +func (a *UserS3KeysApiService) UmUsersS3keysDeleteExecute(r ApiUmUsersS3keysDeleteRequest) (*shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodDelete localVarPostBody interface{} @@ -85,32 +86,24 @@ func (a *UserS3KeysApiService) UmUsersS3keysDeleteExecute(r ApiUmUsersS3keysDele localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserS3KeysApiService.UmUsersS3keysDelete") if err != nil { - return nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return nil, gerr } localVarPath := localBasePath + "/um/users/{userId}/s3keys/{keyId}" - localVarPath = strings.Replace(localVarPath, "{"+"userId"+"}", _neturl.PathEscape(parameterToString(r.userId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"keyId"+"}", _neturl.PathEscape(parameterToString(r.keyId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"userId"+"}", _neturl.PathEscape(parameterValueToString(r.userId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"keyId"+"}", _neturl.PathEscape(parameterValueToString(r.keyId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -131,11 +124,11 @@ func (a *UserS3KeysApiService) UmUsersS3keysDeleteExecute(r ApiUmUsersS3keysDele localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -154,11 +147,11 @@ func (a *UserS3KeysApiService) UmUsersS3keysDeleteExecute(r ApiUmUsersS3keysDele localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "UmUsersS3keysDelete", } @@ -174,18 +167,17 @@ func (a *UserS3KeysApiService) UmUsersS3keysDeleteExecute(r ApiUmUsersS3keysDele } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarAPIResponse, newErr } @@ -215,7 +207,7 @@ func (r ApiUmUsersS3keysFindByKeyIdRequest) XContractNumber(xContractNumber int3 return r } -func (r ApiUmUsersS3keysFindByKeyIdRequest) Execute() (S3Key, *APIResponse, error) { +func (r ApiUmUsersS3keysFindByKeyIdRequest) Execute() (S3Key, *shared.APIResponse, error) { return r.ApiService.UmUsersS3keysFindByKeyIdExecute(r) } @@ -240,7 +232,7 @@ func (a *UserS3KeysApiService) UmUsersS3keysFindByKeyId(ctx _context.Context, us * Execute executes the request * @return S3Key */ -func (a *UserS3KeysApiService) UmUsersS3keysFindByKeyIdExecute(r ApiUmUsersS3keysFindByKeyIdRequest) (S3Key, *APIResponse, error) { +func (a *UserS3KeysApiService) UmUsersS3keysFindByKeyIdExecute(r ApiUmUsersS3keysFindByKeyIdRequest) (S3Key, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -252,32 +244,24 @@ func (a *UserS3KeysApiService) UmUsersS3keysFindByKeyIdExecute(r ApiUmUsersS3key localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserS3KeysApiService.UmUsersS3keysFindByKeyId") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/um/users/{userId}/s3keys/{keyId}" - localVarPath = strings.Replace(localVarPath, "{"+"userId"+"}", _neturl.PathEscape(parameterToString(r.userId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"keyId"+"}", _neturl.PathEscape(parameterToString(r.keyId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"userId"+"}", _neturl.PathEscape(parameterValueToString(r.userId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"keyId"+"}", _neturl.PathEscape(parameterValueToString(r.keyId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -298,11 +282,11 @@ func (a *UserS3KeysApiService) UmUsersS3keysFindByKeyIdExecute(r ApiUmUsersS3key localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -321,11 +305,11 @@ func (a *UserS3KeysApiService) UmUsersS3keysFindByKeyIdExecute(r ApiUmUsersS3key localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "UmUsersS3keysFindByKeyId", } @@ -341,28 +325,26 @@ func (a *UserS3KeysApiService) UmUsersS3keysFindByKeyIdExecute(r ApiUmUsersS3key } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -396,7 +378,7 @@ func (r ApiUmUsersS3keysGetRequest) XContractNumber(xContractNumber int32) ApiUm // Filters query parameters limit results to those containing a matching value for a specific property. func (r ApiUmUsersS3keysGetRequest) Filter(key string, value string) ApiUmUsersS3keysGetRequest { - filterKey := fmt.Sprintf(FilterQueryParam, key) + filterKey := fmt.Sprintf("filter.%s", key) r.filters[filterKey] = append(r.filters[filterKey], value) return r } @@ -413,7 +395,7 @@ func (r ApiUmUsersS3keysGetRequest) MaxResults(maxResults int32) ApiUmUsersS3key return r } -func (r ApiUmUsersS3keysGetRequest) Execute() (S3Keys, *APIResponse, error) { +func (r ApiUmUsersS3keysGetRequest) Execute() (S3Keys, *shared.APIResponse, error) { return r.ApiService.UmUsersS3keysGetExecute(r) } @@ -437,7 +419,7 @@ func (a *UserS3KeysApiService) UmUsersS3keysGet(ctx _context.Context, userId str * Execute executes the request * @return S3Keys */ -func (a *UserS3KeysApiService) UmUsersS3keysGetExecute(r ApiUmUsersS3keysGetRequest) (S3Keys, *APIResponse, error) { +func (a *UserS3KeysApiService) UmUsersS3keysGetExecute(r ApiUmUsersS3keysGetRequest) (S3Keys, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -449,31 +431,23 @@ func (a *UserS3KeysApiService) UmUsersS3keysGetExecute(r ApiUmUsersS3keysGetRequ localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserS3KeysApiService.UmUsersS3keysGet") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/um/users/{userId}/s3keys" - localVarPath = strings.Replace(localVarPath, "{"+"userId"+"}", _neturl.PathEscape(parameterToString(r.userId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"userId"+"}", _neturl.PathEscape(parameterValueToString(r.userId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } if r.orderBy != nil { localVarQueryParams.Add("orderBy", parameterToString(*r.orderBy, "")) @@ -507,11 +481,11 @@ func (a *UserS3KeysApiService) UmUsersS3keysGetExecute(r ApiUmUsersS3keysGetRequ localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -530,11 +504,11 @@ func (a *UserS3KeysApiService) UmUsersS3keysGetExecute(r ApiUmUsersS3keysGetRequ localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "UmUsersS3keysGet", } @@ -550,28 +524,26 @@ func (a *UserS3KeysApiService) UmUsersS3keysGetExecute(r ApiUmUsersS3keysGetRequ } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -600,7 +572,7 @@ func (r ApiUmUsersS3keysPostRequest) XContractNumber(xContractNumber int32) ApiU return r } -func (r ApiUmUsersS3keysPostRequest) Execute() (S3Key, *APIResponse, error) { +func (r ApiUmUsersS3keysPostRequest) Execute() (S3Key, *shared.APIResponse, error) { return r.ApiService.UmUsersS3keysPostExecute(r) } @@ -623,7 +595,7 @@ func (a *UserS3KeysApiService) UmUsersS3keysPost(ctx _context.Context, userId st * Execute executes the request * @return S3Key */ -func (a *UserS3KeysApiService) UmUsersS3keysPostExecute(r ApiUmUsersS3keysPostRequest) (S3Key, *APIResponse, error) { +func (a *UserS3KeysApiService) UmUsersS3keysPostExecute(r ApiUmUsersS3keysPostRequest) (S3Key, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -635,31 +607,23 @@ func (a *UserS3KeysApiService) UmUsersS3keysPostExecute(r ApiUmUsersS3keysPostRe localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserS3KeysApiService.UmUsersS3keysPost") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/um/users/{userId}/s3keys" - localVarPath = strings.Replace(localVarPath, "{"+"userId"+"}", _neturl.PathEscape(parameterToString(r.userId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"userId"+"}", _neturl.PathEscape(parameterValueToString(r.userId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -680,11 +644,11 @@ func (a *UserS3KeysApiService) UmUsersS3keysPostExecute(r ApiUmUsersS3keysPostRe localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -703,11 +667,11 @@ func (a *UserS3KeysApiService) UmUsersS3keysPostExecute(r ApiUmUsersS3keysPostRe localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "UmUsersS3keysPost", } @@ -723,28 +687,26 @@ func (a *UserS3KeysApiService) UmUsersS3keysPostExecute(r ApiUmUsersS3keysPostRe } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -779,7 +741,7 @@ func (r ApiUmUsersS3keysPutRequest) XContractNumber(xContractNumber int32) ApiUm return r } -func (r ApiUmUsersS3keysPutRequest) Execute() (S3Key, *APIResponse, error) { +func (r ApiUmUsersS3keysPutRequest) Execute() (S3Key, *shared.APIResponse, error) { return r.ApiService.UmUsersS3keysPutExecute(r) } @@ -804,7 +766,7 @@ func (a *UserS3KeysApiService) UmUsersS3keysPut(ctx _context.Context, userId str * Execute executes the request * @return S3Key */ -func (a *UserS3KeysApiService) UmUsersS3keysPutExecute(r ApiUmUsersS3keysPutRequest) (S3Key, *APIResponse, error) { +func (a *UserS3KeysApiService) UmUsersS3keysPutExecute(r ApiUmUsersS3keysPutRequest) (S3Key, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPut localVarPostBody interface{} @@ -816,12 +778,14 @@ func (a *UserS3KeysApiService) UmUsersS3keysPutExecute(r ApiUmUsersS3keysPutRequ localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserS3KeysApiService.UmUsersS3keysPut") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/um/users/{userId}/s3keys/{keyId}" - localVarPath = strings.Replace(localVarPath, "{"+"userId"+"}", _neturl.PathEscape(parameterToString(r.userId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"keyId"+"}", _neturl.PathEscape(parameterToString(r.keyId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"userId"+"}", _neturl.PathEscape(parameterValueToString(r.userId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"keyId"+"}", _neturl.PathEscape(parameterValueToString(r.keyId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -831,20 +795,10 @@ func (a *UserS3KeysApiService) UmUsersS3keysPutExecute(r ApiUmUsersS3keysPutRequ } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -865,13 +819,13 @@ func (a *UserS3KeysApiService) UmUsersS3keysPutExecute(r ApiUmUsersS3keysPutRequ localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.s3Key if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -890,11 +844,11 @@ func (a *UserS3KeysApiService) UmUsersS3keysPutExecute(r ApiUmUsersS3keysPutRequ localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "UmUsersS3keysPut", } @@ -910,28 +864,26 @@ func (a *UserS3KeysApiService) UmUsersS3keysPutExecute(r ApiUmUsersS3keysPutRequ } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -960,7 +912,7 @@ func (r ApiUmUsersS3ssourlGetRequest) XContractNumber(xContractNumber int32) Api // Filters query parameters limit results to those containing a matching value for a specific property. func (r ApiUmUsersS3ssourlGetRequest) Filter(key string, value string) ApiUmUsersS3ssourlGetRequest { - filterKey := fmt.Sprintf(FilterQueryParam, key) + filterKey := fmt.Sprintf("filter.%s", key) r.filters[filterKey] = append(r.filters[filterKey], value) return r } @@ -977,7 +929,7 @@ func (r ApiUmUsersS3ssourlGetRequest) MaxResults(maxResults int32) ApiUmUsersS3s return r } -func (r ApiUmUsersS3ssourlGetRequest) Execute() (S3ObjectStorageSSO, *APIResponse, error) { +func (r ApiUmUsersS3ssourlGetRequest) Execute() (S3ObjectStorageSSO, *shared.APIResponse, error) { return r.ApiService.UmUsersS3ssourlGetExecute(r) } @@ -1001,7 +953,7 @@ func (a *UserS3KeysApiService) UmUsersS3ssourlGet(ctx _context.Context, userId s * Execute executes the request * @return S3ObjectStorageSSO */ -func (a *UserS3KeysApiService) UmUsersS3ssourlGetExecute(r ApiUmUsersS3ssourlGetRequest) (S3ObjectStorageSSO, *APIResponse, error) { +func (a *UserS3KeysApiService) UmUsersS3ssourlGetExecute(r ApiUmUsersS3ssourlGetRequest) (S3ObjectStorageSSO, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -1013,23 +965,20 @@ func (a *UserS3KeysApiService) UmUsersS3ssourlGetExecute(r ApiUmUsersS3ssourlGet localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UserS3KeysApiService.UmUsersS3ssourlGet") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/um/users/{userId}/s3ssourl" - localVarPath = strings.Replace(localVarPath, "{"+"userId"+"}", _neturl.PathEscape(parameterToString(r.userId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"userId"+"}", _neturl.PathEscape(parameterValueToString(r.userId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.orderBy != nil { localVarQueryParams.Add("orderBy", parameterToString(*r.orderBy, "")) @@ -1063,11 +1012,11 @@ func (a *UserS3KeysApiService) UmUsersS3ssourlGetExecute(r ApiUmUsersS3ssourlGet localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -1086,11 +1035,11 @@ func (a *UserS3KeysApiService) UmUsersS3ssourlGetExecute(r ApiUmUsersS3ssourlGet localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "UmUsersS3ssourlGet", } @@ -1106,28 +1055,26 @@ func (a *UserS3KeysApiService) UmUsersS3ssourlGetExecute(r ApiUmUsersS3ssourlGet } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/api_volumes.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/api_volumes.go similarity index 77% rename from vendor/github.com/ionos-cloud/sdk-go/v6/api_volumes.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/api_volumes.go index c194f06bd..18a2cb7ea 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/api_volumes.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/api_volumes.go @@ -13,6 +13,7 @@ package ionoscloud import ( _context "context" "fmt" + "github.com/ionos-cloud/sdk-go-bundle/shared" "io" _nethttp "net/http" _neturl "net/url" @@ -55,7 +56,7 @@ func (r ApiDatacentersVolumesCreateSnapshotPostRequest) Snapshot(snapshot Create return r } -func (r ApiDatacentersVolumesCreateSnapshotPostRequest) Execute() (Snapshot, *APIResponse, error) { +func (r ApiDatacentersVolumesCreateSnapshotPostRequest) Execute() (Snapshot, *shared.APIResponse, error) { return r.ApiService.DatacentersVolumesCreateSnapshotPostExecute(r) } @@ -80,7 +81,7 @@ func (a *VolumesApiService) DatacentersVolumesCreateSnapshotPost(ctx _context.Co * Execute executes the request * @return Snapshot */ -func (a *VolumesApiService) DatacentersVolumesCreateSnapshotPostExecute(r ApiDatacentersVolumesCreateSnapshotPostRequest) (Snapshot, *APIResponse, error) { +func (a *VolumesApiService) DatacentersVolumesCreateSnapshotPostExecute(r ApiDatacentersVolumesCreateSnapshotPostRequest) (Snapshot, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -92,32 +93,24 @@ func (a *VolumesApiService) DatacentersVolumesCreateSnapshotPostExecute(r ApiDat localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "VolumesApiService.DatacentersVolumesCreateSnapshotPost") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/volumes/{volumeId}/create-snapshot" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"volumeId"+"}", _neturl.PathEscape(parameterToString(r.volumeId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"volumeId"+"}", _neturl.PathEscape(parameterValueToString(r.volumeId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -138,13 +131,13 @@ func (a *VolumesApiService) DatacentersVolumesCreateSnapshotPostExecute(r ApiDat localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.snapshot if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -163,11 +156,11 @@ func (a *VolumesApiService) DatacentersVolumesCreateSnapshotPostExecute(r ApiDat localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersVolumesCreateSnapshotPost", } @@ -183,28 +176,26 @@ func (a *VolumesApiService) DatacentersVolumesCreateSnapshotPostExecute(r ApiDat } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -234,7 +225,7 @@ func (r ApiDatacentersVolumesDeleteRequest) XContractNumber(xContractNumber int3 return r } -func (r ApiDatacentersVolumesDeleteRequest) Execute() (*APIResponse, error) { +func (r ApiDatacentersVolumesDeleteRequest) Execute() (*shared.APIResponse, error) { return r.ApiService.DatacentersVolumesDeleteExecute(r) } @@ -258,7 +249,7 @@ func (a *VolumesApiService) DatacentersVolumesDelete(ctx _context.Context, datac /* * Execute executes the request */ -func (a *VolumesApiService) DatacentersVolumesDeleteExecute(r ApiDatacentersVolumesDeleteRequest) (*APIResponse, error) { +func (a *VolumesApiService) DatacentersVolumesDeleteExecute(r ApiDatacentersVolumesDeleteRequest) (*shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodDelete localVarPostBody interface{} @@ -269,32 +260,24 @@ func (a *VolumesApiService) DatacentersVolumesDeleteExecute(r ApiDatacentersVolu localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "VolumesApiService.DatacentersVolumesDelete") if err != nil { - return nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/volumes/{volumeId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"volumeId"+"}", _neturl.PathEscape(parameterToString(r.volumeId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"volumeId"+"}", _neturl.PathEscape(parameterValueToString(r.volumeId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -315,11 +298,11 @@ func (a *VolumesApiService) DatacentersVolumesDeleteExecute(r ApiDatacentersVolu localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -338,11 +321,11 @@ func (a *VolumesApiService) DatacentersVolumesDeleteExecute(r ApiDatacentersVolu localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersVolumesDelete", } @@ -358,18 +341,17 @@ func (a *VolumesApiService) DatacentersVolumesDeleteExecute(r ApiDatacentersVolu } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarAPIResponse, newErr } @@ -399,7 +381,7 @@ func (r ApiDatacentersVolumesFindByIdRequest) XContractNumber(xContractNumber in return r } -func (r ApiDatacentersVolumesFindByIdRequest) Execute() (Volume, *APIResponse, error) { +func (r ApiDatacentersVolumesFindByIdRequest) Execute() (Volume, *shared.APIResponse, error) { return r.ApiService.DatacentersVolumesFindByIdExecute(r) } @@ -424,7 +406,7 @@ func (a *VolumesApiService) DatacentersVolumesFindById(ctx _context.Context, dat * Execute executes the request * @return Volume */ -func (a *VolumesApiService) DatacentersVolumesFindByIdExecute(r ApiDatacentersVolumesFindByIdRequest) (Volume, *APIResponse, error) { +func (a *VolumesApiService) DatacentersVolumesFindByIdExecute(r ApiDatacentersVolumesFindByIdRequest) (Volume, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -436,32 +418,24 @@ func (a *VolumesApiService) DatacentersVolumesFindByIdExecute(r ApiDatacentersVo localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "VolumesApiService.DatacentersVolumesFindById") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/volumes/{volumeId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"volumeId"+"}", _neturl.PathEscape(parameterToString(r.volumeId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"volumeId"+"}", _neturl.PathEscape(parameterValueToString(r.volumeId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -482,11 +456,11 @@ func (a *VolumesApiService) DatacentersVolumesFindByIdExecute(r ApiDatacentersVo localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -505,11 +479,11 @@ func (a *VolumesApiService) DatacentersVolumesFindByIdExecute(r ApiDatacentersVo localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersVolumesFindById", } @@ -525,28 +499,26 @@ func (a *VolumesApiService) DatacentersVolumesFindByIdExecute(r ApiDatacentersVo } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -590,7 +562,7 @@ func (r ApiDatacentersVolumesGetRequest) Limit(limit int32) ApiDatacentersVolume // Filters query parameters limit results to those containing a matching value for a specific property. func (r ApiDatacentersVolumesGetRequest) Filter(key string, value string) ApiDatacentersVolumesGetRequest { - filterKey := fmt.Sprintf(FilterQueryParam, key) + filterKey := fmt.Sprintf("filter.%s", key) r.filters[filterKey] = append(r.filters[filterKey], value) return r } @@ -607,7 +579,7 @@ func (r ApiDatacentersVolumesGetRequest) MaxResults(maxResults int32) ApiDatacen return r } -func (r ApiDatacentersVolumesGetRequest) Execute() (Volumes, *APIResponse, error) { +func (r ApiDatacentersVolumesGetRequest) Execute() (Volumes, *shared.APIResponse, error) { return r.ApiService.DatacentersVolumesGetExecute(r) } @@ -631,7 +603,7 @@ func (a *VolumesApiService) DatacentersVolumesGet(ctx _context.Context, datacent * Execute executes the request * @return Volumes */ -func (a *VolumesApiService) DatacentersVolumesGetExecute(r ApiDatacentersVolumesGetRequest) (Volumes, *APIResponse, error) { +func (a *VolumesApiService) DatacentersVolumesGetExecute(r ApiDatacentersVolumesGetRequest) (Volumes, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodGet localVarPostBody interface{} @@ -643,47 +615,29 @@ func (a *VolumesApiService) DatacentersVolumesGetExecute(r ApiDatacentersVolumes localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "VolumesApiService.DatacentersVolumesGet") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/volumes" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } if r.offset != nil { - localVarQueryParams.Add("offset", parameterToString(*r.offset, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("offset") - if defaultQueryParam == "" { - localVarQueryParams.Add("offset", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "offset", r.offset, "") } if r.limit != nil { - localVarQueryParams.Add("limit", parameterToString(*r.limit, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("limit") - if defaultQueryParam == "" { - localVarQueryParams.Add("limit", parameterToString(1000, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "") } if r.orderBy != nil { localVarQueryParams.Add("orderBy", parameterToString(*r.orderBy, "")) @@ -717,11 +671,11 @@ func (a *VolumesApiService) DatacentersVolumesGetExecute(r ApiDatacentersVolumes localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -740,11 +694,11 @@ func (a *VolumesApiService) DatacentersVolumesGetExecute(r ApiDatacentersVolumes localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersVolumesGet", } @@ -760,28 +714,26 @@ func (a *VolumesApiService) DatacentersVolumesGetExecute(r ApiDatacentersVolumes } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -816,7 +768,7 @@ func (r ApiDatacentersVolumesPatchRequest) XContractNumber(xContractNumber int32 return r } -func (r ApiDatacentersVolumesPatchRequest) Execute() (Volume, *APIResponse, error) { +func (r ApiDatacentersVolumesPatchRequest) Execute() (Volume, *shared.APIResponse, error) { return r.ApiService.DatacentersVolumesPatchExecute(r) } @@ -841,7 +793,7 @@ func (a *VolumesApiService) DatacentersVolumesPatch(ctx _context.Context, datace * Execute executes the request * @return Volume */ -func (a *VolumesApiService) DatacentersVolumesPatchExecute(r ApiDatacentersVolumesPatchRequest) (Volume, *APIResponse, error) { +func (a *VolumesApiService) DatacentersVolumesPatchExecute(r ApiDatacentersVolumesPatchRequest) (Volume, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPatch localVarPostBody interface{} @@ -853,12 +805,14 @@ func (a *VolumesApiService) DatacentersVolumesPatchExecute(r ApiDatacentersVolum localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "VolumesApiService.DatacentersVolumesPatch") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/volumes/{volumeId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"volumeId"+"}", _neturl.PathEscape(parameterToString(r.volumeId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"volumeId"+"}", _neturl.PathEscape(parameterValueToString(r.volumeId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -868,20 +822,10 @@ func (a *VolumesApiService) DatacentersVolumesPatchExecute(r ApiDatacentersVolum } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -902,13 +846,13 @@ func (a *VolumesApiService) DatacentersVolumesPatchExecute(r ApiDatacentersVolum localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.volume if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -927,11 +871,11 @@ func (a *VolumesApiService) DatacentersVolumesPatchExecute(r ApiDatacentersVolum localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersVolumesPatch", } @@ -947,28 +891,26 @@ func (a *VolumesApiService) DatacentersVolumesPatchExecute(r ApiDatacentersVolum } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -1002,7 +944,7 @@ func (r ApiDatacentersVolumesPostRequest) XContractNumber(xContractNumber int32) return r } -func (r ApiDatacentersVolumesPostRequest) Execute() (Volume, *APIResponse, error) { +func (r ApiDatacentersVolumesPostRequest) Execute() (Volume, *shared.APIResponse, error) { return r.ApiService.DatacentersVolumesPostExecute(r) } @@ -1025,7 +967,7 @@ func (a *VolumesApiService) DatacentersVolumesPost(ctx _context.Context, datacen * Execute executes the request * @return Volume */ -func (a *VolumesApiService) DatacentersVolumesPostExecute(r ApiDatacentersVolumesPostRequest) (Volume, *APIResponse, error) { +func (a *VolumesApiService) DatacentersVolumesPostExecute(r ApiDatacentersVolumesPostRequest) (Volume, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -1037,11 +979,13 @@ func (a *VolumesApiService) DatacentersVolumesPostExecute(r ApiDatacentersVolume localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "VolumesApiService.DatacentersVolumesPost") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/volumes" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -1051,20 +995,10 @@ func (a *VolumesApiService) DatacentersVolumesPostExecute(r ApiDatacentersVolume } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -1085,13 +1019,13 @@ func (a *VolumesApiService) DatacentersVolumesPostExecute(r ApiDatacentersVolume localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.volume if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -1110,11 +1044,11 @@ func (a *VolumesApiService) DatacentersVolumesPostExecute(r ApiDatacentersVolume localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersVolumesPost", } @@ -1130,28 +1064,26 @@ func (a *VolumesApiService) DatacentersVolumesPostExecute(r ApiDatacentersVolume } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -1186,7 +1118,7 @@ func (r ApiDatacentersVolumesPutRequest) XContractNumber(xContractNumber int32) return r } -func (r ApiDatacentersVolumesPutRequest) Execute() (Volume, *APIResponse, error) { +func (r ApiDatacentersVolumesPutRequest) Execute() (Volume, *shared.APIResponse, error) { return r.ApiService.DatacentersVolumesPutExecute(r) } @@ -1211,7 +1143,7 @@ func (a *VolumesApiService) DatacentersVolumesPut(ctx _context.Context, datacent * Execute executes the request * @return Volume */ -func (a *VolumesApiService) DatacentersVolumesPutExecute(r ApiDatacentersVolumesPutRequest) (Volume, *APIResponse, error) { +func (a *VolumesApiService) DatacentersVolumesPutExecute(r ApiDatacentersVolumesPutRequest) (Volume, *shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPut localVarPostBody interface{} @@ -1223,12 +1155,14 @@ func (a *VolumesApiService) DatacentersVolumesPutExecute(r ApiDatacentersVolumes localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "VolumesApiService.DatacentersVolumesPut") if err != nil { - return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return localVarReturnValue, nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/volumes/{volumeId}" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"volumeId"+"}", _neturl.PathEscape(parameterToString(r.volumeId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"volumeId"+"}", _neturl.PathEscape(parameterValueToString(r.volumeId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} @@ -1238,20 +1172,10 @@ func (a *VolumesApiService) DatacentersVolumesPutExecute(r ApiDatacentersVolumes } if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -1272,13 +1196,13 @@ func (a *VolumesApiService) DatacentersVolumesPutExecute(r ApiDatacentersVolumes localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.volume if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -1297,11 +1221,11 @@ func (a *VolumesApiService) DatacentersVolumesPutExecute(r ApiDatacentersVolumes localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersVolumesPut", } @@ -1317,28 +1241,26 @@ func (a *VolumesApiService) DatacentersVolumesPutExecute(r ApiDatacentersVolumes } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarReturnValue, localVarAPIResponse, newErr } err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: err.Error(), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(err.Error()) return localVarReturnValue, localVarAPIResponse, newErr } @@ -1373,7 +1295,7 @@ func (r ApiDatacentersVolumesRestoreSnapshotPostRequest) RestoreSnapshot(restore return r } -func (r ApiDatacentersVolumesRestoreSnapshotPostRequest) Execute() (*APIResponse, error) { +func (r ApiDatacentersVolumesRestoreSnapshotPostRequest) Execute() (*shared.APIResponse, error) { return r.ApiService.DatacentersVolumesRestoreSnapshotPostExecute(r) } @@ -1397,7 +1319,7 @@ func (a *VolumesApiService) DatacentersVolumesRestoreSnapshotPost(ctx _context.C /* * Execute executes the request */ -func (a *VolumesApiService) DatacentersVolumesRestoreSnapshotPostExecute(r ApiDatacentersVolumesRestoreSnapshotPostRequest) (*APIResponse, error) { +func (a *VolumesApiService) DatacentersVolumesRestoreSnapshotPostExecute(r ApiDatacentersVolumesRestoreSnapshotPostRequest) (*shared.APIResponse, error) { var ( localVarHTTPMethod = _nethttp.MethodPost localVarPostBody interface{} @@ -1408,32 +1330,24 @@ func (a *VolumesApiService) DatacentersVolumesRestoreSnapshotPostExecute(r ApiDa localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "VolumesApiService.DatacentersVolumesRestoreSnapshotPost") if err != nil { - return nil, GenericOpenAPIError{error: err.Error()} + gerr := shared.GenericOpenAPIError{} + gerr.SetError(err.Error()) + return nil, gerr } localVarPath := localBasePath + "/datacenters/{datacenterId}/volumes/{volumeId}/restore-snapshot" - localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterToString(r.datacenterId, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"volumeId"+"}", _neturl.PathEscape(parameterToString(r.volumeId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"datacenterId"+"}", _neturl.PathEscape(parameterValueToString(r.datacenterId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"volumeId"+"}", _neturl.PathEscape(parameterValueToString(r.volumeId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} if r.pretty != nil { - localVarQueryParams.Add("pretty", parameterToString(*r.pretty, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("pretty") - if defaultQueryParam == "" { - localVarQueryParams.Add("pretty", parameterToString(true, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "pretty", r.pretty, "") } if r.depth != nil { - localVarQueryParams.Add("depth", parameterToString(*r.depth, "")) - } else { - defaultQueryParam := a.client.cfg.DefaultQueryParams.Get("depth") - if defaultQueryParam == "" { - localVarQueryParams.Add("depth", parameterToString(0, "")) - } + parameterAddToHeaderOrQuery(localVarQueryParams, "depth", r.depth, "") } // to determine the Content-Type header @@ -1454,13 +1368,13 @@ func (a *VolumesApiService) DatacentersVolumesRestoreSnapshotPostExecute(r ApiDa localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } if r.xContractNumber != nil { - localVarHeaderParams["X-Contract-Number"] = parameterToString(*r.xContractNumber, "") + parameterAddToHeaderOrQuery(localVarHeaderParams, "X-Contract-Number", *r.xContractNumber, "") } // body params localVarPostBody = r.restoreSnapshot if r.ctx != nil { // API Key Authentication - if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if auth, ok := r.ctx.Value(shared.ContextAPIKeys).(map[string]shared.APIKey); ok { if apiKey, ok := auth["TokenAuthentication"]; ok { var key string if apiKey.Prefix != "" { @@ -1479,11 +1393,11 @@ func (a *VolumesApiService) DatacentersVolumesRestoreSnapshotPostExecute(r ApiDa localVarHTTPResponse, httpRequestTime, err := a.client.callAPI(req) - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: localVarHTTPResponse, Method: localVarHTTPMethod, - RequestURL: localVarPath, RequestTime: httpRequestTime, + RequestURL: localVarPath, Operation: "DatacentersVolumesRestoreSnapshotPost", } @@ -1499,18 +1413,17 @@ func (a *VolumesApiService) DatacentersVolumesRestoreSnapshotPostExecute(r ApiDa } if localVarHTTPResponse.StatusCode >= 300 { - newErr := GenericOpenAPIError{ - statusCode: localVarHTTPResponse.StatusCode, - body: localVarBody, - error: fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, string(localVarBody)), - } + newErr := shared.GenericOpenAPIError{} + newErr.SetStatusCode(localVarHTTPResponse.StatusCode) + newErr.SetBody(localVarBody) + newErr.SetError(fmt.Sprintf("%s: %s", localVarHTTPResponse.Status, string(localVarBody))) var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { - newErr.error = fmt.Sprintf(FormatStringErr, localVarHTTPResponse.Status, err.Error()) + newErr.SetError(err.Error()) return localVarAPIResponse, newErr } - newErr.model = v + newErr.SetModel(v) return localVarAPIResponse, newErr } diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/client.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/client.go similarity index 81% rename from vendor/github.com/ionos-cloud/sdk-go/v6/client.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/client.go index c65903412..ed3ae24f1 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/client.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/client.go @@ -22,6 +22,7 @@ import ( "errors" "fmt" "io" + "log" "mime/multipart" "net" "net/http" @@ -34,35 +35,31 @@ import ( "strconv" "strings" "time" - "unicode/utf8" + "github.com/ionos-cloud/sdk-go-bundle/shared" "golang.org/x/oauth2" ) var ( - jsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:vnd\.[^;]+\+)?json)`) - xmlCheck = regexp.MustCompile(`(?i:(?:application|text)/xml)`) + jsonCheck = regexp.MustCompile(`(?i:(?:application|text)\/(?:vnd\.[^;]+|problem\+)?json)`) + xmlCheck = regexp.MustCompile(`(?i:(?:application|text)/xml)`) + queryParamSplit = regexp.MustCompile(`(^|&)([^&]+)`) + queryDescape = strings.NewReplacer("%5B", "[", "%5D", "]") ) -const DepthParam = "depth" - const ( RequestStatusQueued = "QUEUED" RequestStatusRunning = "RUNNING" RequestStatusFailed = "FAILED" RequestStatusDone = "DONE" - Version = "6.3.2" + Version = "v2" ) -// Constants for APIs -const FilterQueryParam = "filter.%s" -const FormatStringErr = "%s %s" - // APIClient manages communication with the CLOUD API API v6.0 // In most cases there should be only one, shared, APIClient. type APIClient struct { - cfg *Configuration + cfg *shared.Configuration common service // Reuse a single struct instead of allocating one for each service on the heap. // API Services @@ -71,10 +68,12 @@ type APIClient struct { ApplicationLoadBalancersApi *ApplicationLoadBalancersApiService - BackupUnitsApi *BackupUnitsApiService + BackupServiceApi *BackupServiceApiService ContractResourcesApi *ContractResourcesApiService + CrossConnectsApi *CrossConnectsApiService + DataCentersApi *DataCentersApiService FirewallRulesApi *FirewallRulesApiService @@ -101,8 +100,6 @@ type APIClient struct { NetworkLoadBalancersApi *NetworkLoadBalancersApiService - PrivateCrossConnectsApi *PrivateCrossConnectsApiService - RequestsApi *RequestsApiService SecurityGroupsApi *SecurityGroupsApiService @@ -126,29 +123,71 @@ type service struct { client *APIClient } +func DeepCopy(cfg *shared.Configuration) (*shared.Configuration, error) { + if cfg == nil { + return nil, nil + } + + data, err := json.Marshal(cfg) + if err != nil { + return nil, fmt.Errorf("failed to serialize configuration: %w", err) + } + + clone := &shared.Configuration{} + err = json.Unmarshal(data, clone) + if err != nil { + return nil, fmt.Errorf("failed to deserialize configuration: %w", err) + } + + return clone, nil +} + // 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 +func NewAPIClient(cfg *shared.Configuration) *APIClient { + // Attempt to deep copy the input configuration + cfgCopy, err := DeepCopy(cfg) + if err != nil { + log.Printf("Error creating deep copy of configuration: %v", err) + + // shallow copy instead as a fallback + cfgCopy := &shared.Configuration{} + *cfgCopy = *cfg + } + + // Initialize default values in the copied configuration + if cfgCopy.HTTPClient == nil { + cfgCopy.HTTPClient = http.DefaultClient + } + + if len(cfgCopy.Servers) == 0 { + cfgCopy.Servers = shared.ServerConfigurations{ + { + URL: "https://api.ionos.com/cloudapi/v6", + Description: "No description provided", + }, + } } - //enable certificate pinning if the env variable is set - pkFingerprint := os.Getenv(IonosPinnedCertEnvVar) + + // Enable certificate pinning if the environment variable is set + pkFingerprint := os.Getenv(shared.IonosPinnedCertEnvVar) if pkFingerprint != "" { httpTransport := &http.Transport{} AddPinnedCert(httpTransport, pkFingerprint) - cfg.HTTPClient.Transport = httpTransport + cfgCopy.HTTPClient.Transport = httpTransport } + // Create and initialize the API client c := &APIClient{} - c.cfg = cfg + c.cfg = cfgCopy c.common.client = c // API Services c.DefaultApi = (*DefaultApiService)(&c.common) c.ApplicationLoadBalancersApi = (*ApplicationLoadBalancersApiService)(&c.common) - c.BackupUnitsApi = (*BackupUnitsApiService)(&c.common) + c.BackupServiceApi = (*BackupServiceApiService)(&c.common) c.ContractResourcesApi = (*ContractResourcesApiService)(&c.common) + c.CrossConnectsApi = (*CrossConnectsApiService)(&c.common) c.DataCentersApi = (*DataCentersApiService)(&c.common) c.FirewallRulesApi = (*FirewallRulesApiService)(&c.common) c.FlowLogsApi = (*FlowLogsApiService)(&c.common) @@ -162,7 +201,6 @@ func NewAPIClient(cfg *Configuration) *APIClient { c.NATGatewaysApi = (*NATGatewaysApiService)(&c.common) c.NetworkInterfacesApi = (*NetworkInterfacesApiService)(&c.common) c.NetworkLoadBalancersApi = (*NetworkLoadBalancersApiService)(&c.common) - c.PrivateCrossConnectsApi = (*PrivateCrossConnectsApiService)(&c.common) c.RequestsApi = (*RequestsApiService)(&c.common) c.SecurityGroupsApi = (*SecurityGroupsApiService)(&c.common) c.ServersApi = (*ServersApiService)(&c.common) @@ -186,7 +224,7 @@ func AddPinnedCert(transport *http.Transport, pkFingerprint string) { // TLSDial can be assigned to a http.Transport's DialTLS field. type TLSDial func(ctx context.Context, network, addr string) (net.Conn, error) -// AddPinnedCertVerification returns a TLSDial function which checks that +// addPinnedCertVerification returns a TLSDial function which checks that // the remote server provides a certificate whose SHA256 fingerprint matches // the provided value. // @@ -318,6 +356,103 @@ func parameterToJson(obj interface{}) (string, error) { return string(jsonBuf), err } +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 + } +} + // callAPI do the request. func (c *APIClient) callAPI(request *http.Request) (*http.Response, time.Duration, error) { retryCount := 0 @@ -339,14 +474,14 @@ func (c *APIClient) callAPI(request *http.Request) (*http.Response, time.Duratio } } - if c.cfg.Debug || c.cfg.LogLevel.Satisfies(Trace) { + if shared.SdkLogLevel.Satisfies(shared.Trace) { dump, err := httputil.DumpRequestOut(clonedRequest, true) if err == nil { - c.cfg.Logger.Printf(" DumpRequestOut : %s\n", string(dump)) + shared.SdkLogger.Printf(" DumpRequestOut : %s\n", string(dump)) } else { - c.cfg.Logger.Printf(" DumpRequestOut err: %+v", err) + shared.SdkLogger.Printf(" DumpRequestOut err: %+v", err) } - c.cfg.Logger.Printf("\n try no: %d\n", retryCount) + shared.SdkLogger.Printf("\n try no: %d\n", retryCount) } httpRequestStartTime := time.Now() @@ -357,12 +492,12 @@ func (c *APIClient) callAPI(request *http.Request) (*http.Response, time.Duratio return resp, httpRequestTime, err } - if c.cfg.Debug || c.cfg.LogLevel.Satisfies(Trace) { + if shared.SdkLogLevel.Satisfies(shared.Trace) { dump, err := httputil.DumpResponse(resp, true) if err == nil { - c.cfg.Logger.Printf("\n DumpResponse : %s\n", string(dump)) + shared.SdkLogger.Printf("\n DumpResponse : %s\n", string(dump)) } else { - c.cfg.Logger.Printf(" DumpResponse err %+v", err) + shared.SdkLogger.Printf(" DumpResponse err %+v", err) } } @@ -393,8 +528,8 @@ func (c *APIClient) callAPI(request *http.Request) (*http.Response, time.Duratio } if retryCount >= c.GetConfig().MaxRetries { - if c.cfg.Debug || c.cfg.LogLevel.Satisfies(Debug) { - c.cfg.Logger.Printf(" Number of maximum retries exceeded (%d retries)\n", c.cfg.MaxRetries) + if shared.SdkLogLevel.Satisfies(shared.Debug) { + shared.SdkLogger.Printf(" Number of maximum retries exceeded (%d retries)\n", c.cfg.MaxRetries) } break } else { @@ -409,14 +544,12 @@ func (c *APIClient) backOff(ctx context.Context, t time.Duration) { if t > c.GetConfig().MaxWaitTime { t = c.GetConfig().MaxWaitTime } - if c.cfg.Debug || c.cfg.LogLevel.Satisfies(Debug) { - c.cfg.Logger.Printf(" sleeping %s before retrying request\n", t.String()) + if shared.SdkLogLevel.Satisfies(shared.Debug) { + shared.SdkLogger.Printf(" Sleeping %s before retrying request\n", t.String()) } - if t <= 0 { return } - timer := time.NewTimer(t) defer timer.Stop() @@ -428,7 +561,7 @@ func (c *APIClient) backOff(ctx context.Context, t time.Duration) { // 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 { +func (c *APIClient) GetConfig() *shared.Configuration { return c.cfg } @@ -446,7 +579,7 @@ func (c *APIClient) prepareRequest( var body *bytes.Buffer - val, isSetInEnv := os.LookupEnv(IonosContractNumber) + val, isSetInEnv := os.LookupEnv("IONOS_CONTRACT_NUMBER") _, isSetInMap := headerParams["X-Contract-Number"] if headerParams == nil { headerParams = make(map[string]string) @@ -520,10 +653,6 @@ func (c *APIClient) prepareRequest( headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) } - if queryParams == nil { - queryParams = make(url.Values) - } - // Setup path and query parameters url, err := url.Parse(path) if err != nil { @@ -555,7 +684,11 @@ func (c *APIClient) prepareRequest( } // Encode the parameters. - url.RawQuery = query.Encode() + 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 { @@ -594,7 +727,7 @@ func (c *APIClient) prepareRequest( // Walk through any authentication. // OAuth2 authentication - if tok, ok := ctx.Value(ContextOAuth2).(oauth2.TokenSource); ok { + if tok, ok := ctx.Value(shared.ContextOAuth2).(oauth2.TokenSource); ok { // We were able to grab an oauth2 token from the context var latestToken *oauth2.Token if latestToken, err = tok.Token(); err != nil { @@ -605,12 +738,12 @@ func (c *APIClient) prepareRequest( } // Basic HTTP Authentication - if auth, ok := ctx.Value(ContextBasicAuth).(BasicAuth); ok { + if auth, ok := ctx.Value(shared.ContextBasicAuth).(shared.BasicAuth); ok { localVarRequest.SetBasicAuth(auth.UserName, auth.Password) } // AccessToken Authentication - if auth, ok := ctx.Value(ContextAccessToken).(string); ok { + if auth, ok := ctx.Value(shared.ContextAccessToken).(string); ok { localVarRequest.Header.Add("Authorization", "Bearer "+auth) } @@ -653,7 +786,131 @@ func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err err return fmt.Errorf("undefined response type for content %s", contentType) } -func (c *APIClient) GetRequestStatus(ctx context.Context, path string) (*RequestStatus, *APIResponse, error) { +// Add a file to the multipart request +func addFile(w *multipart.Writer, fieldName, path string) error { + file, err := os.Open(path) + if err != nil { + return err + } + defer file.Close() + + 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...) +} + +// 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 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) { + err = xml.NewEncoder(bodyBuf).Encode(body) + } + + 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 (c *APIClient) GetRequestStatus(ctx context.Context, path string) (*RequestStatus, *shared.APIResponse, error) { r, err := c.prepareRequest(ctx, path, http.MethodGet, nil, nil, nil, nil, "", "", nil) if err != nil { @@ -673,7 +930,7 @@ func (c *APIClient) GetRequestStatus(ctx context.Context, path string) (*Request } - apiResponse := &APIResponse{ + apiResponse := &shared.APIResponse{ Response: resp, Method: http.MethodGet, RequestTime: httpRequestTime, @@ -719,7 +976,7 @@ const ( ) type resourceGetCallFn func(apiClient *APIClient, resourceID string) (ResourceHandler, error) -type resourceDeleteCallFn func(apiClient *APIClient, resourceID string) (*APIResponse, error) +type resourceDeleteCallFn func(apiClient *APIClient, resourceID string) (*shared.APIResponse, error) type StateChannel struct { Msg string @@ -907,7 +1164,7 @@ func (c *APIClient) WaitForDeletionAsync(ctx context.Context, fn resourceDeleteC go c.waitForDeletionWithChannel(ctx, fn, resourceID, ch) } -func (c *APIClient) WaitForRequest(ctx context.Context, path string) (*APIResponse, error) { +func (c *APIClient) WaitForRequest(ctx context.Context, path string) (*shared.APIResponse, error) { var ( localVarHTTPMethod = http.MethodGet @@ -943,7 +1200,7 @@ func (c *APIClient) WaitForRequest(ctx context.Context, path string) (*APIRespon } - localVarAPIResponse := &APIResponse{ + localVarAPIResponse := &shared.APIResponse{ Response: resp, Method: localVarHTTPMethod, RequestTime: httpRequestTime, @@ -964,8 +1221,7 @@ func (c *APIClient) WaitForRequest(ctx context.Context, path string) (*APIRespon } if resp.StatusCode != http.StatusOK { - msg := fmt.Sprintf("WaitForRequest failed; received status code %d from API", resp.StatusCode) - return localVarAPIResponse, NewGenericOpenAPIError(msg, localVarBody, nil, resp.StatusCode) + return localVarAPIResponse, fmt.Errorf("WaitForRequest failed; received status code %d from API", resp.StatusCode) } if status.Metadata != nil && status.Metadata.Status != nil { switch *status.Metadata.Status { @@ -980,7 +1236,9 @@ func (c *APIClient) WaitForRequest(ctx context.Context, path string) (*APIRespon if status.Metadata.Message != nil { message = *status.Metadata.Message } - return localVarAPIResponse, fmt.Errorf("Request %s failed: %s", id, message) + return localVarAPIResponse, errors.New( + fmt.Sprintf("Request %s failed: %s", id, message), + ) } } select { @@ -991,189 +1249,3 @@ func (c *APIClient) WaitForRequest(ctx context.Context, path string) (*APIRespon } } } - -// Add a file to the multipart request -func addFile(w *multipart.Writer, fieldName, path string) error { - file, err := os.Open(path) - if err != nil { - return err - } - defer file.Close() - - 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...) -} - -// 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 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) { - err = xml.NewEncoder(bodyBuf).Encode(body) - } - - 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 { - statusCode int - body []byte - error string - model interface{} -} - -// NewGenericOpenAPIError - constructor for GenericOpenAPIError -func NewGenericOpenAPIError(message string, body []byte, model interface{}, statusCode int) GenericOpenAPIError { - return GenericOpenAPIError{ - statusCode: statusCode, - body: body, - error: message, - model: model, - } -} - -// Error returns non-empty string if there was an error. -func (e GenericOpenAPIError) Error() string { - return e.error -} - -// SetError sets the error string -func (e *GenericOpenAPIError) SetError(error string) { - e.error = error -} - -// Body returns the raw bytes of the response -func (e GenericOpenAPIError) Body() []byte { - return e.body -} - -// SetBody sets the raw body of the error -func (e *GenericOpenAPIError) SetBody(body []byte) { - e.body = body -} - -// Model returns the unpacked model of the error -func (e GenericOpenAPIError) Model() interface{} { - return e.model -} - -// SetModel sets the model of the error -func (e *GenericOpenAPIError) SetModel(model interface{}) { - e.model = model -} - -// StatusCode returns the status code of the error -func (e GenericOpenAPIError) StatusCode() int { - return e.statusCode -} - -// SetStatusCode sets the status code of the error -func (e *GenericOpenAPIError) SetStatusCode(statusCode int) { - e.statusCode = statusCode -} diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_application_load_balancer.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_application_load_balancer.go similarity index 62% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_application_load_balancer.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_application_load_balancer.go index fc5ad8e22..f0d8e0b9c 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_application_load_balancer.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_application_load_balancer.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the ApplicationLoadBalancer type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ApplicationLoadBalancer{} + // ApplicationLoadBalancer struct for ApplicationLoadBalancer type ApplicationLoadBalancer struct { // The resource's unique identifier. @@ -21,10 +24,10 @@ type ApplicationLoadBalancer struct { // The type of object that has been created. Type *Type `json:"type,omitempty"` // The URL to the object representation (absolute path). - Href *string `json:"href,omitempty"` - Metadata *DatacenterElementMetadata `json:"metadata,omitempty"` - Properties *ApplicationLoadBalancerProperties `json:"properties"` - Entities *ApplicationLoadBalancerEntities `json:"entities,omitempty"` + Href *string `json:"href,omitempty"` + Metadata *DatacenterElementMetadata `json:"metadata,omitempty"` + Properties ApplicationLoadBalancerProperties `json:"properties"` + Entities *ApplicationLoadBalancerEntities `json:"entities,omitempty"` } // NewApplicationLoadBalancer instantiates a new ApplicationLoadBalancer object @@ -34,7 +37,7 @@ type ApplicationLoadBalancer struct { func NewApplicationLoadBalancer(properties ApplicationLoadBalancerProperties) *ApplicationLoadBalancer { this := ApplicationLoadBalancer{} - this.Properties = &properties + this.Properties = properties return &this } @@ -47,261 +50,217 @@ func NewApplicationLoadBalancerWithDefaults() *ApplicationLoadBalancer { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *ApplicationLoadBalancer) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *ApplicationLoadBalancer) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *ApplicationLoadBalancer) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *ApplicationLoadBalancer) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *ApplicationLoadBalancer) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *ApplicationLoadBalancer) GetType() *Type { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *ApplicationLoadBalancer) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *ApplicationLoadBalancer) GetType() Type { + if o == nil || IsNil(o.Type) { + var ret Type + return ret + } + return *o.Type } -// GetTypeOk returns a tuple with the Type field value +// GetTypeOk returns a tuple with the Type 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 *ApplicationLoadBalancer) GetTypeOk() (*Type, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *ApplicationLoadBalancer) SetType(v Type) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *ApplicationLoadBalancer) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *ApplicationLoadBalancer) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given Type and assigns it to the Type field. +func (o *ApplicationLoadBalancer) SetType(v Type) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *ApplicationLoadBalancer) 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 +// GetHrefOk returns a tuple with the Href 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 *ApplicationLoadBalancer) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *ApplicationLoadBalancer) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *ApplicationLoadBalancer) HasHref() bool { - if o != nil && o.Href != nil { + if o != nil && !IsNil(o.Href) { return true } return false } -// GetMetadata returns the Metadata field value -// If the value is explicit nil, nil is returned -func (o *ApplicationLoadBalancer) GetMetadata() *DatacenterElementMetadata { - if o == nil { - return nil - } - - return o.Metadata +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *ApplicationLoadBalancer) SetHref(v string) { + o.Href = &v +} +// GetMetadata returns the Metadata field value if set, zero value otherwise. +func (o *ApplicationLoadBalancer) GetMetadata() DatacenterElementMetadata { + if o == nil || IsNil(o.Metadata) { + var ret DatacenterElementMetadata + return ret + } + return *o.Metadata } -// GetMetadataOk returns a tuple with the Metadata field value +// GetMetadataOk returns a tuple with the Metadata 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 *ApplicationLoadBalancer) GetMetadataOk() (*DatacenterElementMetadata, bool) { - if o == nil { + if o == nil || IsNil(o.Metadata) { return nil, false } - return o.Metadata, true } -// SetMetadata sets field value -func (o *ApplicationLoadBalancer) SetMetadata(v DatacenterElementMetadata) { - - o.Metadata = &v - -} - // HasMetadata returns a boolean if a field has been set. func (o *ApplicationLoadBalancer) HasMetadata() bool { - if o != nil && o.Metadata != nil { + if o != nil && !IsNil(o.Metadata) { return true } return false } +// SetMetadata gets a reference to the given DatacenterElementMetadata and assigns it to the Metadata field. +func (o *ApplicationLoadBalancer) SetMetadata(v DatacenterElementMetadata) { + o.Metadata = &v +} + // GetProperties returns the Properties field value -// If the value is explicit nil, nil is returned -func (o *ApplicationLoadBalancer) GetProperties() *ApplicationLoadBalancerProperties { +func (o *ApplicationLoadBalancer) GetProperties() ApplicationLoadBalancerProperties { if o == nil { - return nil + var ret ApplicationLoadBalancerProperties + return ret } return o.Properties - } // GetPropertiesOk returns a tuple with the Properties field value // 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 *ApplicationLoadBalancer) GetPropertiesOk() (*ApplicationLoadBalancerProperties, bool) { if o == nil { return nil, false } - - return o.Properties, true + return &o.Properties, true } // SetProperties sets field value func (o *ApplicationLoadBalancer) SetProperties(v ApplicationLoadBalancerProperties) { - - o.Properties = &v - -} - -// HasProperties returns a boolean if a field has been set. -func (o *ApplicationLoadBalancer) HasProperties() bool { - if o != nil && o.Properties != nil { - return true - } - - return false + o.Properties = v } -// GetEntities returns the Entities field value -// If the value is explicit nil, nil is returned -func (o *ApplicationLoadBalancer) GetEntities() *ApplicationLoadBalancerEntities { - if o == nil { - return nil +// GetEntities returns the Entities field value if set, zero value otherwise. +func (o *ApplicationLoadBalancer) GetEntities() ApplicationLoadBalancerEntities { + if o == nil || IsNil(o.Entities) { + var ret ApplicationLoadBalancerEntities + return ret } - - return o.Entities - + return *o.Entities } -// GetEntitiesOk returns a tuple with the Entities field value +// GetEntitiesOk returns a tuple with the Entities 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 *ApplicationLoadBalancer) GetEntitiesOk() (*ApplicationLoadBalancerEntities, bool) { - if o == nil { + if o == nil || IsNil(o.Entities) { return nil, false } - return o.Entities, true } -// SetEntities sets field value -func (o *ApplicationLoadBalancer) SetEntities(v ApplicationLoadBalancerEntities) { - - o.Entities = &v - -} - // HasEntities returns a boolean if a field has been set. func (o *ApplicationLoadBalancer) HasEntities() bool { - if o != nil && o.Entities != nil { + if o != nil && !IsNil(o.Entities) { return true } return false } +// SetEntities gets a reference to the given ApplicationLoadBalancerEntities and assigns it to the Entities field. +func (o *ApplicationLoadBalancer) SetEntities(v ApplicationLoadBalancerEntities) { + o.Entities = &v +} + func (o ApplicationLoadBalancer) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ApplicationLoadBalancer) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Metadata != nil { + if !IsNil(o.Metadata) { toSerialize["metadata"] = o.Metadata } - - if o.Properties != nil { - toSerialize["properties"] = o.Properties - } - - if o.Entities != nil { + toSerialize["properties"] = o.Properties + if !IsNil(o.Entities) { toSerialize["entities"] = o.Entities } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableApplicationLoadBalancer struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_application_load_balancer_entities.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_application_load_balancer_entities.go similarity index 78% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_application_load_balancer_entities.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_application_load_balancer_entities.go index 7c1d25499..94d42fb74 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_application_load_balancer_entities.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_application_load_balancer_entities.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the ApplicationLoadBalancerEntities type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ApplicationLoadBalancerEntities{} + // ApplicationLoadBalancerEntities struct for ApplicationLoadBalancerEntities type ApplicationLoadBalancerEntities struct { Forwardingrules *ApplicationLoadBalancerForwardingRules `json:"forwardingrules,omitempty"` @@ -37,51 +40,52 @@ func NewApplicationLoadBalancerEntitiesWithDefaults() *ApplicationLoadBalancerEn return &this } -// GetForwardingrules returns the Forwardingrules field value -// If the value is explicit nil, nil is returned -func (o *ApplicationLoadBalancerEntities) GetForwardingrules() *ApplicationLoadBalancerForwardingRules { - if o == nil { - return nil +// GetForwardingrules returns the Forwardingrules field value if set, zero value otherwise. +func (o *ApplicationLoadBalancerEntities) GetForwardingrules() ApplicationLoadBalancerForwardingRules { + if o == nil || IsNil(o.Forwardingrules) { + var ret ApplicationLoadBalancerForwardingRules + return ret } - - return o.Forwardingrules - + return *o.Forwardingrules } -// GetForwardingrulesOk returns a tuple with the Forwardingrules field value +// GetForwardingrulesOk returns a tuple with the Forwardingrules 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 *ApplicationLoadBalancerEntities) GetForwardingrulesOk() (*ApplicationLoadBalancerForwardingRules, bool) { - if o == nil { + if o == nil || IsNil(o.Forwardingrules) { return nil, false } - return o.Forwardingrules, true } -// SetForwardingrules sets field value -func (o *ApplicationLoadBalancerEntities) SetForwardingrules(v ApplicationLoadBalancerForwardingRules) { - - o.Forwardingrules = &v - -} - // HasForwardingrules returns a boolean if a field has been set. func (o *ApplicationLoadBalancerEntities) HasForwardingrules() bool { - if o != nil && o.Forwardingrules != nil { + if o != nil && !IsNil(o.Forwardingrules) { return true } return false } +// SetForwardingrules gets a reference to the given ApplicationLoadBalancerForwardingRules and assigns it to the Forwardingrules field. +func (o *ApplicationLoadBalancerEntities) SetForwardingrules(v ApplicationLoadBalancerForwardingRules) { + o.Forwardingrules = &v +} + func (o ApplicationLoadBalancerEntities) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ApplicationLoadBalancerEntities) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Forwardingrules != nil { + if !IsNil(o.Forwardingrules) { toSerialize["forwardingrules"] = o.Forwardingrules } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableApplicationLoadBalancerEntities struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_application_load_balancer_forwarding_rule.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_application_load_balancer_forwarding_rule.go similarity index 67% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_application_load_balancer_forwarding_rule.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_application_load_balancer_forwarding_rule.go index 919951f4e..a99669f96 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_application_load_balancer_forwarding_rule.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_application_load_balancer_forwarding_rule.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the ApplicationLoadBalancerForwardingRule type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ApplicationLoadBalancerForwardingRule{} + // ApplicationLoadBalancerForwardingRule struct for ApplicationLoadBalancerForwardingRule type ApplicationLoadBalancerForwardingRule struct { // The resource's unique identifier. @@ -21,9 +24,9 @@ type ApplicationLoadBalancerForwardingRule struct { // The type of object that has been created. Type *Type `json:"type,omitempty"` // The URL to the object representation (absolute path). - Href *string `json:"href,omitempty"` - Metadata *DatacenterElementMetadata `json:"metadata,omitempty"` - Properties *ApplicationLoadBalancerForwardingRuleProperties `json:"properties"` + Href *string `json:"href,omitempty"` + Metadata *DatacenterElementMetadata `json:"metadata,omitempty"` + Properties ApplicationLoadBalancerForwardingRuleProperties `json:"properties"` } // NewApplicationLoadBalancerForwardingRule instantiates a new ApplicationLoadBalancerForwardingRule object @@ -33,7 +36,7 @@ type ApplicationLoadBalancerForwardingRule struct { func NewApplicationLoadBalancerForwardingRule(properties ApplicationLoadBalancerForwardingRuleProperties) *ApplicationLoadBalancerForwardingRule { this := ApplicationLoadBalancerForwardingRule{} - this.Properties = &properties + this.Properties = properties return &this } @@ -46,219 +49,182 @@ func NewApplicationLoadBalancerForwardingRuleWithDefaults() *ApplicationLoadBala return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *ApplicationLoadBalancerForwardingRule) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *ApplicationLoadBalancerForwardingRule) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *ApplicationLoadBalancerForwardingRule) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *ApplicationLoadBalancerForwardingRule) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *ApplicationLoadBalancerForwardingRule) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *ApplicationLoadBalancerForwardingRule) GetType() *Type { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *ApplicationLoadBalancerForwardingRule) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *ApplicationLoadBalancerForwardingRule) GetType() Type { + if o == nil || IsNil(o.Type) { + var ret Type + return ret + } + return *o.Type } -// GetTypeOk returns a tuple with the Type field value +// GetTypeOk returns a tuple with the Type 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 *ApplicationLoadBalancerForwardingRule) GetTypeOk() (*Type, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *ApplicationLoadBalancerForwardingRule) SetType(v Type) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *ApplicationLoadBalancerForwardingRule) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *ApplicationLoadBalancerForwardingRule) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given Type and assigns it to the Type field. +func (o *ApplicationLoadBalancerForwardingRule) SetType(v Type) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *ApplicationLoadBalancerForwardingRule) 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 +// GetHrefOk returns a tuple with the Href 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 *ApplicationLoadBalancerForwardingRule) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *ApplicationLoadBalancerForwardingRule) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *ApplicationLoadBalancerForwardingRule) HasHref() bool { - if o != nil && o.Href != nil { + if o != nil && !IsNil(o.Href) { return true } return false } -// GetMetadata returns the Metadata field value -// If the value is explicit nil, nil is returned -func (o *ApplicationLoadBalancerForwardingRule) GetMetadata() *DatacenterElementMetadata { - if o == nil { - return nil - } - - return o.Metadata +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *ApplicationLoadBalancerForwardingRule) SetHref(v string) { + o.Href = &v +} +// GetMetadata returns the Metadata field value if set, zero value otherwise. +func (o *ApplicationLoadBalancerForwardingRule) GetMetadata() DatacenterElementMetadata { + if o == nil || IsNil(o.Metadata) { + var ret DatacenterElementMetadata + return ret + } + return *o.Metadata } -// GetMetadataOk returns a tuple with the Metadata field value +// GetMetadataOk returns a tuple with the Metadata 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 *ApplicationLoadBalancerForwardingRule) GetMetadataOk() (*DatacenterElementMetadata, bool) { - if o == nil { + if o == nil || IsNil(o.Metadata) { return nil, false } - return o.Metadata, true } -// SetMetadata sets field value -func (o *ApplicationLoadBalancerForwardingRule) SetMetadata(v DatacenterElementMetadata) { - - o.Metadata = &v - -} - // HasMetadata returns a boolean if a field has been set. func (o *ApplicationLoadBalancerForwardingRule) HasMetadata() bool { - if o != nil && o.Metadata != nil { + if o != nil && !IsNil(o.Metadata) { return true } return false } +// SetMetadata gets a reference to the given DatacenterElementMetadata and assigns it to the Metadata field. +func (o *ApplicationLoadBalancerForwardingRule) SetMetadata(v DatacenterElementMetadata) { + o.Metadata = &v +} + // GetProperties returns the Properties field value -// If the value is explicit nil, nil is returned -func (o *ApplicationLoadBalancerForwardingRule) GetProperties() *ApplicationLoadBalancerForwardingRuleProperties { +func (o *ApplicationLoadBalancerForwardingRule) GetProperties() ApplicationLoadBalancerForwardingRuleProperties { if o == nil { - return nil + var ret ApplicationLoadBalancerForwardingRuleProperties + return ret } return o.Properties - } // GetPropertiesOk returns a tuple with the Properties field value // 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 *ApplicationLoadBalancerForwardingRule) GetPropertiesOk() (*ApplicationLoadBalancerForwardingRuleProperties, bool) { if o == nil { return nil, false } - - return o.Properties, true + return &o.Properties, true } // SetProperties sets field value func (o *ApplicationLoadBalancerForwardingRule) SetProperties(v ApplicationLoadBalancerForwardingRuleProperties) { - - o.Properties = &v - + o.Properties = v } -// HasProperties returns a boolean if a field has been set. -func (o *ApplicationLoadBalancerForwardingRule) HasProperties() bool { - if o != nil && o.Properties != nil { - return true +func (o ApplicationLoadBalancerForwardingRule) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } - - return false + return json.Marshal(toSerialize) } -func (o ApplicationLoadBalancerForwardingRule) MarshalJSON() ([]byte, error) { +func (o ApplicationLoadBalancerForwardingRule) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Metadata != nil { + if !IsNil(o.Metadata) { toSerialize["metadata"] = o.Metadata } - - if o.Properties != nil { - toSerialize["properties"] = o.Properties - } - - return json.Marshal(toSerialize) + toSerialize["properties"] = o.Properties + return toSerialize, nil } type NullableApplicationLoadBalancerForwardingRule struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_application_load_balancer_forwarding_rule_properties.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_application_load_balancer_forwarding_rule_properties.go similarity index 69% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_application_load_balancer_forwarding_rule_properties.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_application_load_balancer_forwarding_rule_properties.go index 5b67c0f41..12af1f9c1 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_application_load_balancer_forwarding_rule_properties.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_application_load_balancer_forwarding_rule_properties.go @@ -14,22 +14,25 @@ import ( "encoding/json" ) +// checks if the ApplicationLoadBalancerForwardingRuleProperties type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ApplicationLoadBalancerForwardingRuleProperties{} + // ApplicationLoadBalancerForwardingRuleProperties struct for ApplicationLoadBalancerForwardingRuleProperties type ApplicationLoadBalancerForwardingRuleProperties struct { // The name of the Application Load Balancer forwarding rule. - Name *string `json:"name"` + Name string `json:"name"` // The balancing protocol. - Protocol *string `json:"protocol"` + Protocol string `json:"protocol"` // The listening (inbound) IP. - ListenerIp *string `json:"listenerIp"` + ListenerIp string `json:"listenerIp"` // The listening (inbound) port number; the valid range is 1 to 65535. - ListenerPort *int32 `json:"listenerPort"` + ListenerPort int32 `json:"listenerPort"` // The maximum time in milliseconds to wait for the client to acknowledge or send data; default is 50,000 (50 seconds). ClientTimeout *int32 `json:"clientTimeout,omitempty"` // Array of items in the collection. - ServerCertificates *[]string `json:"serverCertificates,omitempty"` + ServerCertificates []string `json:"serverCertificates,omitempty"` // An array of items in the collection. The original order of rules is preserved during processing, except that rules of the 'FORWARD' type are processed after the rules with other defined actions. The relative order of the 'FORWARD' type rules is also preserved during the processing. - HttpRules *[]ApplicationLoadBalancerHttpRule `json:"httpRules,omitempty"` + HttpRules []ApplicationLoadBalancerHttpRule `json:"httpRules,omitempty"` } // NewApplicationLoadBalancerForwardingRuleProperties instantiates a new ApplicationLoadBalancerForwardingRuleProperties object @@ -39,10 +42,10 @@ type ApplicationLoadBalancerForwardingRuleProperties struct { func NewApplicationLoadBalancerForwardingRuleProperties(name string, protocol string, listenerIp string, listenerPort int32) *ApplicationLoadBalancerForwardingRuleProperties { this := ApplicationLoadBalancerForwardingRuleProperties{} - this.Name = &name - this.Protocol = &protocol - this.ListenerIp = &listenerIp - this.ListenerPort = &listenerPort + this.Name = name + this.Protocol = protocol + this.ListenerIp = listenerIp + this.ListenerPort = listenerPort return &this } @@ -56,302 +59,221 @@ func NewApplicationLoadBalancerForwardingRulePropertiesWithDefaults() *Applicati } // GetName returns the Name field value -// If the value is explicit nil, nil is returned -func (o *ApplicationLoadBalancerForwardingRuleProperties) GetName() *string { +func (o *ApplicationLoadBalancerForwardingRuleProperties) GetName() string { if o == nil { - return 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. -// NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *ApplicationLoadBalancerForwardingRuleProperties) GetNameOk() (*string, bool) { if o == nil { return nil, false } - - return o.Name, true + return &o.Name, true } // SetName sets field value func (o *ApplicationLoadBalancerForwardingRuleProperties) SetName(v string) { - - o.Name = &v - -} - -// HasName returns a boolean if a field has been set. -func (o *ApplicationLoadBalancerForwardingRuleProperties) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false + o.Name = v } // GetProtocol returns the Protocol field value -// If the value is explicit nil, nil is returned -func (o *ApplicationLoadBalancerForwardingRuleProperties) GetProtocol() *string { +func (o *ApplicationLoadBalancerForwardingRuleProperties) GetProtocol() string { if o == nil { - return nil + var ret string + return ret } return o.Protocol - } // GetProtocolOk returns a tuple with the Protocol field value // 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 *ApplicationLoadBalancerForwardingRuleProperties) GetProtocolOk() (*string, bool) { if o == nil { return nil, false } - - return o.Protocol, true + return &o.Protocol, true } // SetProtocol sets field value func (o *ApplicationLoadBalancerForwardingRuleProperties) SetProtocol(v string) { - - o.Protocol = &v - -} - -// HasProtocol returns a boolean if a field has been set. -func (o *ApplicationLoadBalancerForwardingRuleProperties) HasProtocol() bool { - if o != nil && o.Protocol != nil { - return true - } - - return false + o.Protocol = v } // GetListenerIp returns the ListenerIp field value -// If the value is explicit nil, nil is returned -func (o *ApplicationLoadBalancerForwardingRuleProperties) GetListenerIp() *string { +func (o *ApplicationLoadBalancerForwardingRuleProperties) GetListenerIp() string { if o == nil { - return nil + var ret string + return ret } return o.ListenerIp - } // GetListenerIpOk returns a tuple with the ListenerIp field value // 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 *ApplicationLoadBalancerForwardingRuleProperties) GetListenerIpOk() (*string, bool) { if o == nil { return nil, false } - - return o.ListenerIp, true + return &o.ListenerIp, true } // SetListenerIp sets field value func (o *ApplicationLoadBalancerForwardingRuleProperties) SetListenerIp(v string) { - - o.ListenerIp = &v - -} - -// HasListenerIp returns a boolean if a field has been set. -func (o *ApplicationLoadBalancerForwardingRuleProperties) HasListenerIp() bool { - if o != nil && o.ListenerIp != nil { - return true - } - - return false + o.ListenerIp = v } // GetListenerPort returns the ListenerPort field value -// If the value is explicit nil, nil is returned -func (o *ApplicationLoadBalancerForwardingRuleProperties) GetListenerPort() *int32 { +func (o *ApplicationLoadBalancerForwardingRuleProperties) GetListenerPort() int32 { if o == nil { - return nil + var ret int32 + return ret } return o.ListenerPort - } // GetListenerPortOk returns a tuple with the ListenerPort field value // 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 *ApplicationLoadBalancerForwardingRuleProperties) GetListenerPortOk() (*int32, bool) { if o == nil { return nil, false } - - return o.ListenerPort, true + return &o.ListenerPort, true } // SetListenerPort sets field value func (o *ApplicationLoadBalancerForwardingRuleProperties) SetListenerPort(v int32) { - - o.ListenerPort = &v - -} - -// HasListenerPort returns a boolean if a field has been set. -func (o *ApplicationLoadBalancerForwardingRuleProperties) HasListenerPort() bool { - if o != nil && o.ListenerPort != nil { - return true - } - - return false + o.ListenerPort = v } -// GetClientTimeout returns the ClientTimeout field value -// If the value is explicit nil, nil is returned -func (o *ApplicationLoadBalancerForwardingRuleProperties) GetClientTimeout() *int32 { - if o == nil { - return nil +// GetClientTimeout returns the ClientTimeout field value if set, zero value otherwise. +func (o *ApplicationLoadBalancerForwardingRuleProperties) GetClientTimeout() int32 { + if o == nil || IsNil(o.ClientTimeout) { + var ret int32 + return ret } - - return o.ClientTimeout - + return *o.ClientTimeout } -// GetClientTimeoutOk returns a tuple with the ClientTimeout field value +// GetClientTimeoutOk returns a tuple with the ClientTimeout 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 *ApplicationLoadBalancerForwardingRuleProperties) GetClientTimeoutOk() (*int32, bool) { - if o == nil { + if o == nil || IsNil(o.ClientTimeout) { return nil, false } - return o.ClientTimeout, true } -// SetClientTimeout sets field value -func (o *ApplicationLoadBalancerForwardingRuleProperties) SetClientTimeout(v int32) { - - o.ClientTimeout = &v - -} - // HasClientTimeout returns a boolean if a field has been set. func (o *ApplicationLoadBalancerForwardingRuleProperties) HasClientTimeout() bool { - if o != nil && o.ClientTimeout != nil { + if o != nil && !IsNil(o.ClientTimeout) { return true } return false } -// GetServerCertificates returns the ServerCertificates field value -// If the value is explicit nil, nil is returned -func (o *ApplicationLoadBalancerForwardingRuleProperties) GetServerCertificates() *[]string { - if o == nil { - return nil - } +// SetClientTimeout gets a reference to the given int32 and assigns it to the ClientTimeout field. +func (o *ApplicationLoadBalancerForwardingRuleProperties) SetClientTimeout(v int32) { + o.ClientTimeout = &v +} +// GetServerCertificates returns the ServerCertificates field value if set, zero value otherwise. +func (o *ApplicationLoadBalancerForwardingRuleProperties) GetServerCertificates() []string { + if o == nil || IsNil(o.ServerCertificates) { + var ret []string + return ret + } return o.ServerCertificates - } -// GetServerCertificatesOk returns a tuple with the ServerCertificates field value +// GetServerCertificatesOk returns a tuple with the ServerCertificates 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 *ApplicationLoadBalancerForwardingRuleProperties) GetServerCertificatesOk() (*[]string, bool) { - if o == nil { +func (o *ApplicationLoadBalancerForwardingRuleProperties) GetServerCertificatesOk() ([]string, bool) { + if o == nil || IsNil(o.ServerCertificates) { return nil, false } - return o.ServerCertificates, true } -// SetServerCertificates sets field value -func (o *ApplicationLoadBalancerForwardingRuleProperties) SetServerCertificates(v []string) { - - o.ServerCertificates = &v - -} - // HasServerCertificates returns a boolean if a field has been set. func (o *ApplicationLoadBalancerForwardingRuleProperties) HasServerCertificates() bool { - if o != nil && o.ServerCertificates != nil { + if o != nil && !IsNil(o.ServerCertificates) { return true } return false } -// GetHttpRules returns the HttpRules field value -// If the value is explicit nil, nil is returned -func (o *ApplicationLoadBalancerForwardingRuleProperties) GetHttpRules() *[]ApplicationLoadBalancerHttpRule { - if o == nil { - return nil - } +// SetServerCertificates gets a reference to the given []string and assigns it to the ServerCertificates field. +func (o *ApplicationLoadBalancerForwardingRuleProperties) SetServerCertificates(v []string) { + o.ServerCertificates = v +} +// GetHttpRules returns the HttpRules field value if set, zero value otherwise. +func (o *ApplicationLoadBalancerForwardingRuleProperties) GetHttpRules() []ApplicationLoadBalancerHttpRule { + if o == nil || IsNil(o.HttpRules) { + var ret []ApplicationLoadBalancerHttpRule + return ret + } return o.HttpRules - } -// GetHttpRulesOk returns a tuple with the HttpRules field value +// GetHttpRulesOk returns a tuple with the HttpRules 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 *ApplicationLoadBalancerForwardingRuleProperties) GetHttpRulesOk() (*[]ApplicationLoadBalancerHttpRule, bool) { - if o == nil { +func (o *ApplicationLoadBalancerForwardingRuleProperties) GetHttpRulesOk() ([]ApplicationLoadBalancerHttpRule, bool) { + if o == nil || IsNil(o.HttpRules) { return nil, false } - return o.HttpRules, true } -// SetHttpRules sets field value -func (o *ApplicationLoadBalancerForwardingRuleProperties) SetHttpRules(v []ApplicationLoadBalancerHttpRule) { - - o.HttpRules = &v - -} - // HasHttpRules returns a boolean if a field has been set. func (o *ApplicationLoadBalancerForwardingRuleProperties) HasHttpRules() bool { - if o != nil && o.HttpRules != nil { + if o != nil && !IsNil(o.HttpRules) { return true } return false } -func (o ApplicationLoadBalancerForwardingRuleProperties) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.Name != nil { - toSerialize["name"] = o.Name - } - - if o.Protocol != nil { - toSerialize["protocol"] = o.Protocol - } - - if o.ListenerIp != nil { - toSerialize["listenerIp"] = o.ListenerIp - } +// SetHttpRules gets a reference to the given []ApplicationLoadBalancerHttpRule and assigns it to the HttpRules field. +func (o *ApplicationLoadBalancerForwardingRuleProperties) SetHttpRules(v []ApplicationLoadBalancerHttpRule) { + o.HttpRules = v +} - if o.ListenerPort != nil { - toSerialize["listenerPort"] = o.ListenerPort +func (o ApplicationLoadBalancerForwardingRuleProperties) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } + return json.Marshal(toSerialize) +} - if o.ClientTimeout != nil { +func (o ApplicationLoadBalancerForwardingRuleProperties) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["name"] = o.Name + toSerialize["protocol"] = o.Protocol + toSerialize["listenerIp"] = o.ListenerIp + toSerialize["listenerPort"] = o.ListenerPort + if !IsNil(o.ClientTimeout) { toSerialize["clientTimeout"] = o.ClientTimeout } - - if o.ServerCertificates != nil { + if !IsNil(o.ServerCertificates) { toSerialize["serverCertificates"] = o.ServerCertificates } - - if o.HttpRules != nil { + if !IsNil(o.HttpRules) { toSerialize["httpRules"] = o.HttpRules } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableApplicationLoadBalancerForwardingRuleProperties struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_application_load_balancer_forwarding_rule_put.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_application_load_balancer_forwarding_rule_put.go similarity index 71% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_application_load_balancer_forwarding_rule_put.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_application_load_balancer_forwarding_rule_put.go index cf9887206..76d22579a 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_application_load_balancer_forwarding_rule_put.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_application_load_balancer_forwarding_rule_put.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the ApplicationLoadBalancerForwardingRulePut type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ApplicationLoadBalancerForwardingRulePut{} + // ApplicationLoadBalancerForwardingRulePut struct for ApplicationLoadBalancerForwardingRulePut type ApplicationLoadBalancerForwardingRulePut struct { // The resource's unique identifier. @@ -21,8 +24,8 @@ type ApplicationLoadBalancerForwardingRulePut struct { // The type of object that has been created. Type *Type `json:"type,omitempty"` // The URL to the object representation (absolute path). - Href *string `json:"href,omitempty"` - Properties *ApplicationLoadBalancerForwardingRuleProperties `json:"properties"` + Href *string `json:"href,omitempty"` + Properties ApplicationLoadBalancerForwardingRuleProperties `json:"properties"` } // NewApplicationLoadBalancerForwardingRulePut instantiates a new ApplicationLoadBalancerForwardingRulePut object @@ -32,7 +35,7 @@ type ApplicationLoadBalancerForwardingRulePut struct { func NewApplicationLoadBalancerForwardingRulePut(properties ApplicationLoadBalancerForwardingRuleProperties) *ApplicationLoadBalancerForwardingRulePut { this := ApplicationLoadBalancerForwardingRulePut{} - this.Properties = &properties + this.Properties = properties return &this } @@ -45,177 +48,147 @@ func NewApplicationLoadBalancerForwardingRulePutWithDefaults() *ApplicationLoadB return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *ApplicationLoadBalancerForwardingRulePut) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *ApplicationLoadBalancerForwardingRulePut) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *ApplicationLoadBalancerForwardingRulePut) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *ApplicationLoadBalancerForwardingRulePut) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *ApplicationLoadBalancerForwardingRulePut) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *ApplicationLoadBalancerForwardingRulePut) GetType() *Type { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *ApplicationLoadBalancerForwardingRulePut) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *ApplicationLoadBalancerForwardingRulePut) GetType() Type { + if o == nil || IsNil(o.Type) { + var ret Type + return ret + } + return *o.Type } -// GetTypeOk returns a tuple with the Type field value +// GetTypeOk returns a tuple with the Type 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 *ApplicationLoadBalancerForwardingRulePut) GetTypeOk() (*Type, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *ApplicationLoadBalancerForwardingRulePut) SetType(v Type) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *ApplicationLoadBalancerForwardingRulePut) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *ApplicationLoadBalancerForwardingRulePut) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given Type and assigns it to the Type field. +func (o *ApplicationLoadBalancerForwardingRulePut) SetType(v Type) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *ApplicationLoadBalancerForwardingRulePut) 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 +// GetHrefOk returns a tuple with the Href 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 *ApplicationLoadBalancerForwardingRulePut) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *ApplicationLoadBalancerForwardingRulePut) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *ApplicationLoadBalancerForwardingRulePut) HasHref() bool { - if o != nil && o.Href != nil { + 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 *ApplicationLoadBalancerForwardingRulePut) SetHref(v string) { + o.Href = &v +} + // GetProperties returns the Properties field value -// If the value is explicit nil, nil is returned -func (o *ApplicationLoadBalancerForwardingRulePut) GetProperties() *ApplicationLoadBalancerForwardingRuleProperties { +func (o *ApplicationLoadBalancerForwardingRulePut) GetProperties() ApplicationLoadBalancerForwardingRuleProperties { if o == nil { - return nil + var ret ApplicationLoadBalancerForwardingRuleProperties + return ret } return o.Properties - } // GetPropertiesOk returns a tuple with the Properties field value // 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 *ApplicationLoadBalancerForwardingRulePut) GetPropertiesOk() (*ApplicationLoadBalancerForwardingRuleProperties, bool) { if o == nil { return nil, false } - - return o.Properties, true + return &o.Properties, true } // SetProperties sets field value func (o *ApplicationLoadBalancerForwardingRulePut) SetProperties(v ApplicationLoadBalancerForwardingRuleProperties) { - - o.Properties = &v - + o.Properties = v } -// HasProperties returns a boolean if a field has been set. -func (o *ApplicationLoadBalancerForwardingRulePut) HasProperties() bool { - if o != nil && o.Properties != nil { - return true +func (o ApplicationLoadBalancerForwardingRulePut) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } - - return false + return json.Marshal(toSerialize) } -func (o ApplicationLoadBalancerForwardingRulePut) MarshalJSON() ([]byte, error) { +func (o ApplicationLoadBalancerForwardingRulePut) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Properties != nil { - toSerialize["properties"] = o.Properties - } - - return json.Marshal(toSerialize) + toSerialize["properties"] = o.Properties + return toSerialize, nil } type NullableApplicationLoadBalancerForwardingRulePut struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_application_load_balancer_forwarding_rules.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_application_load_balancer_forwarding_rules.go similarity index 62% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_application_load_balancer_forwarding_rules.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_application_load_balancer_forwarding_rules.go index 135f22db1..9f86fac48 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_application_load_balancer_forwarding_rules.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_application_load_balancer_forwarding_rules.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the ApplicationLoadBalancerForwardingRules type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ApplicationLoadBalancerForwardingRules{} + // ApplicationLoadBalancerForwardingRules struct for ApplicationLoadBalancerForwardingRules type ApplicationLoadBalancerForwardingRules struct { // The resource's unique identifier. @@ -23,7 +26,7 @@ type ApplicationLoadBalancerForwardingRules struct { // The URL to the object representation (absolute path). Href *string `json:"href,omitempty"` // Array of items in the collection. - Items *[]ApplicationLoadBalancerForwardingRule `json:"items,omitempty"` + Items []ApplicationLoadBalancerForwardingRule `json:"items,omitempty"` // The offset (if specified in the request). Offset *float32 `json:"offset,omitempty"` // The limit (if specified in the request). @@ -49,303 +52,262 @@ func NewApplicationLoadBalancerForwardingRulesWithDefaults() *ApplicationLoadBal return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *ApplicationLoadBalancerForwardingRules) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *ApplicationLoadBalancerForwardingRules) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *ApplicationLoadBalancerForwardingRules) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *ApplicationLoadBalancerForwardingRules) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *ApplicationLoadBalancerForwardingRules) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *ApplicationLoadBalancerForwardingRules) GetType() *Type { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *ApplicationLoadBalancerForwardingRules) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *ApplicationLoadBalancerForwardingRules) GetType() Type { + if o == nil || IsNil(o.Type) { + var ret Type + return ret + } + return *o.Type } -// GetTypeOk returns a tuple with the Type field value +// GetTypeOk returns a tuple with the Type 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 *ApplicationLoadBalancerForwardingRules) GetTypeOk() (*Type, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *ApplicationLoadBalancerForwardingRules) SetType(v Type) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *ApplicationLoadBalancerForwardingRules) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *ApplicationLoadBalancerForwardingRules) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given Type and assigns it to the Type field. +func (o *ApplicationLoadBalancerForwardingRules) SetType(v Type) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *ApplicationLoadBalancerForwardingRules) 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 +// GetHrefOk returns a tuple with the Href 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 *ApplicationLoadBalancerForwardingRules) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *ApplicationLoadBalancerForwardingRules) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *ApplicationLoadBalancerForwardingRules) HasHref() bool { - if o != nil && o.Href != nil { + if o != nil && !IsNil(o.Href) { return true } return false } -// GetItems returns the Items field value -// If the value is explicit nil, nil is returned -func (o *ApplicationLoadBalancerForwardingRules) GetItems() *[]ApplicationLoadBalancerForwardingRule { - if o == nil { - return nil - } +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *ApplicationLoadBalancerForwardingRules) SetHref(v string) { + o.Href = &v +} +// GetItems returns the Items field value if set, zero value otherwise. +func (o *ApplicationLoadBalancerForwardingRules) GetItems() []ApplicationLoadBalancerForwardingRule { + if o == nil || IsNil(o.Items) { + var ret []ApplicationLoadBalancerForwardingRule + return ret + } return o.Items - } -// GetItemsOk returns a tuple with the Items field value +// GetItemsOk returns a tuple with the Items 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 *ApplicationLoadBalancerForwardingRules) GetItemsOk() (*[]ApplicationLoadBalancerForwardingRule, bool) { - if o == nil { +func (o *ApplicationLoadBalancerForwardingRules) GetItemsOk() ([]ApplicationLoadBalancerForwardingRule, bool) { + if o == nil || IsNil(o.Items) { return nil, false } - return o.Items, true } -// SetItems sets field value -func (o *ApplicationLoadBalancerForwardingRules) SetItems(v []ApplicationLoadBalancerForwardingRule) { - - o.Items = &v - -} - // HasItems returns a boolean if a field has been set. func (o *ApplicationLoadBalancerForwardingRules) HasItems() bool { - if o != nil && o.Items != nil { + if o != nil && !IsNil(o.Items) { return true } return false } -// GetOffset returns the Offset field value -// If the value is explicit nil, nil is returned -func (o *ApplicationLoadBalancerForwardingRules) GetOffset() *float32 { - if o == nil { - return nil - } - - return o.Offset +// SetItems gets a reference to the given []ApplicationLoadBalancerForwardingRule and assigns it to the Items field. +func (o *ApplicationLoadBalancerForwardingRules) SetItems(v []ApplicationLoadBalancerForwardingRule) { + o.Items = v +} +// GetOffset returns the Offset field value if set, zero value otherwise. +func (o *ApplicationLoadBalancerForwardingRules) GetOffset() float32 { + if o == nil || IsNil(o.Offset) { + var ret float32 + return ret + } + return *o.Offset } -// GetOffsetOk returns a tuple with the Offset field value +// GetOffsetOk returns a tuple with the Offset 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 *ApplicationLoadBalancerForwardingRules) GetOffsetOk() (*float32, bool) { - if o == nil { + if o == nil || IsNil(o.Offset) { return nil, false } - return o.Offset, true } -// SetOffset sets field value -func (o *ApplicationLoadBalancerForwardingRules) SetOffset(v float32) { - - o.Offset = &v - -} - // HasOffset returns a boolean if a field has been set. func (o *ApplicationLoadBalancerForwardingRules) HasOffset() bool { - if o != nil && o.Offset != nil { + if o != nil && !IsNil(o.Offset) { return true } return false } -// GetLimit returns the Limit field value -// If the value is explicit nil, nil is returned -func (o *ApplicationLoadBalancerForwardingRules) GetLimit() *float32 { - if o == nil { - return nil - } - - return o.Limit +// SetOffset gets a reference to the given float32 and assigns it to the Offset field. +func (o *ApplicationLoadBalancerForwardingRules) SetOffset(v float32) { + o.Offset = &v +} +// GetLimit returns the Limit field value if set, zero value otherwise. +func (o *ApplicationLoadBalancerForwardingRules) GetLimit() float32 { + if o == nil || IsNil(o.Limit) { + var ret float32 + return ret + } + return *o.Limit } -// GetLimitOk returns a tuple with the Limit field value +// GetLimitOk returns a tuple with the Limit 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 *ApplicationLoadBalancerForwardingRules) GetLimitOk() (*float32, bool) { - if o == nil { + if o == nil || IsNil(o.Limit) { return nil, false } - return o.Limit, true } -// SetLimit sets field value -func (o *ApplicationLoadBalancerForwardingRules) SetLimit(v float32) { - - o.Limit = &v - -} - // HasLimit returns a boolean if a field has been set. func (o *ApplicationLoadBalancerForwardingRules) HasLimit() bool { - if o != nil && o.Limit != nil { + if o != nil && !IsNil(o.Limit) { return true } return false } -// GetLinks returns the Links field value -// If the value is explicit nil, nil is returned -func (o *ApplicationLoadBalancerForwardingRules) GetLinks() *PaginationLinks { - if o == nil { - return nil - } - - return o.Links +// SetLimit gets a reference to the given float32 and assigns it to the Limit field. +func (o *ApplicationLoadBalancerForwardingRules) SetLimit(v float32) { + o.Limit = &v +} +// GetLinks returns the Links field value if set, zero value otherwise. +func (o *ApplicationLoadBalancerForwardingRules) GetLinks() PaginationLinks { + if o == nil || IsNil(o.Links) { + var ret PaginationLinks + return ret + } + return *o.Links } -// GetLinksOk returns a tuple with the Links field value +// GetLinksOk returns a tuple with the Links 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 *ApplicationLoadBalancerForwardingRules) GetLinksOk() (*PaginationLinks, bool) { - if o == nil { + if o == nil || IsNil(o.Links) { return nil, false } - return o.Links, true } -// SetLinks sets field value -func (o *ApplicationLoadBalancerForwardingRules) SetLinks(v PaginationLinks) { - - o.Links = &v - -} - // HasLinks returns a boolean if a field has been set. func (o *ApplicationLoadBalancerForwardingRules) HasLinks() bool { - if o != nil && o.Links != nil { + if o != nil && !IsNil(o.Links) { return true } return false } +// SetLinks gets a reference to the given PaginationLinks and assigns it to the Links field. +func (o *ApplicationLoadBalancerForwardingRules) SetLinks(v PaginationLinks) { + o.Links = &v +} + func (o ApplicationLoadBalancerForwardingRules) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ApplicationLoadBalancerForwardingRules) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Items != nil { + if !IsNil(o.Items) { toSerialize["items"] = o.Items } - - if o.Offset != nil { + if !IsNil(o.Offset) { toSerialize["offset"] = o.Offset } - - if o.Limit != nil { + if !IsNil(o.Limit) { toSerialize["limit"] = o.Limit } - - if o.Links != nil { + if !IsNil(o.Links) { toSerialize["_links"] = o.Links } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableApplicationLoadBalancerForwardingRules struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_application_load_balancer_http_rule.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_application_load_balancer_http_rule.go similarity index 66% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_application_load_balancer_http_rule.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_application_load_balancer_http_rule.go index 78fd43ae4..150de5591 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_application_load_balancer_http_rule.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_application_load_balancer_http_rule.go @@ -14,12 +14,15 @@ import ( "encoding/json" ) +// checks if the ApplicationLoadBalancerHttpRule type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ApplicationLoadBalancerHttpRule{} + // ApplicationLoadBalancerHttpRule struct for ApplicationLoadBalancerHttpRule type ApplicationLoadBalancerHttpRule struct { // The unique name of the Application Load Balancer HTTP rule. - Name *string `json:"name"` + Name string `json:"name"` // The HTTP rule type. - Type *string `json:"type"` + Type string `json:"type"` // The ID of the target group; this parameter is mandatory and is valid only for 'FORWARD' actions. TargetGroup *string `json:"targetGroup,omitempty"` // Indicates whether the query part of the URI should be dropped and is valid only for 'REDIRECT' actions. Default value is 'FALSE', the redirect URI does not contain any query parameters. @@ -33,7 +36,7 @@ type ApplicationLoadBalancerHttpRule struct { // Specifies the content type and is valid only for 'STATIC' actions. ContentType *string `json:"contentType,omitempty"` // An array of items in the collection. The action will be executed only if each condition is met; the rule will always be applied if no conditions are set. - Conditions *[]ApplicationLoadBalancerHttpRuleCondition `json:"conditions,omitempty"` + Conditions []ApplicationLoadBalancerHttpRuleCondition `json:"conditions,omitempty"` } // NewApplicationLoadBalancerHttpRule instantiates a new ApplicationLoadBalancerHttpRule object @@ -43,8 +46,8 @@ type ApplicationLoadBalancerHttpRule struct { func NewApplicationLoadBalancerHttpRule(name string, type_ string) *ApplicationLoadBalancerHttpRule { this := ApplicationLoadBalancerHttpRule{} - this.Name = &name - this.Type = &type_ + this.Name = name + this.Type = type_ return &this } @@ -58,386 +61,311 @@ func NewApplicationLoadBalancerHttpRuleWithDefaults() *ApplicationLoadBalancerHt } // GetName returns the Name field value -// If the value is explicit nil, nil is returned -func (o *ApplicationLoadBalancerHttpRule) GetName() *string { +func (o *ApplicationLoadBalancerHttpRule) GetName() string { if o == nil { - return 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. -// NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *ApplicationLoadBalancerHttpRule) GetNameOk() (*string, bool) { if o == nil { return nil, false } - - return o.Name, true + return &o.Name, true } // SetName sets field value func (o *ApplicationLoadBalancerHttpRule) SetName(v string) { - - o.Name = &v - -} - -// HasName returns a boolean if a field has been set. -func (o *ApplicationLoadBalancerHttpRule) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false + o.Name = v } // GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *ApplicationLoadBalancerHttpRule) GetType() *string { +func (o *ApplicationLoadBalancerHttpRule) GetType() string { if o == nil { - return 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. -// NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *ApplicationLoadBalancerHttpRule) GetTypeOk() (*string, bool) { if o == nil { return nil, false } - - return o.Type, true + return &o.Type, true } // SetType sets field value func (o *ApplicationLoadBalancerHttpRule) SetType(v string) { - - o.Type = &v - + o.Type = v } -// HasType returns a boolean if a field has been set. -func (o *ApplicationLoadBalancerHttpRule) HasType() bool { - if o != nil && o.Type != nil { - return true +// GetTargetGroup returns the TargetGroup field value if set, zero value otherwise. +func (o *ApplicationLoadBalancerHttpRule) GetTargetGroup() string { + if o == nil || IsNil(o.TargetGroup) { + var ret string + return ret } - - return false + return *o.TargetGroup } -// GetTargetGroup returns the TargetGroup field value -// If the value is explicit nil, nil is returned -func (o *ApplicationLoadBalancerHttpRule) GetTargetGroup() *string { - if o == nil { - return nil - } - - return o.TargetGroup - -} - -// GetTargetGroupOk returns a tuple with the TargetGroup field value +// GetTargetGroupOk returns a tuple with the TargetGroup 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 *ApplicationLoadBalancerHttpRule) GetTargetGroupOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.TargetGroup) { return nil, false } - return o.TargetGroup, true } -// SetTargetGroup sets field value -func (o *ApplicationLoadBalancerHttpRule) SetTargetGroup(v string) { - - o.TargetGroup = &v - -} - // HasTargetGroup returns a boolean if a field has been set. func (o *ApplicationLoadBalancerHttpRule) HasTargetGroup() bool { - if o != nil && o.TargetGroup != nil { + if o != nil && !IsNil(o.TargetGroup) { return true } return false } -// GetDropQuery returns the DropQuery field value -// If the value is explicit nil, nil is returned -func (o *ApplicationLoadBalancerHttpRule) GetDropQuery() *bool { - if o == nil { - return nil - } - - return o.DropQuery +// SetTargetGroup gets a reference to the given string and assigns it to the TargetGroup field. +func (o *ApplicationLoadBalancerHttpRule) SetTargetGroup(v string) { + o.TargetGroup = &v +} +// GetDropQuery returns the DropQuery field value if set, zero value otherwise. +func (o *ApplicationLoadBalancerHttpRule) GetDropQuery() bool { + if o == nil || IsNil(o.DropQuery) { + var ret bool + return ret + } + return *o.DropQuery } -// GetDropQueryOk returns a tuple with the DropQuery field value +// GetDropQueryOk returns a tuple with the DropQuery 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 *ApplicationLoadBalancerHttpRule) GetDropQueryOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.DropQuery) { return nil, false } - return o.DropQuery, true } -// SetDropQuery sets field value -func (o *ApplicationLoadBalancerHttpRule) SetDropQuery(v bool) { - - o.DropQuery = &v - -} - // HasDropQuery returns a boolean if a field has been set. func (o *ApplicationLoadBalancerHttpRule) HasDropQuery() bool { - if o != nil && o.DropQuery != nil { + if o != nil && !IsNil(o.DropQuery) { return true } return false } -// GetLocation returns the Location field value -// If the value is explicit nil, nil is returned -func (o *ApplicationLoadBalancerHttpRule) GetLocation() *string { - if o == nil { - return nil - } - - return o.Location +// SetDropQuery gets a reference to the given bool and assigns it to the DropQuery field. +func (o *ApplicationLoadBalancerHttpRule) SetDropQuery(v bool) { + o.DropQuery = &v +} +// GetLocation returns the Location field value if set, zero value otherwise. +func (o *ApplicationLoadBalancerHttpRule) GetLocation() string { + if o == nil || IsNil(o.Location) { + var ret string + return ret + } + return *o.Location } -// GetLocationOk returns a tuple with the Location field value +// GetLocationOk returns a tuple with the Location 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 *ApplicationLoadBalancerHttpRule) GetLocationOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Location) { return nil, false } - return o.Location, true } -// SetLocation sets field value -func (o *ApplicationLoadBalancerHttpRule) SetLocation(v string) { - - o.Location = &v - -} - // HasLocation returns a boolean if a field has been set. func (o *ApplicationLoadBalancerHttpRule) HasLocation() bool { - if o != nil && o.Location != nil { + if o != nil && !IsNil(o.Location) { return true } return false } -// GetStatusCode returns the StatusCode field value -// If the value is explicit nil, nil is returned -func (o *ApplicationLoadBalancerHttpRule) GetStatusCode() *int32 { - if o == nil { - return nil - } - - return o.StatusCode +// SetLocation gets a reference to the given string and assigns it to the Location field. +func (o *ApplicationLoadBalancerHttpRule) SetLocation(v string) { + o.Location = &v +} +// GetStatusCode returns the StatusCode field value if set, zero value otherwise. +func (o *ApplicationLoadBalancerHttpRule) GetStatusCode() int32 { + if o == nil || IsNil(o.StatusCode) { + var ret int32 + return ret + } + return *o.StatusCode } -// GetStatusCodeOk returns a tuple with the StatusCode field value +// GetStatusCodeOk returns a tuple with the StatusCode 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 *ApplicationLoadBalancerHttpRule) GetStatusCodeOk() (*int32, bool) { - if o == nil { + if o == nil || IsNil(o.StatusCode) { return nil, false } - return o.StatusCode, true } -// SetStatusCode sets field value -func (o *ApplicationLoadBalancerHttpRule) SetStatusCode(v int32) { - - o.StatusCode = &v - -} - // HasStatusCode returns a boolean if a field has been set. func (o *ApplicationLoadBalancerHttpRule) HasStatusCode() bool { - if o != nil && o.StatusCode != nil { + if o != nil && !IsNil(o.StatusCode) { return true } return false } -// GetResponseMessage returns the ResponseMessage field value -// If the value is explicit nil, nil is returned -func (o *ApplicationLoadBalancerHttpRule) GetResponseMessage() *string { - if o == nil { - return nil - } - - return o.ResponseMessage +// SetStatusCode gets a reference to the given int32 and assigns it to the StatusCode field. +func (o *ApplicationLoadBalancerHttpRule) SetStatusCode(v int32) { + o.StatusCode = &v +} +// GetResponseMessage returns the ResponseMessage field value if set, zero value otherwise. +func (o *ApplicationLoadBalancerHttpRule) GetResponseMessage() string { + if o == nil || IsNil(o.ResponseMessage) { + var ret string + return ret + } + return *o.ResponseMessage } -// GetResponseMessageOk returns a tuple with the ResponseMessage field value +// GetResponseMessageOk returns a tuple with the ResponseMessage 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 *ApplicationLoadBalancerHttpRule) GetResponseMessageOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.ResponseMessage) { return nil, false } - return o.ResponseMessage, true } -// SetResponseMessage sets field value -func (o *ApplicationLoadBalancerHttpRule) SetResponseMessage(v string) { - - o.ResponseMessage = &v - -} - // HasResponseMessage returns a boolean if a field has been set. func (o *ApplicationLoadBalancerHttpRule) HasResponseMessage() bool { - if o != nil && o.ResponseMessage != nil { + if o != nil && !IsNil(o.ResponseMessage) { return true } return false } -// GetContentType returns the ContentType field value -// If the value is explicit nil, nil is returned -func (o *ApplicationLoadBalancerHttpRule) GetContentType() *string { - if o == nil { - return nil - } - - return o.ContentType +// SetResponseMessage gets a reference to the given string and assigns it to the ResponseMessage field. +func (o *ApplicationLoadBalancerHttpRule) SetResponseMessage(v string) { + o.ResponseMessage = &v +} +// GetContentType returns the ContentType field value if set, zero value otherwise. +func (o *ApplicationLoadBalancerHttpRule) GetContentType() string { + if o == nil || IsNil(o.ContentType) { + var ret string + return ret + } + return *o.ContentType } -// GetContentTypeOk returns a tuple with the ContentType field value +// GetContentTypeOk returns a tuple with the ContentType 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 *ApplicationLoadBalancerHttpRule) GetContentTypeOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.ContentType) { return nil, false } - return o.ContentType, true } -// SetContentType sets field value -func (o *ApplicationLoadBalancerHttpRule) SetContentType(v string) { - - o.ContentType = &v - -} - // HasContentType returns a boolean if a field has been set. func (o *ApplicationLoadBalancerHttpRule) HasContentType() bool { - if o != nil && o.ContentType != nil { + if o != nil && !IsNil(o.ContentType) { return true } return false } -// GetConditions returns the Conditions field value -// If the value is explicit nil, nil is returned -func (o *ApplicationLoadBalancerHttpRule) GetConditions() *[]ApplicationLoadBalancerHttpRuleCondition { - if o == nil { - return nil - } +// SetContentType gets a reference to the given string and assigns it to the ContentType field. +func (o *ApplicationLoadBalancerHttpRule) SetContentType(v string) { + o.ContentType = &v +} +// GetConditions returns the Conditions field value if set, zero value otherwise. +func (o *ApplicationLoadBalancerHttpRule) GetConditions() []ApplicationLoadBalancerHttpRuleCondition { + if o == nil || IsNil(o.Conditions) { + var ret []ApplicationLoadBalancerHttpRuleCondition + return ret + } return o.Conditions - } -// GetConditionsOk returns a tuple with the Conditions field value +// GetConditionsOk returns a tuple with the Conditions 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 *ApplicationLoadBalancerHttpRule) GetConditionsOk() (*[]ApplicationLoadBalancerHttpRuleCondition, bool) { - if o == nil { +func (o *ApplicationLoadBalancerHttpRule) GetConditionsOk() ([]ApplicationLoadBalancerHttpRuleCondition, bool) { + if o == nil || IsNil(o.Conditions) { return nil, false } - return o.Conditions, true } -// SetConditions sets field value -func (o *ApplicationLoadBalancerHttpRule) SetConditions(v []ApplicationLoadBalancerHttpRuleCondition) { - - o.Conditions = &v - -} - // HasConditions returns a boolean if a field has been set. func (o *ApplicationLoadBalancerHttpRule) HasConditions() bool { - if o != nil && o.Conditions != nil { + if o != nil && !IsNil(o.Conditions) { return true } return false } -func (o ApplicationLoadBalancerHttpRule) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.Name != nil { - toSerialize["name"] = o.Name - } +// SetConditions gets a reference to the given []ApplicationLoadBalancerHttpRuleCondition and assigns it to the Conditions field. +func (o *ApplicationLoadBalancerHttpRule) SetConditions(v []ApplicationLoadBalancerHttpRuleCondition) { + o.Conditions = v +} - if o.Type != nil { - toSerialize["type"] = o.Type +func (o ApplicationLoadBalancerHttpRule) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } + return json.Marshal(toSerialize) +} - if o.TargetGroup != nil { +func (o ApplicationLoadBalancerHttpRule) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["name"] = o.Name + toSerialize["type"] = o.Type + if !IsNil(o.TargetGroup) { toSerialize["targetGroup"] = o.TargetGroup } - - if o.DropQuery != nil { + if !IsNil(o.DropQuery) { toSerialize["dropQuery"] = o.DropQuery } - - if o.Location != nil { + if !IsNil(o.Location) { toSerialize["location"] = o.Location } - - if o.StatusCode != nil { + if !IsNil(o.StatusCode) { toSerialize["statusCode"] = o.StatusCode } - - if o.ResponseMessage != nil { + if !IsNil(o.ResponseMessage) { toSerialize["responseMessage"] = o.ResponseMessage } - - if o.ContentType != nil { + if !IsNil(o.ContentType) { toSerialize["contentType"] = o.ContentType } - - if o.Conditions != nil { + if !IsNil(o.Conditions) { toSerialize["conditions"] = o.Conditions } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableApplicationLoadBalancerHttpRule struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_application_load_balancer_http_rule_condition.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_application_load_balancer_http_rule_condition.go similarity index 72% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_application_load_balancer_http_rule_condition.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_application_load_balancer_http_rule_condition.go index b5f26a834..f09fc01f2 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_application_load_balancer_http_rule_condition.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_application_load_balancer_http_rule_condition.go @@ -14,12 +14,15 @@ import ( "encoding/json" ) +// checks if the ApplicationLoadBalancerHttpRuleCondition type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ApplicationLoadBalancerHttpRuleCondition{} + // ApplicationLoadBalancerHttpRuleCondition struct for ApplicationLoadBalancerHttpRuleCondition type ApplicationLoadBalancerHttpRuleCondition struct { // The HTTP rule condition type. - Type *string `json:"type"` + Type string `json:"type"` // The matching rule for the HTTP rule condition attribute; this parameter is mandatory for 'HEADER', 'PATH', 'QUERY', 'METHOD', 'HOST', and 'COOKIE' types. It must be 'null' if the type is 'SOURCE_IP'. - Condition *string `json:"condition"` + Condition string `json:"condition"` // Specifies whether the condition should be negated; the default value is 'FALSE'. Negate *bool `json:"negate,omitempty"` // The key can only be set when the HTTP rule condition type is 'COOKIES', 'HEADER', or 'QUERY'. For the type 'PATH', 'METHOD', 'HOST', or 'SOURCE_IP' the value must be 'null'. @@ -35,8 +38,8 @@ type ApplicationLoadBalancerHttpRuleCondition struct { func NewApplicationLoadBalancerHttpRuleCondition(type_ string, condition string) *ApplicationLoadBalancerHttpRuleCondition { this := ApplicationLoadBalancerHttpRuleCondition{} - this.Type = &type_ - this.Condition = &condition + this.Type = type_ + this.Condition = condition return &this } @@ -50,218 +53,171 @@ func NewApplicationLoadBalancerHttpRuleConditionWithDefaults() *ApplicationLoadB } // GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *ApplicationLoadBalancerHttpRuleCondition) GetType() *string { +func (o *ApplicationLoadBalancerHttpRuleCondition) GetType() string { if o == nil { - return 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. -// NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *ApplicationLoadBalancerHttpRuleCondition) GetTypeOk() (*string, bool) { if o == nil { return nil, false } - - return o.Type, true + return &o.Type, true } // SetType sets field value func (o *ApplicationLoadBalancerHttpRuleCondition) SetType(v string) { - - o.Type = &v - -} - -// HasType returns a boolean if a field has been set. -func (o *ApplicationLoadBalancerHttpRuleCondition) HasType() bool { - if o != nil && o.Type != nil { - return true - } - - return false + o.Type = v } // GetCondition returns the Condition field value -// If the value is explicit nil, nil is returned -func (o *ApplicationLoadBalancerHttpRuleCondition) GetCondition() *string { +func (o *ApplicationLoadBalancerHttpRuleCondition) GetCondition() string { if o == nil { - return nil + var ret string + return ret } return o.Condition - } // GetConditionOk returns a tuple with the Condition field value // 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 *ApplicationLoadBalancerHttpRuleCondition) GetConditionOk() (*string, bool) { if o == nil { return nil, false } - - return o.Condition, true + return &o.Condition, true } // SetCondition sets field value func (o *ApplicationLoadBalancerHttpRuleCondition) SetCondition(v string) { - - o.Condition = &v - -} - -// HasCondition returns a boolean if a field has been set. -func (o *ApplicationLoadBalancerHttpRuleCondition) HasCondition() bool { - if o != nil && o.Condition != nil { - return true - } - - return false + o.Condition = v } -// GetNegate returns the Negate field value -// If the value is explicit nil, nil is returned -func (o *ApplicationLoadBalancerHttpRuleCondition) GetNegate() *bool { - if o == nil { - return nil +// GetNegate returns the Negate field value if set, zero value otherwise. +func (o *ApplicationLoadBalancerHttpRuleCondition) GetNegate() bool { + if o == nil || IsNil(o.Negate) { + var ret bool + return ret } - - return o.Negate - + return *o.Negate } -// GetNegateOk returns a tuple with the Negate field value +// GetNegateOk returns a tuple with the Negate 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 *ApplicationLoadBalancerHttpRuleCondition) GetNegateOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.Negate) { return nil, false } - return o.Negate, true } -// SetNegate sets field value -func (o *ApplicationLoadBalancerHttpRuleCondition) SetNegate(v bool) { - - o.Negate = &v - -} - // HasNegate returns a boolean if a field has been set. func (o *ApplicationLoadBalancerHttpRuleCondition) HasNegate() bool { - if o != nil && o.Negate != nil { + if o != nil && !IsNil(o.Negate) { return true } return false } -// GetKey returns the Key field value -// If the value is explicit nil, nil is returned -func (o *ApplicationLoadBalancerHttpRuleCondition) GetKey() *string { - if o == nil { - return nil - } - - return o.Key +// SetNegate gets a reference to the given bool and assigns it to the Negate field. +func (o *ApplicationLoadBalancerHttpRuleCondition) SetNegate(v bool) { + o.Negate = &v +} +// GetKey returns the Key field value if set, zero value otherwise. +func (o *ApplicationLoadBalancerHttpRuleCondition) 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 +// GetKeyOk returns a tuple with the Key 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 *ApplicationLoadBalancerHttpRuleCondition) GetKeyOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Key) { return nil, false } - return o.Key, true } -// SetKey sets field value -func (o *ApplicationLoadBalancerHttpRuleCondition) SetKey(v string) { - - o.Key = &v - -} - // HasKey returns a boolean if a field has been set. func (o *ApplicationLoadBalancerHttpRuleCondition) HasKey() bool { - if o != nil && o.Key != nil { + if o != nil && !IsNil(o.Key) { return true } return false } -// GetValue returns the Value field value -// If the value is explicit nil, nil is returned -func (o *ApplicationLoadBalancerHttpRuleCondition) GetValue() *string { - if o == nil { - return nil - } - - return o.Value +// SetKey gets a reference to the given string and assigns it to the Key field. +func (o *ApplicationLoadBalancerHttpRuleCondition) SetKey(v string) { + o.Key = &v +} +// GetValue returns the Value field value if set, zero value otherwise. +func (o *ApplicationLoadBalancerHttpRuleCondition) GetValue() string { + if o == nil || IsNil(o.Value) { + var ret string + return ret + } + return *o.Value } -// GetValueOk returns a tuple with the Value field value +// GetValueOk returns a tuple with the Value 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 *ApplicationLoadBalancerHttpRuleCondition) GetValueOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Value) { return nil, false } - return o.Value, true } -// SetValue sets field value -func (o *ApplicationLoadBalancerHttpRuleCondition) SetValue(v string) { - - o.Value = &v - -} - // HasValue returns a boolean if a field has been set. func (o *ApplicationLoadBalancerHttpRuleCondition) HasValue() bool { - if o != nil && o.Value != nil { + if o != nil && !IsNil(o.Value) { return true } return false } -func (o ApplicationLoadBalancerHttpRuleCondition) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.Type != nil { - toSerialize["type"] = o.Type - } +// SetValue gets a reference to the given string and assigns it to the Value field. +func (o *ApplicationLoadBalancerHttpRuleCondition) SetValue(v string) { + o.Value = &v +} - if o.Condition != nil { - toSerialize["condition"] = o.Condition +func (o ApplicationLoadBalancerHttpRuleCondition) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } + return json.Marshal(toSerialize) +} - if o.Negate != nil { +func (o ApplicationLoadBalancerHttpRuleCondition) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["type"] = o.Type + toSerialize["condition"] = o.Condition + if !IsNil(o.Negate) { toSerialize["negate"] = o.Negate } - - if o.Key != nil { + if !IsNil(o.Key) { toSerialize["key"] = o.Key } - - if o.Value != nil { + if !IsNil(o.Value) { toSerialize["value"] = o.Value } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableApplicationLoadBalancerHttpRuleCondition struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_application_load_balancer_properties.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_application_load_balancer_properties.go similarity index 66% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_application_load_balancer_properties.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_application_load_balancer_properties.go index cd879b21f..2a4c1ee55 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_application_load_balancer_properties.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_application_load_balancer_properties.go @@ -14,18 +14,21 @@ import ( "encoding/json" ) +// checks if the ApplicationLoadBalancerProperties type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ApplicationLoadBalancerProperties{} + // ApplicationLoadBalancerProperties struct for ApplicationLoadBalancerProperties type ApplicationLoadBalancerProperties struct { // The Application Load Balancer name. - Name *string `json:"name"` + Name string `json:"name"` // The ID of the listening (inbound) LAN. - ListenerLan *int32 `json:"listenerLan"` + ListenerLan int32 `json:"listenerLan"` // Collection of the Application Load Balancer IP addresses. (Inbound and outbound) IPs of the 'listenerLan' are customer-reserved public IPs for the public load balancers, and private IPs for the private load balancers. - Ips *[]string `json:"ips,omitempty"` + Ips []string `json:"ips,omitempty"` // The ID of the balanced private target LAN (outbound). - TargetLan *int32 `json:"targetLan"` + TargetLan int32 `json:"targetLan"` // Collection of private IP addresses with the subnet mask of the Application Load Balancer. IPs must contain valid a subnet mask. If no IP is provided, the system will generate an IP with /24 subnet. - LbPrivateIps *[]string `json:"lbPrivateIps,omitempty"` + LbPrivateIps []string `json:"lbPrivateIps,omitempty"` // Turn logging on and off for this product. Default value is 'false'. CentralLogging *bool `json:"centralLogging,omitempty"` // Specifies the format of the logs. @@ -39,9 +42,9 @@ type ApplicationLoadBalancerProperties struct { func NewApplicationLoadBalancerProperties(name string, listenerLan int32, targetLan int32) *ApplicationLoadBalancerProperties { this := ApplicationLoadBalancerProperties{} - this.Name = &name - this.ListenerLan = &listenerLan - this.TargetLan = &targetLan + this.Name = name + this.ListenerLan = listenerLan + this.TargetLan = targetLan return &this } @@ -55,302 +58,231 @@ func NewApplicationLoadBalancerPropertiesWithDefaults() *ApplicationLoadBalancer } // GetName returns the Name field value -// If the value is explicit nil, nil is returned -func (o *ApplicationLoadBalancerProperties) GetName() *string { +func (o *ApplicationLoadBalancerProperties) GetName() string { if o == nil { - return 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. -// NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *ApplicationLoadBalancerProperties) GetNameOk() (*string, bool) { if o == nil { return nil, false } - - return o.Name, true + return &o.Name, true } // SetName sets field value func (o *ApplicationLoadBalancerProperties) SetName(v string) { - - o.Name = &v - -} - -// HasName returns a boolean if a field has been set. -func (o *ApplicationLoadBalancerProperties) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false + o.Name = v } // GetListenerLan returns the ListenerLan field value -// If the value is explicit nil, nil is returned -func (o *ApplicationLoadBalancerProperties) GetListenerLan() *int32 { +func (o *ApplicationLoadBalancerProperties) GetListenerLan() int32 { if o == nil { - return nil + var ret int32 + return ret } return o.ListenerLan - } // GetListenerLanOk returns a tuple with the ListenerLan field value // 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 *ApplicationLoadBalancerProperties) GetListenerLanOk() (*int32, bool) { if o == nil { return nil, false } - - return o.ListenerLan, true + return &o.ListenerLan, true } // SetListenerLan sets field value func (o *ApplicationLoadBalancerProperties) SetListenerLan(v int32) { - - o.ListenerLan = &v - -} - -// HasListenerLan returns a boolean if a field has been set. -func (o *ApplicationLoadBalancerProperties) HasListenerLan() bool { - if o != nil && o.ListenerLan != nil { - return true - } - - return false + o.ListenerLan = v } -// GetIps returns the Ips field value -// If the value is explicit nil, nil is returned -func (o *ApplicationLoadBalancerProperties) GetIps() *[]string { - if o == nil { - return nil +// GetIps returns the Ips field value if set, zero value otherwise. +func (o *ApplicationLoadBalancerProperties) GetIps() []string { + if o == nil || IsNil(o.Ips) { + var ret []string + return ret } - return o.Ips - } -// GetIpsOk returns a tuple with the Ips field value +// GetIpsOk returns a tuple with the Ips 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 *ApplicationLoadBalancerProperties) GetIpsOk() (*[]string, bool) { - if o == nil { +func (o *ApplicationLoadBalancerProperties) GetIpsOk() ([]string, bool) { + if o == nil || IsNil(o.Ips) { return nil, false } - return o.Ips, true } -// SetIps sets field value -func (o *ApplicationLoadBalancerProperties) SetIps(v []string) { - - o.Ips = &v - -} - // HasIps returns a boolean if a field has been set. func (o *ApplicationLoadBalancerProperties) HasIps() bool { - if o != nil && o.Ips != nil { + if o != nil && !IsNil(o.Ips) { return true } return false } +// SetIps gets a reference to the given []string and assigns it to the Ips field. +func (o *ApplicationLoadBalancerProperties) SetIps(v []string) { + o.Ips = v +} + // GetTargetLan returns the TargetLan field value -// If the value is explicit nil, nil is returned -func (o *ApplicationLoadBalancerProperties) GetTargetLan() *int32 { +func (o *ApplicationLoadBalancerProperties) GetTargetLan() int32 { if o == nil { - return nil + var ret int32 + return ret } return o.TargetLan - } // GetTargetLanOk returns a tuple with the TargetLan field value // 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 *ApplicationLoadBalancerProperties) GetTargetLanOk() (*int32, bool) { if o == nil { return nil, false } - - return o.TargetLan, true + return &o.TargetLan, true } // SetTargetLan sets field value func (o *ApplicationLoadBalancerProperties) SetTargetLan(v int32) { - - o.TargetLan = &v - + o.TargetLan = v } -// HasTargetLan returns a boolean if a field has been set. -func (o *ApplicationLoadBalancerProperties) HasTargetLan() bool { - if o != nil && o.TargetLan != nil { - return true - } - - return false -} - -// GetLbPrivateIps returns the LbPrivateIps field value -// If the value is explicit nil, nil is returned -func (o *ApplicationLoadBalancerProperties) GetLbPrivateIps() *[]string { - if o == nil { - return nil +// GetLbPrivateIps returns the LbPrivateIps field value if set, zero value otherwise. +func (o *ApplicationLoadBalancerProperties) GetLbPrivateIps() []string { + if o == nil || IsNil(o.LbPrivateIps) { + var ret []string + return ret } - return o.LbPrivateIps - } -// GetLbPrivateIpsOk returns a tuple with the LbPrivateIps field value +// GetLbPrivateIpsOk returns a tuple with the LbPrivateIps 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 *ApplicationLoadBalancerProperties) GetLbPrivateIpsOk() (*[]string, bool) { - if o == nil { +func (o *ApplicationLoadBalancerProperties) GetLbPrivateIpsOk() ([]string, bool) { + if o == nil || IsNil(o.LbPrivateIps) { return nil, false } - return o.LbPrivateIps, true } -// SetLbPrivateIps sets field value -func (o *ApplicationLoadBalancerProperties) SetLbPrivateIps(v []string) { - - o.LbPrivateIps = &v - -} - // HasLbPrivateIps returns a boolean if a field has been set. func (o *ApplicationLoadBalancerProperties) HasLbPrivateIps() bool { - if o != nil && o.LbPrivateIps != nil { + if o != nil && !IsNil(o.LbPrivateIps) { return true } return false } -// GetCentralLogging returns the CentralLogging field value -// If the value is explicit nil, nil is returned -func (o *ApplicationLoadBalancerProperties) GetCentralLogging() *bool { - if o == nil { - return nil - } - - return o.CentralLogging +// SetLbPrivateIps gets a reference to the given []string and assigns it to the LbPrivateIps field. +func (o *ApplicationLoadBalancerProperties) SetLbPrivateIps(v []string) { + o.LbPrivateIps = v +} +// GetCentralLogging returns the CentralLogging field value if set, zero value otherwise. +func (o *ApplicationLoadBalancerProperties) GetCentralLogging() bool { + if o == nil || IsNil(o.CentralLogging) { + var ret bool + return ret + } + return *o.CentralLogging } -// GetCentralLoggingOk returns a tuple with the CentralLogging field value +// GetCentralLoggingOk returns a tuple with the CentralLogging 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 *ApplicationLoadBalancerProperties) GetCentralLoggingOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.CentralLogging) { return nil, false } - return o.CentralLogging, true } -// SetCentralLogging sets field value -func (o *ApplicationLoadBalancerProperties) SetCentralLogging(v bool) { - - o.CentralLogging = &v - -} - // HasCentralLogging returns a boolean if a field has been set. func (o *ApplicationLoadBalancerProperties) HasCentralLogging() bool { - if o != nil && o.CentralLogging != nil { + if o != nil && !IsNil(o.CentralLogging) { return true } return false } -// GetLoggingFormat returns the LoggingFormat field value -// If the value is explicit nil, nil is returned -func (o *ApplicationLoadBalancerProperties) GetLoggingFormat() *string { - if o == nil { - return nil - } - - return o.LoggingFormat +// SetCentralLogging gets a reference to the given bool and assigns it to the CentralLogging field. +func (o *ApplicationLoadBalancerProperties) SetCentralLogging(v bool) { + o.CentralLogging = &v +} +// GetLoggingFormat returns the LoggingFormat field value if set, zero value otherwise. +func (o *ApplicationLoadBalancerProperties) GetLoggingFormat() string { + if o == nil || IsNil(o.LoggingFormat) { + var ret string + return ret + } + return *o.LoggingFormat } -// GetLoggingFormatOk returns a tuple with the LoggingFormat field value +// GetLoggingFormatOk returns a tuple with the LoggingFormat 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 *ApplicationLoadBalancerProperties) GetLoggingFormatOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.LoggingFormat) { return nil, false } - return o.LoggingFormat, true } -// SetLoggingFormat sets field value -func (o *ApplicationLoadBalancerProperties) SetLoggingFormat(v string) { - - o.LoggingFormat = &v - -} - // HasLoggingFormat returns a boolean if a field has been set. func (o *ApplicationLoadBalancerProperties) HasLoggingFormat() bool { - if o != nil && o.LoggingFormat != nil { + if o != nil && !IsNil(o.LoggingFormat) { return true } return false } -func (o ApplicationLoadBalancerProperties) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.Name != nil { - toSerialize["name"] = o.Name - } +// SetLoggingFormat gets a reference to the given string and assigns it to the LoggingFormat field. +func (o *ApplicationLoadBalancerProperties) SetLoggingFormat(v string) { + o.LoggingFormat = &v +} - if o.ListenerLan != nil { - toSerialize["listenerLan"] = o.ListenerLan +func (o ApplicationLoadBalancerProperties) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } + return json.Marshal(toSerialize) +} - if o.Ips != nil { +func (o ApplicationLoadBalancerProperties) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["name"] = o.Name + toSerialize["listenerLan"] = o.ListenerLan + if !IsNil(o.Ips) { toSerialize["ips"] = o.Ips } - - if o.TargetLan != nil { - toSerialize["targetLan"] = o.TargetLan - } - - if o.LbPrivateIps != nil { + toSerialize["targetLan"] = o.TargetLan + if !IsNil(o.LbPrivateIps) { toSerialize["lbPrivateIps"] = o.LbPrivateIps } - - if o.CentralLogging != nil { + if !IsNil(o.CentralLogging) { toSerialize["centralLogging"] = o.CentralLogging } - - if o.LoggingFormat != nil { + if !IsNil(o.LoggingFormat) { toSerialize["loggingFormat"] = o.LoggingFormat } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableApplicationLoadBalancerProperties struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_application_load_balancer_put.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_application_load_balancer_put.go similarity index 69% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_application_load_balancer_put.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_application_load_balancer_put.go index 16c804d25..bbb2cb80d 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_application_load_balancer_put.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_application_load_balancer_put.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the ApplicationLoadBalancerPut type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ApplicationLoadBalancerPut{} + // ApplicationLoadBalancerPut struct for ApplicationLoadBalancerPut type ApplicationLoadBalancerPut struct { // The resource's unique identifier. @@ -21,8 +24,8 @@ type ApplicationLoadBalancerPut struct { // The type of object that has been created. Type *Type `json:"type,omitempty"` // The URL to the object representation (absolute path). - Href *string `json:"href,omitempty"` - Properties *ApplicationLoadBalancerProperties `json:"properties"` + Href *string `json:"href,omitempty"` + Properties ApplicationLoadBalancerProperties `json:"properties"` } // NewApplicationLoadBalancerPut instantiates a new ApplicationLoadBalancerPut object @@ -32,7 +35,7 @@ type ApplicationLoadBalancerPut struct { func NewApplicationLoadBalancerPut(properties ApplicationLoadBalancerProperties) *ApplicationLoadBalancerPut { this := ApplicationLoadBalancerPut{} - this.Properties = &properties + this.Properties = properties return &this } @@ -45,177 +48,147 @@ func NewApplicationLoadBalancerPutWithDefaults() *ApplicationLoadBalancerPut { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *ApplicationLoadBalancerPut) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *ApplicationLoadBalancerPut) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *ApplicationLoadBalancerPut) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *ApplicationLoadBalancerPut) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *ApplicationLoadBalancerPut) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *ApplicationLoadBalancerPut) GetType() *Type { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *ApplicationLoadBalancerPut) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *ApplicationLoadBalancerPut) GetType() Type { + if o == nil || IsNil(o.Type) { + var ret Type + return ret + } + return *o.Type } -// GetTypeOk returns a tuple with the Type field value +// GetTypeOk returns a tuple with the Type 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 *ApplicationLoadBalancerPut) GetTypeOk() (*Type, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *ApplicationLoadBalancerPut) SetType(v Type) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *ApplicationLoadBalancerPut) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *ApplicationLoadBalancerPut) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given Type and assigns it to the Type field. +func (o *ApplicationLoadBalancerPut) SetType(v Type) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *ApplicationLoadBalancerPut) 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 +// GetHrefOk returns a tuple with the Href 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 *ApplicationLoadBalancerPut) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *ApplicationLoadBalancerPut) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *ApplicationLoadBalancerPut) HasHref() bool { - if o != nil && o.Href != nil { + 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 *ApplicationLoadBalancerPut) SetHref(v string) { + o.Href = &v +} + // GetProperties returns the Properties field value -// If the value is explicit nil, nil is returned -func (o *ApplicationLoadBalancerPut) GetProperties() *ApplicationLoadBalancerProperties { +func (o *ApplicationLoadBalancerPut) GetProperties() ApplicationLoadBalancerProperties { if o == nil { - return nil + var ret ApplicationLoadBalancerProperties + return ret } return o.Properties - } // GetPropertiesOk returns a tuple with the Properties field value // 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 *ApplicationLoadBalancerPut) GetPropertiesOk() (*ApplicationLoadBalancerProperties, bool) { if o == nil { return nil, false } - - return o.Properties, true + return &o.Properties, true } // SetProperties sets field value func (o *ApplicationLoadBalancerPut) SetProperties(v ApplicationLoadBalancerProperties) { - - o.Properties = &v - + o.Properties = v } -// HasProperties returns a boolean if a field has been set. -func (o *ApplicationLoadBalancerPut) HasProperties() bool { - if o != nil && o.Properties != nil { - return true +func (o ApplicationLoadBalancerPut) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } - - return false + return json.Marshal(toSerialize) } -func (o ApplicationLoadBalancerPut) MarshalJSON() ([]byte, error) { +func (o ApplicationLoadBalancerPut) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Properties != nil { - toSerialize["properties"] = o.Properties - } - - return json.Marshal(toSerialize) + toSerialize["properties"] = o.Properties + return toSerialize, nil } type NullableApplicationLoadBalancerPut struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_application_load_balancers.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_application_load_balancers.go similarity index 61% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_application_load_balancers.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_application_load_balancers.go index db3fcc2d3..e2e12484e 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_application_load_balancers.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_application_load_balancers.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the ApplicationLoadBalancers type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ApplicationLoadBalancers{} + // ApplicationLoadBalancers struct for ApplicationLoadBalancers type ApplicationLoadBalancers struct { // The resource's unique identifier. @@ -23,7 +26,7 @@ type ApplicationLoadBalancers struct { // The URL to the object representation (absolute path). Href *string `json:"href,omitempty"` // Array of items in the collection. - Items *[]ApplicationLoadBalancer `json:"items,omitempty"` + Items []ApplicationLoadBalancer `json:"items,omitempty"` // The offset (if specified in the request). Offset *float32 `json:"offset,omitempty"` // The limit (if specified in the request). @@ -49,303 +52,262 @@ func NewApplicationLoadBalancersWithDefaults() *ApplicationLoadBalancers { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *ApplicationLoadBalancers) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *ApplicationLoadBalancers) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *ApplicationLoadBalancers) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *ApplicationLoadBalancers) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *ApplicationLoadBalancers) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *ApplicationLoadBalancers) GetType() *Type { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *ApplicationLoadBalancers) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *ApplicationLoadBalancers) GetType() Type { + if o == nil || IsNil(o.Type) { + var ret Type + return ret + } + return *o.Type } -// GetTypeOk returns a tuple with the Type field value +// GetTypeOk returns a tuple with the Type 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 *ApplicationLoadBalancers) GetTypeOk() (*Type, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *ApplicationLoadBalancers) SetType(v Type) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *ApplicationLoadBalancers) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *ApplicationLoadBalancers) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given Type and assigns it to the Type field. +func (o *ApplicationLoadBalancers) SetType(v Type) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *ApplicationLoadBalancers) 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 +// GetHrefOk returns a tuple with the Href 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 *ApplicationLoadBalancers) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *ApplicationLoadBalancers) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *ApplicationLoadBalancers) HasHref() bool { - if o != nil && o.Href != nil { + if o != nil && !IsNil(o.Href) { return true } return false } -// GetItems returns the Items field value -// If the value is explicit nil, nil is returned -func (o *ApplicationLoadBalancers) GetItems() *[]ApplicationLoadBalancer { - if o == nil { - return nil - } +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *ApplicationLoadBalancers) SetHref(v string) { + o.Href = &v +} +// GetItems returns the Items field value if set, zero value otherwise. +func (o *ApplicationLoadBalancers) GetItems() []ApplicationLoadBalancer { + if o == nil || IsNil(o.Items) { + var ret []ApplicationLoadBalancer + return ret + } return o.Items - } -// GetItemsOk returns a tuple with the Items field value +// GetItemsOk returns a tuple with the Items 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 *ApplicationLoadBalancers) GetItemsOk() (*[]ApplicationLoadBalancer, bool) { - if o == nil { +func (o *ApplicationLoadBalancers) GetItemsOk() ([]ApplicationLoadBalancer, bool) { + if o == nil || IsNil(o.Items) { return nil, false } - return o.Items, true } -// SetItems sets field value -func (o *ApplicationLoadBalancers) SetItems(v []ApplicationLoadBalancer) { - - o.Items = &v - -} - // HasItems returns a boolean if a field has been set. func (o *ApplicationLoadBalancers) HasItems() bool { - if o != nil && o.Items != nil { + if o != nil && !IsNil(o.Items) { return true } return false } -// GetOffset returns the Offset field value -// If the value is explicit nil, nil is returned -func (o *ApplicationLoadBalancers) GetOffset() *float32 { - if o == nil { - return nil - } - - return o.Offset +// SetItems gets a reference to the given []ApplicationLoadBalancer and assigns it to the Items field. +func (o *ApplicationLoadBalancers) SetItems(v []ApplicationLoadBalancer) { + o.Items = v +} +// GetOffset returns the Offset field value if set, zero value otherwise. +func (o *ApplicationLoadBalancers) GetOffset() float32 { + if o == nil || IsNil(o.Offset) { + var ret float32 + return ret + } + return *o.Offset } -// GetOffsetOk returns a tuple with the Offset field value +// GetOffsetOk returns a tuple with the Offset 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 *ApplicationLoadBalancers) GetOffsetOk() (*float32, bool) { - if o == nil { + if o == nil || IsNil(o.Offset) { return nil, false } - return o.Offset, true } -// SetOffset sets field value -func (o *ApplicationLoadBalancers) SetOffset(v float32) { - - o.Offset = &v - -} - // HasOffset returns a boolean if a field has been set. func (o *ApplicationLoadBalancers) HasOffset() bool { - if o != nil && o.Offset != nil { + if o != nil && !IsNil(o.Offset) { return true } return false } -// GetLimit returns the Limit field value -// If the value is explicit nil, nil is returned -func (o *ApplicationLoadBalancers) GetLimit() *float32 { - if o == nil { - return nil - } - - return o.Limit +// SetOffset gets a reference to the given float32 and assigns it to the Offset field. +func (o *ApplicationLoadBalancers) SetOffset(v float32) { + o.Offset = &v +} +// GetLimit returns the Limit field value if set, zero value otherwise. +func (o *ApplicationLoadBalancers) GetLimit() float32 { + if o == nil || IsNil(o.Limit) { + var ret float32 + return ret + } + return *o.Limit } -// GetLimitOk returns a tuple with the Limit field value +// GetLimitOk returns a tuple with the Limit 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 *ApplicationLoadBalancers) GetLimitOk() (*float32, bool) { - if o == nil { + if o == nil || IsNil(o.Limit) { return nil, false } - return o.Limit, true } -// SetLimit sets field value -func (o *ApplicationLoadBalancers) SetLimit(v float32) { - - o.Limit = &v - -} - // HasLimit returns a boolean if a field has been set. func (o *ApplicationLoadBalancers) HasLimit() bool { - if o != nil && o.Limit != nil { + if o != nil && !IsNil(o.Limit) { return true } return false } -// GetLinks returns the Links field value -// If the value is explicit nil, nil is returned -func (o *ApplicationLoadBalancers) GetLinks() *PaginationLinks { - if o == nil { - return nil - } - - return o.Links +// SetLimit gets a reference to the given float32 and assigns it to the Limit field. +func (o *ApplicationLoadBalancers) SetLimit(v float32) { + o.Limit = &v +} +// GetLinks returns the Links field value if set, zero value otherwise. +func (o *ApplicationLoadBalancers) GetLinks() PaginationLinks { + if o == nil || IsNil(o.Links) { + var ret PaginationLinks + return ret + } + return *o.Links } -// GetLinksOk returns a tuple with the Links field value +// GetLinksOk returns a tuple with the Links 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 *ApplicationLoadBalancers) GetLinksOk() (*PaginationLinks, bool) { - if o == nil { + if o == nil || IsNil(o.Links) { return nil, false } - return o.Links, true } -// SetLinks sets field value -func (o *ApplicationLoadBalancers) SetLinks(v PaginationLinks) { - - o.Links = &v - -} - // HasLinks returns a boolean if a field has been set. func (o *ApplicationLoadBalancers) HasLinks() bool { - if o != nil && o.Links != nil { + if o != nil && !IsNil(o.Links) { return true } return false } +// SetLinks gets a reference to the given PaginationLinks and assigns it to the Links field. +func (o *ApplicationLoadBalancers) SetLinks(v PaginationLinks) { + o.Links = &v +} + func (o ApplicationLoadBalancers) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ApplicationLoadBalancers) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Items != nil { + if !IsNil(o.Items) { toSerialize["items"] = o.Items } - - if o.Offset != nil { + if !IsNil(o.Offset) { toSerialize["offset"] = o.Offset } - - if o.Limit != nil { + if !IsNil(o.Limit) { toSerialize["limit"] = o.Limit } - - if o.Links != nil { + if !IsNil(o.Links) { toSerialize["_links"] = o.Links } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableApplicationLoadBalancers struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_attached_volumes.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_attached_volumes.go similarity index 61% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_attached_volumes.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_attached_volumes.go index fd08d1232..cfbac5280 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_attached_volumes.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_attached_volumes.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the AttachedVolumes type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AttachedVolumes{} + // AttachedVolumes struct for AttachedVolumes type AttachedVolumes struct { // The resource's unique identifier. @@ -23,7 +26,7 @@ type AttachedVolumes struct { // The URL to the object representation (absolute path). Href *string `json:"href,omitempty"` // Array of items in the collection. - Items *[]Volume `json:"items,omitempty"` + Items []Volume `json:"items,omitempty"` // The offset (if specified in the request). Offset *float32 `json:"offset,omitempty"` // The limit (if specified in the request). @@ -49,303 +52,262 @@ func NewAttachedVolumesWithDefaults() *AttachedVolumes { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *AttachedVolumes) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *AttachedVolumes) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *AttachedVolumes) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *AttachedVolumes) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *AttachedVolumes) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *AttachedVolumes) GetType() *Type { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *AttachedVolumes) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *AttachedVolumes) GetType() Type { + if o == nil || IsNil(o.Type) { + var ret Type + return ret + } + return *o.Type } -// GetTypeOk returns a tuple with the Type field value +// GetTypeOk returns a tuple with the Type 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 *AttachedVolumes) GetTypeOk() (*Type, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *AttachedVolumes) SetType(v Type) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *AttachedVolumes) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *AttachedVolumes) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given Type and assigns it to the Type field. +func (o *AttachedVolumes) SetType(v Type) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *AttachedVolumes) 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 +// GetHrefOk returns a tuple with the Href 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 *AttachedVolumes) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *AttachedVolumes) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *AttachedVolumes) HasHref() bool { - if o != nil && o.Href != nil { + if o != nil && !IsNil(o.Href) { return true } return false } -// GetItems returns the Items field value -// If the value is explicit nil, nil is returned -func (o *AttachedVolumes) GetItems() *[]Volume { - if o == nil { - return nil - } +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *AttachedVolumes) SetHref(v string) { + o.Href = &v +} +// GetItems returns the Items field value if set, zero value otherwise. +func (o *AttachedVolumes) GetItems() []Volume { + if o == nil || IsNil(o.Items) { + var ret []Volume + return ret + } return o.Items - } -// GetItemsOk returns a tuple with the Items field value +// GetItemsOk returns a tuple with the Items 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 *AttachedVolumes) GetItemsOk() (*[]Volume, bool) { - if o == nil { +func (o *AttachedVolumes) GetItemsOk() ([]Volume, bool) { + if o == nil || IsNil(o.Items) { return nil, false } - return o.Items, true } -// SetItems sets field value -func (o *AttachedVolumes) SetItems(v []Volume) { - - o.Items = &v - -} - // HasItems returns a boolean if a field has been set. func (o *AttachedVolumes) HasItems() bool { - if o != nil && o.Items != nil { + if o != nil && !IsNil(o.Items) { return true } return false } -// GetOffset returns the Offset field value -// If the value is explicit nil, nil is returned -func (o *AttachedVolumes) GetOffset() *float32 { - if o == nil { - return nil - } - - return o.Offset +// SetItems gets a reference to the given []Volume and assigns it to the Items field. +func (o *AttachedVolumes) SetItems(v []Volume) { + o.Items = v +} +// GetOffset returns the Offset field value if set, zero value otherwise. +func (o *AttachedVolumes) GetOffset() float32 { + if o == nil || IsNil(o.Offset) { + var ret float32 + return ret + } + return *o.Offset } -// GetOffsetOk returns a tuple with the Offset field value +// GetOffsetOk returns a tuple with the Offset 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 *AttachedVolumes) GetOffsetOk() (*float32, bool) { - if o == nil { + if o == nil || IsNil(o.Offset) { return nil, false } - return o.Offset, true } -// SetOffset sets field value -func (o *AttachedVolumes) SetOffset(v float32) { - - o.Offset = &v - -} - // HasOffset returns a boolean if a field has been set. func (o *AttachedVolumes) HasOffset() bool { - if o != nil && o.Offset != nil { + if o != nil && !IsNil(o.Offset) { return true } return false } -// GetLimit returns the Limit field value -// If the value is explicit nil, nil is returned -func (o *AttachedVolumes) GetLimit() *float32 { - if o == nil { - return nil - } - - return o.Limit +// SetOffset gets a reference to the given float32 and assigns it to the Offset field. +func (o *AttachedVolumes) SetOffset(v float32) { + o.Offset = &v +} +// GetLimit returns the Limit field value if set, zero value otherwise. +func (o *AttachedVolumes) GetLimit() float32 { + if o == nil || IsNil(o.Limit) { + var ret float32 + return ret + } + return *o.Limit } -// GetLimitOk returns a tuple with the Limit field value +// GetLimitOk returns a tuple with the Limit 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 *AttachedVolumes) GetLimitOk() (*float32, bool) { - if o == nil { + if o == nil || IsNil(o.Limit) { return nil, false } - return o.Limit, true } -// SetLimit sets field value -func (o *AttachedVolumes) SetLimit(v float32) { - - o.Limit = &v - -} - // HasLimit returns a boolean if a field has been set. func (o *AttachedVolumes) HasLimit() bool { - if o != nil && o.Limit != nil { + if o != nil && !IsNil(o.Limit) { return true } return false } -// GetLinks returns the Links field value -// If the value is explicit nil, nil is returned -func (o *AttachedVolumes) GetLinks() *PaginationLinks { - if o == nil { - return nil - } - - return o.Links +// SetLimit gets a reference to the given float32 and assigns it to the Limit field. +func (o *AttachedVolumes) SetLimit(v float32) { + o.Limit = &v +} +// GetLinks returns the Links field value if set, zero value otherwise. +func (o *AttachedVolumes) GetLinks() PaginationLinks { + if o == nil || IsNil(o.Links) { + var ret PaginationLinks + return ret + } + return *o.Links } -// GetLinksOk returns a tuple with the Links field value +// GetLinksOk returns a tuple with the Links 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 *AttachedVolumes) GetLinksOk() (*PaginationLinks, bool) { - if o == nil { + if o == nil || IsNil(o.Links) { return nil, false } - return o.Links, true } -// SetLinks sets field value -func (o *AttachedVolumes) SetLinks(v PaginationLinks) { - - o.Links = &v - -} - // HasLinks returns a boolean if a field has been set. func (o *AttachedVolumes) HasLinks() bool { - if o != nil && o.Links != nil { + if o != nil && !IsNil(o.Links) { return true } return false } +// SetLinks gets a reference to the given PaginationLinks and assigns it to the Links field. +func (o *AttachedVolumes) SetLinks(v PaginationLinks) { + o.Links = &v +} + func (o AttachedVolumes) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o AttachedVolumes) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Items != nil { + if !IsNil(o.Items) { toSerialize["items"] = o.Items } - - if o.Offset != nil { + if !IsNil(o.Offset) { toSerialize["offset"] = o.Offset } - - if o.Limit != nil { + if !IsNil(o.Limit) { toSerialize["limit"] = o.Limit } - - if o.Links != nil { + if !IsNil(o.Links) { toSerialize["_links"] = o.Links } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableAttachedVolumes struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_backup_unit.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_backup_unit.go similarity index 65% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_backup_unit.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_backup_unit.go index f978d24dc..27ed1f6ae 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_backup_unit.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_backup_unit.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the BackupUnit type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BackupUnit{} + // BackupUnit struct for BackupUnit type BackupUnit struct { // The resource's unique identifier. @@ -23,7 +26,7 @@ type BackupUnit struct { // URL to the object representation (absolute path). Href *string `json:"href,omitempty"` Metadata *DatacenterElementMetadata `json:"metadata,omitempty"` - Properties *BackupUnitProperties `json:"properties"` + Properties BackupUnitProperties `json:"properties"` } // NewBackupUnit instantiates a new BackupUnit object @@ -33,7 +36,7 @@ type BackupUnit struct { func NewBackupUnit(properties BackupUnitProperties) *BackupUnit { this := BackupUnit{} - this.Properties = &properties + this.Properties = properties return &this } @@ -46,219 +49,182 @@ func NewBackupUnitWithDefaults() *BackupUnit { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *BackupUnit) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *BackupUnit) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *BackupUnit) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *BackupUnit) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *BackupUnit) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *BackupUnit) GetType() *string { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *BackupUnit) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *BackupUnit) 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 +// GetTypeOk returns a tuple with the Type 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 *BackupUnit) GetTypeOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *BackupUnit) SetType(v string) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *BackupUnit) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *BackupUnit) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *BackupUnit) SetType(v string) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *BackupUnit) 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 +// GetHrefOk returns a tuple with the Href 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 *BackupUnit) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *BackupUnit) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *BackupUnit) HasHref() bool { - if o != nil && o.Href != nil { + if o != nil && !IsNil(o.Href) { return true } return false } -// GetMetadata returns the Metadata field value -// If the value is explicit nil, nil is returned -func (o *BackupUnit) GetMetadata() *DatacenterElementMetadata { - if o == nil { - return nil - } - - return o.Metadata +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *BackupUnit) SetHref(v string) { + o.Href = &v +} +// GetMetadata returns the Metadata field value if set, zero value otherwise. +func (o *BackupUnit) GetMetadata() DatacenterElementMetadata { + if o == nil || IsNil(o.Metadata) { + var ret DatacenterElementMetadata + return ret + } + return *o.Metadata } -// GetMetadataOk returns a tuple with the Metadata field value +// GetMetadataOk returns a tuple with the Metadata 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 *BackupUnit) GetMetadataOk() (*DatacenterElementMetadata, bool) { - if o == nil { + if o == nil || IsNil(o.Metadata) { return nil, false } - return o.Metadata, true } -// SetMetadata sets field value -func (o *BackupUnit) SetMetadata(v DatacenterElementMetadata) { - - o.Metadata = &v - -} - // HasMetadata returns a boolean if a field has been set. func (o *BackupUnit) HasMetadata() bool { - if o != nil && o.Metadata != nil { + if o != nil && !IsNil(o.Metadata) { return true } return false } +// SetMetadata gets a reference to the given DatacenterElementMetadata and assigns it to the Metadata field. +func (o *BackupUnit) SetMetadata(v DatacenterElementMetadata) { + o.Metadata = &v +} + // GetProperties returns the Properties field value -// If the value is explicit nil, nil is returned -func (o *BackupUnit) GetProperties() *BackupUnitProperties { +func (o *BackupUnit) GetProperties() BackupUnitProperties { if o == nil { - return nil + var ret BackupUnitProperties + return ret } return o.Properties - } // GetPropertiesOk returns a tuple with the Properties field value // 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 *BackupUnit) GetPropertiesOk() (*BackupUnitProperties, bool) { if o == nil { return nil, false } - - return o.Properties, true + return &o.Properties, true } // SetProperties sets field value func (o *BackupUnit) SetProperties(v BackupUnitProperties) { - - o.Properties = &v - + o.Properties = v } -// HasProperties returns a boolean if a field has been set. -func (o *BackupUnit) HasProperties() bool { - if o != nil && o.Properties != nil { - return true +func (o BackupUnit) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } - - return false + return json.Marshal(toSerialize) } -func (o BackupUnit) MarshalJSON() ([]byte, error) { +func (o BackupUnit) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Metadata != nil { + if !IsNil(o.Metadata) { toSerialize["metadata"] = o.Metadata } - - if o.Properties != nil { - toSerialize["properties"] = o.Properties - } - - return json.Marshal(toSerialize) + toSerialize["properties"] = o.Properties + return toSerialize, nil } type NullableBackupUnit struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_backup_unit_properties.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_backup_unit_properties.go similarity index 73% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_backup_unit_properties.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_backup_unit_properties.go index 06b32a00c..047e0e155 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_backup_unit_properties.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_backup_unit_properties.go @@ -14,10 +14,13 @@ import ( "encoding/json" ) +// checks if the BackupUnitProperties type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BackupUnitProperties{} + // BackupUnitProperties struct for BackupUnitProperties type BackupUnitProperties struct { // The name of the resource (alphanumeric characters only). - Name *string `json:"name"` + Name string `json:"name"` // The password associated with that resource. Password *string `json:"password,omitempty"` // The email associated with the backup unit. Bear in mind that this email does not be the same email as of the user. @@ -31,7 +34,7 @@ type BackupUnitProperties struct { func NewBackupUnitProperties(name string) *BackupUnitProperties { this := BackupUnitProperties{} - this.Name = &name + this.Name = name return &this } @@ -45,134 +48,111 @@ func NewBackupUnitPropertiesWithDefaults() *BackupUnitProperties { } // GetName returns the Name field value -// If the value is explicit nil, nil is returned -func (o *BackupUnitProperties) GetName() *string { +func (o *BackupUnitProperties) GetName() string { if o == nil { - return 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. -// NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *BackupUnitProperties) GetNameOk() (*string, bool) { if o == nil { return nil, false } - - return o.Name, true + return &o.Name, true } // SetName sets field value func (o *BackupUnitProperties) SetName(v string) { - - o.Name = &v - -} - -// HasName returns a boolean if a field has been set. -func (o *BackupUnitProperties) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false + o.Name = v } -// GetPassword returns the Password field value -// If the value is explicit nil, nil is returned -func (o *BackupUnitProperties) GetPassword() *string { - if o == nil { - return nil +// GetPassword returns the Password field value if set, zero value otherwise. +func (o *BackupUnitProperties) GetPassword() string { + if o == nil || IsNil(o.Password) { + var ret string + return ret } - - return o.Password - + return *o.Password } -// GetPasswordOk returns a tuple with the Password field value +// GetPasswordOk returns a tuple with the Password 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 *BackupUnitProperties) GetPasswordOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Password) { return nil, false } - return o.Password, true } -// SetPassword sets field value -func (o *BackupUnitProperties) SetPassword(v string) { - - o.Password = &v - -} - // HasPassword returns a boolean if a field has been set. func (o *BackupUnitProperties) HasPassword() bool { - if o != nil && o.Password != nil { + if o != nil && !IsNil(o.Password) { return true } return false } -// GetEmail returns the Email field value -// If the value is explicit nil, nil is returned -func (o *BackupUnitProperties) GetEmail() *string { - if o == nil { - return nil - } - - return o.Email +// SetPassword gets a reference to the given string and assigns it to the Password field. +func (o *BackupUnitProperties) SetPassword(v string) { + o.Password = &v +} +// GetEmail returns the Email field value if set, zero value otherwise. +func (o *BackupUnitProperties) 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 +// GetEmailOk returns a tuple with the Email 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 *BackupUnitProperties) GetEmailOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Email) { return nil, false } - return o.Email, true } -// SetEmail sets field value -func (o *BackupUnitProperties) SetEmail(v string) { - - o.Email = &v - -} - // HasEmail returns a boolean if a field has been set. func (o *BackupUnitProperties) HasEmail() bool { - if o != nil && o.Email != nil { + 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 *BackupUnitProperties) SetEmail(v string) { + o.Email = &v +} + func (o BackupUnitProperties) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.Name != nil { - toSerialize["name"] = o.Name + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } + return json.Marshal(toSerialize) +} - if o.Password != nil { +func (o BackupUnitProperties) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["name"] = o.Name + if !IsNil(o.Password) { toSerialize["password"] = o.Password } - - if o.Email != nil { + if !IsNil(o.Email) { toSerialize["email"] = o.Email } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableBackupUnitProperties struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_backup_unit_sso.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_backup_unit_sso.go similarity index 78% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_backup_unit_sso.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_backup_unit_sso.go index bafde96f1..2f0907c56 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_backup_unit_sso.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_backup_unit_sso.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the BackupUnitSSO type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BackupUnitSSO{} + // BackupUnitSSO struct for BackupUnitSSO type BackupUnitSSO struct { // The backup unit single sign on url @@ -38,51 +41,52 @@ func NewBackupUnitSSOWithDefaults() *BackupUnitSSO { return &this } -// GetSsoUrl returns the SsoUrl field value -// If the value is explicit nil, nil is returned -func (o *BackupUnitSSO) GetSsoUrl() *string { - if o == nil { - return nil +// GetSsoUrl returns the SsoUrl field value if set, zero value otherwise. +func (o *BackupUnitSSO) GetSsoUrl() string { + if o == nil || IsNil(o.SsoUrl) { + var ret string + return ret } - - return o.SsoUrl - + return *o.SsoUrl } -// GetSsoUrlOk returns a tuple with the SsoUrl field value +// GetSsoUrlOk returns a tuple with the SsoUrl 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 *BackupUnitSSO) GetSsoUrlOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.SsoUrl) { return nil, false } - return o.SsoUrl, true } -// SetSsoUrl sets field value -func (o *BackupUnitSSO) SetSsoUrl(v string) { - - o.SsoUrl = &v - -} - // HasSsoUrl returns a boolean if a field has been set. func (o *BackupUnitSSO) HasSsoUrl() bool { - if o != nil && o.SsoUrl != nil { + if o != nil && !IsNil(o.SsoUrl) { return true } return false } +// SetSsoUrl gets a reference to the given string and assigns it to the SsoUrl field. +func (o *BackupUnitSSO) SetSsoUrl(v string) { + o.SsoUrl = &v +} + func (o BackupUnitSSO) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o BackupUnitSSO) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.SsoUrl != nil { + if !IsNil(o.SsoUrl) { toSerialize["ssoUrl"] = o.SsoUrl } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableBackupUnitSSO struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_backup_units.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_backup_units.go similarity index 64% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_backup_units.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_backup_units.go index b3528483d..e001c25ba 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_backup_units.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_backup_units.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the BackupUnits type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BackupUnits{} + // BackupUnits struct for BackupUnits type BackupUnits struct { // The resource's unique identifier. @@ -23,7 +26,7 @@ type BackupUnits struct { // URL to the object representation (absolute path). Href *string `json:"href,omitempty"` // Array of items in the collection. - Items *[]BackupUnit `json:"items,omitempty"` + Items []BackupUnit `json:"items,omitempty"` } // NewBackupUnits instantiates a new BackupUnits object @@ -44,177 +47,157 @@ func NewBackupUnitsWithDefaults() *BackupUnits { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *BackupUnits) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *BackupUnits) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *BackupUnits) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *BackupUnits) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *BackupUnits) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *BackupUnits) GetType() *string { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *BackupUnits) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *BackupUnits) 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 +// GetTypeOk returns a tuple with the Type 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 *BackupUnits) GetTypeOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *BackupUnits) SetType(v string) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *BackupUnits) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *BackupUnits) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *BackupUnits) SetType(v string) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *BackupUnits) 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 +// GetHrefOk returns a tuple with the Href 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 *BackupUnits) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *BackupUnits) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *BackupUnits) HasHref() bool { - if o != nil && o.Href != nil { + if o != nil && !IsNil(o.Href) { return true } return false } -// GetItems returns the Items field value -// If the value is explicit nil, nil is returned -func (o *BackupUnits) GetItems() *[]BackupUnit { - if o == nil { - return nil - } +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *BackupUnits) SetHref(v string) { + o.Href = &v +} +// GetItems returns the Items field value if set, zero value otherwise. +func (o *BackupUnits) GetItems() []BackupUnit { + if o == nil || IsNil(o.Items) { + var ret []BackupUnit + return ret + } return o.Items - } -// GetItemsOk returns a tuple with the Items field value +// GetItemsOk returns a tuple with the Items 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 *BackupUnits) GetItemsOk() (*[]BackupUnit, bool) { - if o == nil { +func (o *BackupUnits) GetItemsOk() ([]BackupUnit, bool) { + if o == nil || IsNil(o.Items) { return nil, false } - return o.Items, true } -// SetItems sets field value -func (o *BackupUnits) SetItems(v []BackupUnit) { - - o.Items = &v - -} - // HasItems returns a boolean if a field has been set. func (o *BackupUnits) HasItems() bool { - if o != nil && o.Items != nil { + if o != nil && !IsNil(o.Items) { return true } return false } +// SetItems gets a reference to the given []BackupUnit and assigns it to the Items field. +func (o *BackupUnits) SetItems(v []BackupUnit) { + o.Items = v +} + func (o BackupUnits) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o BackupUnits) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Items != nil { + if !IsNil(o.Items) { toSerialize["items"] = o.Items } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableBackupUnits struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_balanced_nics.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_balanced_nics.go similarity index 60% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_balanced_nics.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_balanced_nics.go index 98cb146bf..733d9b937 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_balanced_nics.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_balanced_nics.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the BalancedNics type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BalancedNics{} + // BalancedNics struct for BalancedNics type BalancedNics struct { // The resource's unique identifier. @@ -23,7 +26,7 @@ type BalancedNics struct { // URL to the object representation (absolute path). Href *string `json:"href,omitempty"` // Array of items in the collection. - Items *[]Nic `json:"items,omitempty"` + Items []Nic `json:"items,omitempty"` // The offset (if specified in the request). Offset *float32 `json:"offset,omitempty"` // The limit (if specified in the request). @@ -49,303 +52,262 @@ func NewBalancedNicsWithDefaults() *BalancedNics { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *BalancedNics) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *BalancedNics) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *BalancedNics) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *BalancedNics) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *BalancedNics) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *BalancedNics) GetType() *Type { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *BalancedNics) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *BalancedNics) GetType() Type { + if o == nil || IsNil(o.Type) { + var ret Type + return ret + } + return *o.Type } -// GetTypeOk returns a tuple with the Type field value +// GetTypeOk returns a tuple with the Type 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 *BalancedNics) GetTypeOk() (*Type, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *BalancedNics) SetType(v Type) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *BalancedNics) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *BalancedNics) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given Type and assigns it to the Type field. +func (o *BalancedNics) SetType(v Type) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *BalancedNics) 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 +// GetHrefOk returns a tuple with the Href 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 *BalancedNics) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *BalancedNics) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *BalancedNics) HasHref() bool { - if o != nil && o.Href != nil { + if o != nil && !IsNil(o.Href) { return true } return false } -// GetItems returns the Items field value -// If the value is explicit nil, nil is returned -func (o *BalancedNics) GetItems() *[]Nic { - if o == nil { - return nil - } +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *BalancedNics) SetHref(v string) { + o.Href = &v +} +// GetItems returns the Items field value if set, zero value otherwise. +func (o *BalancedNics) GetItems() []Nic { + if o == nil || IsNil(o.Items) { + var ret []Nic + return ret + } return o.Items - } -// GetItemsOk returns a tuple with the Items field value +// GetItemsOk returns a tuple with the Items 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 *BalancedNics) GetItemsOk() (*[]Nic, bool) { - if o == nil { +func (o *BalancedNics) GetItemsOk() ([]Nic, bool) { + if o == nil || IsNil(o.Items) { return nil, false } - return o.Items, true } -// SetItems sets field value -func (o *BalancedNics) SetItems(v []Nic) { - - o.Items = &v - -} - // HasItems returns a boolean if a field has been set. func (o *BalancedNics) HasItems() bool { - if o != nil && o.Items != nil { + if o != nil && !IsNil(o.Items) { return true } return false } -// GetOffset returns the Offset field value -// If the value is explicit nil, nil is returned -func (o *BalancedNics) GetOffset() *float32 { - if o == nil { - return nil - } - - return o.Offset +// SetItems gets a reference to the given []Nic and assigns it to the Items field. +func (o *BalancedNics) SetItems(v []Nic) { + o.Items = v +} +// GetOffset returns the Offset field value if set, zero value otherwise. +func (o *BalancedNics) GetOffset() float32 { + if o == nil || IsNil(o.Offset) { + var ret float32 + return ret + } + return *o.Offset } -// GetOffsetOk returns a tuple with the Offset field value +// GetOffsetOk returns a tuple with the Offset 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 *BalancedNics) GetOffsetOk() (*float32, bool) { - if o == nil { + if o == nil || IsNil(o.Offset) { return nil, false } - return o.Offset, true } -// SetOffset sets field value -func (o *BalancedNics) SetOffset(v float32) { - - o.Offset = &v - -} - // HasOffset returns a boolean if a field has been set. func (o *BalancedNics) HasOffset() bool { - if o != nil && o.Offset != nil { + if o != nil && !IsNil(o.Offset) { return true } return false } -// GetLimit returns the Limit field value -// If the value is explicit nil, nil is returned -func (o *BalancedNics) GetLimit() *float32 { - if o == nil { - return nil - } - - return o.Limit +// SetOffset gets a reference to the given float32 and assigns it to the Offset field. +func (o *BalancedNics) SetOffset(v float32) { + o.Offset = &v +} +// GetLimit returns the Limit field value if set, zero value otherwise. +func (o *BalancedNics) GetLimit() float32 { + if o == nil || IsNil(o.Limit) { + var ret float32 + return ret + } + return *o.Limit } -// GetLimitOk returns a tuple with the Limit field value +// GetLimitOk returns a tuple with the Limit 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 *BalancedNics) GetLimitOk() (*float32, bool) { - if o == nil { + if o == nil || IsNil(o.Limit) { return nil, false } - return o.Limit, true } -// SetLimit sets field value -func (o *BalancedNics) SetLimit(v float32) { - - o.Limit = &v - -} - // HasLimit returns a boolean if a field has been set. func (o *BalancedNics) HasLimit() bool { - if o != nil && o.Limit != nil { + if o != nil && !IsNil(o.Limit) { return true } return false } -// GetLinks returns the Links field value -// If the value is explicit nil, nil is returned -func (o *BalancedNics) GetLinks() *PaginationLinks { - if o == nil { - return nil - } - - return o.Links +// SetLimit gets a reference to the given float32 and assigns it to the Limit field. +func (o *BalancedNics) SetLimit(v float32) { + o.Limit = &v +} +// GetLinks returns the Links field value if set, zero value otherwise. +func (o *BalancedNics) GetLinks() PaginationLinks { + if o == nil || IsNil(o.Links) { + var ret PaginationLinks + return ret + } + return *o.Links } -// GetLinksOk returns a tuple with the Links field value +// GetLinksOk returns a tuple with the Links 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 *BalancedNics) GetLinksOk() (*PaginationLinks, bool) { - if o == nil { + if o == nil || IsNil(o.Links) { return nil, false } - return o.Links, true } -// SetLinks sets field value -func (o *BalancedNics) SetLinks(v PaginationLinks) { - - o.Links = &v - -} - // HasLinks returns a boolean if a field has been set. func (o *BalancedNics) HasLinks() bool { - if o != nil && o.Links != nil { + if o != nil && !IsNil(o.Links) { return true } return false } +// SetLinks gets a reference to the given PaginationLinks and assigns it to the Links field. +func (o *BalancedNics) SetLinks(v PaginationLinks) { + o.Links = &v +} + func (o BalancedNics) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o BalancedNics) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Items != nil { + if !IsNil(o.Items) { toSerialize["items"] = o.Items } - - if o.Offset != nil { + if !IsNil(o.Offset) { toSerialize["offset"] = o.Offset } - - if o.Limit != nil { + if !IsNil(o.Limit) { toSerialize["limit"] = o.Limit } - - if o.Links != nil { + if !IsNil(o.Links) { toSerialize["_links"] = o.Links } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableBalancedNics struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_cdroms.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_cdroms.go similarity index 59% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_cdroms.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_cdroms.go index 765f6c024..48f539daa 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_cdroms.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_cdroms.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the Cdroms type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Cdroms{} + // Cdroms struct for Cdroms type Cdroms struct { // The resource's unique identifier. @@ -23,7 +26,7 @@ type Cdroms struct { // URL to the object representation (absolute path). Href *string `json:"href,omitempty"` // Array of items in the collection. - Items *[]Image `json:"items,omitempty"` + Items []Image `json:"items,omitempty"` // The offset (if specified in the request). Offset *float32 `json:"offset,omitempty"` // The limit (if specified in the request). @@ -49,303 +52,262 @@ func NewCdromsWithDefaults() *Cdroms { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *Cdroms) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *Cdroms) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *Cdroms) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *Cdroms) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *Cdroms) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *Cdroms) GetType() *Type { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Cdroms) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *Cdroms) GetType() Type { + if o == nil || IsNil(o.Type) { + var ret Type + return ret + } + return *o.Type } -// GetTypeOk returns a tuple with the Type field value +// GetTypeOk returns a tuple with the Type 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 *Cdroms) GetTypeOk() (*Type, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *Cdroms) SetType(v Type) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *Cdroms) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *Cdroms) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given Type and assigns it to the Type field. +func (o *Cdroms) SetType(v Type) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *Cdroms) 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 +// GetHrefOk returns a tuple with the Href 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 *Cdroms) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *Cdroms) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *Cdroms) HasHref() bool { - if o != nil && o.Href != nil { + if o != nil && !IsNil(o.Href) { return true } return false } -// GetItems returns the Items field value -// If the value is explicit nil, nil is returned -func (o *Cdroms) GetItems() *[]Image { - if o == nil { - return nil - } +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *Cdroms) SetHref(v string) { + o.Href = &v +} +// GetItems returns the Items field value if set, zero value otherwise. +func (o *Cdroms) GetItems() []Image { + if o == nil || IsNil(o.Items) { + var ret []Image + return ret + } return o.Items - } -// GetItemsOk returns a tuple with the Items field value +// GetItemsOk returns a tuple with the Items 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 *Cdroms) GetItemsOk() (*[]Image, bool) { - if o == nil { +func (o *Cdroms) GetItemsOk() ([]Image, bool) { + if o == nil || IsNil(o.Items) { return nil, false } - return o.Items, true } -// SetItems sets field value -func (o *Cdroms) SetItems(v []Image) { - - o.Items = &v - -} - // HasItems returns a boolean if a field has been set. func (o *Cdroms) HasItems() bool { - if o != nil && o.Items != nil { + if o != nil && !IsNil(o.Items) { return true } return false } -// GetOffset returns the Offset field value -// If the value is explicit nil, nil is returned -func (o *Cdroms) GetOffset() *float32 { - if o == nil { - return nil - } - - return o.Offset +// SetItems gets a reference to the given []Image and assigns it to the Items field. +func (o *Cdroms) SetItems(v []Image) { + o.Items = v +} +// GetOffset returns the Offset field value if set, zero value otherwise. +func (o *Cdroms) GetOffset() float32 { + if o == nil || IsNil(o.Offset) { + var ret float32 + return ret + } + return *o.Offset } -// GetOffsetOk returns a tuple with the Offset field value +// GetOffsetOk returns a tuple with the Offset 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 *Cdroms) GetOffsetOk() (*float32, bool) { - if o == nil { + if o == nil || IsNil(o.Offset) { return nil, false } - return o.Offset, true } -// SetOffset sets field value -func (o *Cdroms) SetOffset(v float32) { - - o.Offset = &v - -} - // HasOffset returns a boolean if a field has been set. func (o *Cdroms) HasOffset() bool { - if o != nil && o.Offset != nil { + if o != nil && !IsNil(o.Offset) { return true } return false } -// GetLimit returns the Limit field value -// If the value is explicit nil, nil is returned -func (o *Cdroms) GetLimit() *float32 { - if o == nil { - return nil - } - - return o.Limit +// SetOffset gets a reference to the given float32 and assigns it to the Offset field. +func (o *Cdroms) SetOffset(v float32) { + o.Offset = &v +} +// GetLimit returns the Limit field value if set, zero value otherwise. +func (o *Cdroms) GetLimit() float32 { + if o == nil || IsNil(o.Limit) { + var ret float32 + return ret + } + return *o.Limit } -// GetLimitOk returns a tuple with the Limit field value +// GetLimitOk returns a tuple with the Limit 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 *Cdroms) GetLimitOk() (*float32, bool) { - if o == nil { + if o == nil || IsNil(o.Limit) { return nil, false } - return o.Limit, true } -// SetLimit sets field value -func (o *Cdroms) SetLimit(v float32) { - - o.Limit = &v - -} - // HasLimit returns a boolean if a field has been set. func (o *Cdroms) HasLimit() bool { - if o != nil && o.Limit != nil { + if o != nil && !IsNil(o.Limit) { return true } return false } -// GetLinks returns the Links field value -// If the value is explicit nil, nil is returned -func (o *Cdroms) GetLinks() *PaginationLinks { - if o == nil { - return nil - } - - return o.Links +// SetLimit gets a reference to the given float32 and assigns it to the Limit field. +func (o *Cdroms) SetLimit(v float32) { + o.Limit = &v +} +// GetLinks returns the Links field value if set, zero value otherwise. +func (o *Cdroms) GetLinks() PaginationLinks { + if o == nil || IsNil(o.Links) { + var ret PaginationLinks + return ret + } + return *o.Links } -// GetLinksOk returns a tuple with the Links field value +// GetLinksOk returns a tuple with the Links 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 *Cdroms) GetLinksOk() (*PaginationLinks, bool) { - if o == nil { + if o == nil || IsNil(o.Links) { return nil, false } - return o.Links, true } -// SetLinks sets field value -func (o *Cdroms) SetLinks(v PaginationLinks) { - - o.Links = &v - -} - // HasLinks returns a boolean if a field has been set. func (o *Cdroms) HasLinks() bool { - if o != nil && o.Links != nil { + if o != nil && !IsNil(o.Links) { return true } return false } +// SetLinks gets a reference to the given PaginationLinks and assigns it to the Links field. +func (o *Cdroms) SetLinks(v PaginationLinks) { + o.Links = &v +} + func (o Cdroms) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Cdroms) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Items != nil { + if !IsNil(o.Items) { toSerialize["items"] = o.Items } - - if o.Offset != nil { + if !IsNil(o.Offset) { toSerialize["offset"] = o.Offset } - - if o.Limit != nil { + if !IsNil(o.Limit) { toSerialize["limit"] = o.Limit } - - if o.Links != nil { + if !IsNil(o.Links) { toSerialize["_links"] = o.Links } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableCdroms struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_connectable_datacenter.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_connectable_datacenter.go similarity index 70% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_connectable_datacenter.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_connectable_datacenter.go index dc77ba3c9..4d7acc363 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_connectable_datacenter.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_connectable_datacenter.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the ConnectableDatacenter type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ConnectableDatacenter{} + // ConnectableDatacenter struct for ConnectableDatacenter type ConnectableDatacenter struct { // Identifier of the virtual data center that can be connected to the Cross Connect. @@ -42,135 +45,122 @@ func NewConnectableDatacenterWithDefaults() *ConnectableDatacenter { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *ConnectableDatacenter) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *ConnectableDatacenter) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *ConnectableDatacenter) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *ConnectableDatacenter) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *ConnectableDatacenter) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetName returns the Name field value -// If the value is explicit nil, nil is returned -func (o *ConnectableDatacenter) GetName() *string { - if o == nil { - return nil - } - - return o.Name +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *ConnectableDatacenter) SetId(v string) { + o.Id = &v +} +// GetName returns the Name field value if set, zero value otherwise. +func (o *ConnectableDatacenter) 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 +// GetNameOk returns a tuple with the Name 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 *ConnectableDatacenter) GetNameOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Name) { return nil, false } - return o.Name, true } -// SetName sets field value -func (o *ConnectableDatacenter) SetName(v string) { - - o.Name = &v - -} - // HasName returns a boolean if a field has been set. func (o *ConnectableDatacenter) HasName() bool { - if o != nil && o.Name != nil { + if o != nil && !IsNil(o.Name) { return true } return false } -// GetLocation returns the Location field value -// If the value is explicit nil, nil is returned -func (o *ConnectableDatacenter) GetLocation() *string { - if o == nil { - return nil - } - - return o.Location +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *ConnectableDatacenter) SetName(v string) { + o.Name = &v +} +// GetLocation returns the Location field value if set, zero value otherwise. +func (o *ConnectableDatacenter) GetLocation() string { + if o == nil || IsNil(o.Location) { + var ret string + return ret + } + return *o.Location } -// GetLocationOk returns a tuple with the Location field value +// GetLocationOk returns a tuple with the Location 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 *ConnectableDatacenter) GetLocationOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Location) { return nil, false } - return o.Location, true } -// SetLocation sets field value -func (o *ConnectableDatacenter) SetLocation(v string) { - - o.Location = &v - -} - // HasLocation returns a boolean if a field has been set. func (o *ConnectableDatacenter) HasLocation() bool { - if o != nil && o.Location != nil { + if o != nil && !IsNil(o.Location) { return true } return false } +// SetLocation gets a reference to the given string and assigns it to the Location field. +func (o *ConnectableDatacenter) SetLocation(v string) { + o.Location = &v +} + func (o ConnectableDatacenter) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ConnectableDatacenter) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Name != nil { + if !IsNil(o.Name) { toSerialize["name"] = o.Name } - - if o.Location != nil { + if !IsNil(o.Location) { toSerialize["location"] = o.Location } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableConnectableDatacenter struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_contract.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_contract.go similarity index 74% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_contract.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_contract.go index 1303e446b..512ebdab8 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_contract.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_contract.go @@ -14,11 +14,14 @@ import ( "encoding/json" ) +// checks if the Contract type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Contract{} + // Contract struct for Contract type Contract struct { // The type of the resource. - Type *Type `json:"type,omitempty"` - Properties *ContractProperties `json:"properties"` + Type *Type `json:"type,omitempty"` + Properties ContractProperties `json:"properties"` } // NewContract instantiates a new Contract object @@ -28,7 +31,7 @@ type Contract struct { func NewContract(properties ContractProperties) *Contract { this := Contract{} - this.Properties = &properties + this.Properties = properties return &this } @@ -41,93 +44,77 @@ func NewContractWithDefaults() *Contract { return &this } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *Contract) GetType() *Type { - if o == nil { - return nil +// GetType returns the Type field value if set, zero value otherwise. +func (o *Contract) GetType() Type { + if o == nil || IsNil(o.Type) { + var ret Type + return ret } - - return o.Type - + return *o.Type } -// GetTypeOk returns a tuple with the Type field value +// GetTypeOk returns a tuple with the Type 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 *Contract) GetTypeOk() (*Type, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *Contract) SetType(v Type) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *Contract) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } +// SetType gets a reference to the given Type and assigns it to the Type field. +func (o *Contract) SetType(v Type) { + o.Type = &v +} + // GetProperties returns the Properties field value -// If the value is explicit nil, nil is returned -func (o *Contract) GetProperties() *ContractProperties { +func (o *Contract) GetProperties() ContractProperties { if o == nil { - return nil + var ret ContractProperties + return ret } return o.Properties - } // GetPropertiesOk returns a tuple with the Properties field value // 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 *Contract) GetPropertiesOk() (*ContractProperties, bool) { if o == nil { return nil, false } - - return o.Properties, true + return &o.Properties, true } // SetProperties sets field value func (o *Contract) SetProperties(v ContractProperties) { - - o.Properties = &v - + o.Properties = v } -// HasProperties returns a boolean if a field has been set. -func (o *Contract) HasProperties() bool { - if o != nil && o.Properties != nil { - return true +func (o Contract) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } - - return false + return json.Marshal(toSerialize) } -func (o Contract) MarshalJSON() ([]byte, error) { +func (o Contract) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Properties != nil { - toSerialize["properties"] = o.Properties - } - - return json.Marshal(toSerialize) + toSerialize["properties"] = o.Properties + return toSerialize, nil } type NullableContract struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_contract_properties.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_contract_properties.go similarity index 65% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_contract_properties.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_contract_properties.go index 3916d2bf2..a607fef6c 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_contract_properties.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_contract_properties.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the ContractProperties type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ContractProperties{} + // ContractProperties struct for ContractProperties type ContractProperties struct { // The contract number. @@ -45,219 +48,192 @@ func NewContractPropertiesWithDefaults() *ContractProperties { return &this } -// GetContractNumber returns the ContractNumber field value -// If the value is explicit nil, nil is returned -func (o *ContractProperties) GetContractNumber() *int64 { - if o == nil { - return nil +// GetContractNumber returns the ContractNumber field value if set, zero value otherwise. +func (o *ContractProperties) GetContractNumber() int64 { + if o == nil || IsNil(o.ContractNumber) { + var ret int64 + return ret } - - return o.ContractNumber - + return *o.ContractNumber } -// GetContractNumberOk returns a tuple with the ContractNumber field value +// GetContractNumberOk returns a tuple with the ContractNumber 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 *ContractProperties) GetContractNumberOk() (*int64, bool) { - if o == nil { + if o == nil || IsNil(o.ContractNumber) { return nil, false } - return o.ContractNumber, true } -// SetContractNumber sets field value -func (o *ContractProperties) SetContractNumber(v int64) { - - o.ContractNumber = &v - -} - // HasContractNumber returns a boolean if a field has been set. func (o *ContractProperties) HasContractNumber() bool { - if o != nil && o.ContractNumber != nil { + if o != nil && !IsNil(o.ContractNumber) { return true } return false } -// GetOwner returns the Owner field value -// If the value is explicit nil, nil is returned -func (o *ContractProperties) GetOwner() *string { - if o == nil { - return nil - } - - return o.Owner +// SetContractNumber gets a reference to the given int64 and assigns it to the ContractNumber field. +func (o *ContractProperties) SetContractNumber(v int64) { + o.ContractNumber = &v +} +// GetOwner returns the Owner field value if set, zero value otherwise. +func (o *ContractProperties) GetOwner() string { + if o == nil || IsNil(o.Owner) { + var ret string + return ret + } + return *o.Owner } -// GetOwnerOk returns a tuple with the Owner field value +// GetOwnerOk returns a tuple with the Owner 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 *ContractProperties) GetOwnerOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Owner) { return nil, false } - return o.Owner, true } -// SetOwner sets field value -func (o *ContractProperties) SetOwner(v string) { - - o.Owner = &v - -} - // HasOwner returns a boolean if a field has been set. func (o *ContractProperties) HasOwner() bool { - if o != nil && o.Owner != nil { + if o != nil && !IsNil(o.Owner) { return true } return false } -// GetStatus returns the Status field value -// If the value is explicit nil, nil is returned -func (o *ContractProperties) GetStatus() *string { - if o == nil { - return nil - } - - return o.Status +// SetOwner gets a reference to the given string and assigns it to the Owner field. +func (o *ContractProperties) SetOwner(v string) { + o.Owner = &v +} +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *ContractProperties) 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 +// GetStatusOk returns a tuple with the Status 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 *ContractProperties) GetStatusOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Status) { return nil, false } - return o.Status, true } -// SetStatus sets field value -func (o *ContractProperties) SetStatus(v string) { - - o.Status = &v - -} - // HasStatus returns a boolean if a field has been set. func (o *ContractProperties) HasStatus() bool { - if o != nil && o.Status != nil { + if o != nil && !IsNil(o.Status) { return true } return false } -// GetRegDomain returns the RegDomain field value -// If the value is explicit nil, nil is returned -func (o *ContractProperties) GetRegDomain() *string { - if o == nil { - return nil - } - - return o.RegDomain +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *ContractProperties) SetStatus(v string) { + o.Status = &v +} +// GetRegDomain returns the RegDomain field value if set, zero value otherwise. +func (o *ContractProperties) GetRegDomain() string { + if o == nil || IsNil(o.RegDomain) { + var ret string + return ret + } + return *o.RegDomain } -// GetRegDomainOk returns a tuple with the RegDomain field value +// GetRegDomainOk returns a tuple with the RegDomain 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 *ContractProperties) GetRegDomainOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.RegDomain) { return nil, false } - return o.RegDomain, true } -// SetRegDomain sets field value -func (o *ContractProperties) SetRegDomain(v string) { - - o.RegDomain = &v - -} - // HasRegDomain returns a boolean if a field has been set. func (o *ContractProperties) HasRegDomain() bool { - if o != nil && o.RegDomain != nil { + if o != nil && !IsNil(o.RegDomain) { return true } return false } -// GetResourceLimits returns the ResourceLimits field value -// If the value is explicit nil, nil is returned -func (o *ContractProperties) GetResourceLimits() *ResourceLimits { - if o == nil { - return nil - } - - return o.ResourceLimits +// SetRegDomain gets a reference to the given string and assigns it to the RegDomain field. +func (o *ContractProperties) SetRegDomain(v string) { + o.RegDomain = &v +} +// GetResourceLimits returns the ResourceLimits field value if set, zero value otherwise. +func (o *ContractProperties) GetResourceLimits() ResourceLimits { + if o == nil || IsNil(o.ResourceLimits) { + var ret ResourceLimits + return ret + } + return *o.ResourceLimits } -// GetResourceLimitsOk returns a tuple with the ResourceLimits field value +// GetResourceLimitsOk returns a tuple with the ResourceLimits 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 *ContractProperties) GetResourceLimitsOk() (*ResourceLimits, bool) { - if o == nil { + if o == nil || IsNil(o.ResourceLimits) { return nil, false } - return o.ResourceLimits, true } -// SetResourceLimits sets field value -func (o *ContractProperties) SetResourceLimits(v ResourceLimits) { - - o.ResourceLimits = &v - -} - // HasResourceLimits returns a boolean if a field has been set. func (o *ContractProperties) HasResourceLimits() bool { - if o != nil && o.ResourceLimits != nil { + if o != nil && !IsNil(o.ResourceLimits) { return true } return false } +// SetResourceLimits gets a reference to the given ResourceLimits and assigns it to the ResourceLimits field. +func (o *ContractProperties) SetResourceLimits(v ResourceLimits) { + o.ResourceLimits = &v +} + func (o ContractProperties) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ContractProperties) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.ContractNumber != nil { + if !IsNil(o.ContractNumber) { toSerialize["contractNumber"] = o.ContractNumber } - - if o.Owner != nil { + if !IsNil(o.Owner) { toSerialize["owner"] = o.Owner } - - if o.Status != nil { + if !IsNil(o.Status) { toSerialize["status"] = o.Status } - - if o.RegDomain != nil { + if !IsNil(o.RegDomain) { toSerialize["regDomain"] = o.RegDomain } - - if o.ResourceLimits != nil { + if !IsNil(o.ResourceLimits) { toSerialize["resourceLimits"] = o.ResourceLimits } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableContractProperties struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_contracts.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_contracts.go similarity index 64% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_contracts.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_contracts.go index a922ba4ea..19afee440 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_contracts.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_contracts.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the Contracts type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Contracts{} + // Contracts struct for Contracts type Contracts struct { // The resource's unique identifier. @@ -23,7 +26,7 @@ type Contracts struct { // The URL to the object representation (absolute path). Href *string `json:"href,omitempty"` // Array of items in the collection. - Items *[]Contract `json:"items,omitempty"` + Items []Contract `json:"items,omitempty"` } // NewContracts instantiates a new Contracts object @@ -44,177 +47,157 @@ func NewContractsWithDefaults() *Contracts { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *Contracts) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *Contracts) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *Contracts) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *Contracts) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *Contracts) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *Contracts) GetType() *Type { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Contracts) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *Contracts) GetType() Type { + if o == nil || IsNil(o.Type) { + var ret Type + return ret + } + return *o.Type } -// GetTypeOk returns a tuple with the Type field value +// GetTypeOk returns a tuple with the Type 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 *Contracts) GetTypeOk() (*Type, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *Contracts) SetType(v Type) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *Contracts) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *Contracts) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given Type and assigns it to the Type field. +func (o *Contracts) SetType(v Type) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *Contracts) 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 +// GetHrefOk returns a tuple with the Href 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 *Contracts) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *Contracts) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *Contracts) HasHref() bool { - if o != nil && o.Href != nil { + if o != nil && !IsNil(o.Href) { return true } return false } -// GetItems returns the Items field value -// If the value is explicit nil, nil is returned -func (o *Contracts) GetItems() *[]Contract { - if o == nil { - return nil - } +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *Contracts) SetHref(v string) { + o.Href = &v +} +// GetItems returns the Items field value if set, zero value otherwise. +func (o *Contracts) GetItems() []Contract { + if o == nil || IsNil(o.Items) { + var ret []Contract + return ret + } return o.Items - } -// GetItemsOk returns a tuple with the Items field value +// GetItemsOk returns a tuple with the Items 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 *Contracts) GetItemsOk() (*[]Contract, bool) { - if o == nil { +func (o *Contracts) GetItemsOk() ([]Contract, bool) { + if o == nil || IsNil(o.Items) { return nil, false } - return o.Items, true } -// SetItems sets field value -func (o *Contracts) SetItems(v []Contract) { - - o.Items = &v - -} - // HasItems returns a boolean if a field has been set. func (o *Contracts) HasItems() bool { - if o != nil && o.Items != nil { + if o != nil && !IsNil(o.Items) { return true } return false } +// SetItems gets a reference to the given []Contract and assigns it to the Items field. +func (o *Contracts) SetItems(v []Contract) { + o.Items = v +} + func (o Contracts) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Contracts) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Items != nil { + if !IsNil(o.Items) { toSerialize["items"] = o.Items } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableContracts struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_cpu_architecture_properties.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_cpu_architecture_properties.go similarity index 68% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_cpu_architecture_properties.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_cpu_architecture_properties.go index 2950bbf35..da8043c2c 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_cpu_architecture_properties.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_cpu_architecture_properties.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the CpuArchitectureProperties type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CpuArchitectureProperties{} + // CpuArchitectureProperties struct for CpuArchitectureProperties type CpuArchitectureProperties struct { // A valid CPU family name. @@ -44,177 +47,157 @@ func NewCpuArchitecturePropertiesWithDefaults() *CpuArchitectureProperties { return &this } -// GetCpuFamily returns the CpuFamily field value -// If the value is explicit nil, nil is returned -func (o *CpuArchitectureProperties) GetCpuFamily() *string { - if o == nil { - return nil +// GetCpuFamily returns the CpuFamily field value if set, zero value otherwise. +func (o *CpuArchitectureProperties) GetCpuFamily() string { + if o == nil || IsNil(o.CpuFamily) { + var ret string + return ret } - - return o.CpuFamily - + return *o.CpuFamily } -// GetCpuFamilyOk returns a tuple with the CpuFamily field value +// GetCpuFamilyOk returns a tuple with the CpuFamily 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 *CpuArchitectureProperties) GetCpuFamilyOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.CpuFamily) { return nil, false } - return o.CpuFamily, true } -// SetCpuFamily sets field value -func (o *CpuArchitectureProperties) SetCpuFamily(v string) { - - o.CpuFamily = &v - -} - // HasCpuFamily returns a boolean if a field has been set. func (o *CpuArchitectureProperties) HasCpuFamily() bool { - if o != nil && o.CpuFamily != nil { + if o != nil && !IsNil(o.CpuFamily) { return true } return false } -// GetMaxCores returns the MaxCores field value -// If the value is explicit nil, nil is returned -func (o *CpuArchitectureProperties) GetMaxCores() *int32 { - if o == nil { - return nil - } - - return o.MaxCores +// SetCpuFamily gets a reference to the given string and assigns it to the CpuFamily field. +func (o *CpuArchitectureProperties) SetCpuFamily(v string) { + o.CpuFamily = &v +} +// GetMaxCores returns the MaxCores field value if set, zero value otherwise. +func (o *CpuArchitectureProperties) GetMaxCores() int32 { + if o == nil || IsNil(o.MaxCores) { + var ret int32 + return ret + } + return *o.MaxCores } -// GetMaxCoresOk returns a tuple with the MaxCores field value +// GetMaxCoresOk returns a tuple with the MaxCores 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 *CpuArchitectureProperties) GetMaxCoresOk() (*int32, bool) { - if o == nil { + if o == nil || IsNil(o.MaxCores) { return nil, false } - return o.MaxCores, true } -// SetMaxCores sets field value -func (o *CpuArchitectureProperties) SetMaxCores(v int32) { - - o.MaxCores = &v - -} - // HasMaxCores returns a boolean if a field has been set. func (o *CpuArchitectureProperties) HasMaxCores() bool { - if o != nil && o.MaxCores != nil { + if o != nil && !IsNil(o.MaxCores) { return true } return false } -// GetMaxRam returns the MaxRam field value -// If the value is explicit nil, nil is returned -func (o *CpuArchitectureProperties) GetMaxRam() *int32 { - if o == nil { - return nil - } - - return o.MaxRam +// SetMaxCores gets a reference to the given int32 and assigns it to the MaxCores field. +func (o *CpuArchitectureProperties) SetMaxCores(v int32) { + o.MaxCores = &v +} +// GetMaxRam returns the MaxRam field value if set, zero value otherwise. +func (o *CpuArchitectureProperties) GetMaxRam() int32 { + if o == nil || IsNil(o.MaxRam) { + var ret int32 + return ret + } + return *o.MaxRam } -// GetMaxRamOk returns a tuple with the MaxRam field value +// GetMaxRamOk returns a tuple with the MaxRam 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 *CpuArchitectureProperties) GetMaxRamOk() (*int32, bool) { - if o == nil { + if o == nil || IsNil(o.MaxRam) { return nil, false } - return o.MaxRam, true } -// SetMaxRam sets field value -func (o *CpuArchitectureProperties) SetMaxRam(v int32) { - - o.MaxRam = &v - -} - // HasMaxRam returns a boolean if a field has been set. func (o *CpuArchitectureProperties) HasMaxRam() bool { - if o != nil && o.MaxRam != nil { + if o != nil && !IsNil(o.MaxRam) { return true } return false } -// GetVendor returns the Vendor field value -// If the value is explicit nil, nil is returned -func (o *CpuArchitectureProperties) GetVendor() *string { - if o == nil { - return nil - } - - return o.Vendor +// SetMaxRam gets a reference to the given int32 and assigns it to the MaxRam field. +func (o *CpuArchitectureProperties) SetMaxRam(v int32) { + o.MaxRam = &v +} +// GetVendor returns the Vendor field value if set, zero value otherwise. +func (o *CpuArchitectureProperties) 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 +// GetVendorOk returns a tuple with the Vendor 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 *CpuArchitectureProperties) GetVendorOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Vendor) { return nil, false } - return o.Vendor, true } -// SetVendor sets field value -func (o *CpuArchitectureProperties) SetVendor(v string) { - - o.Vendor = &v - -} - // HasVendor returns a boolean if a field has been set. func (o *CpuArchitectureProperties) HasVendor() bool { - if o != nil && o.Vendor != nil { + 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 *CpuArchitectureProperties) SetVendor(v string) { + o.Vendor = &v +} + func (o CpuArchitectureProperties) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CpuArchitectureProperties) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.CpuFamily != nil { + if !IsNil(o.CpuFamily) { toSerialize["cpuFamily"] = o.CpuFamily } - - if o.MaxCores != nil { + if !IsNil(o.MaxCores) { toSerialize["maxCores"] = o.MaxCores } - - if o.MaxRam != nil { + if !IsNil(o.MaxRam) { toSerialize["maxRam"] = o.MaxRam } - - if o.Vendor != nil { + if !IsNil(o.Vendor) { toSerialize["vendor"] = o.Vendor } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableCpuArchitectureProperties struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_create_snapshot.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_create_snapshot.go similarity index 78% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_create_snapshot.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_create_snapshot.go index 176bc07ec..d731a9947 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_create_snapshot.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_create_snapshot.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the CreateSnapshot type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateSnapshot{} + // CreateSnapshot struct for CreateSnapshot type CreateSnapshot struct { Properties *CreateSnapshotProperties `json:"properties,omitempty"` @@ -37,51 +40,52 @@ func NewCreateSnapshotWithDefaults() *CreateSnapshot { return &this } -// GetProperties returns the Properties field value -// If the value is explicit nil, nil is returned -func (o *CreateSnapshot) GetProperties() *CreateSnapshotProperties { - if o == nil { - return nil +// GetProperties returns the Properties field value if set, zero value otherwise. +func (o *CreateSnapshot) GetProperties() CreateSnapshotProperties { + if o == nil || IsNil(o.Properties) { + var ret CreateSnapshotProperties + return ret } - - return o.Properties - + return *o.Properties } -// GetPropertiesOk returns a tuple with the Properties field value +// GetPropertiesOk returns a tuple with the Properties 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 *CreateSnapshot) GetPropertiesOk() (*CreateSnapshotProperties, bool) { - if o == nil { + if o == nil || IsNil(o.Properties) { return nil, false } - return o.Properties, true } -// SetProperties sets field value -func (o *CreateSnapshot) SetProperties(v CreateSnapshotProperties) { - - o.Properties = &v - -} - // HasProperties returns a boolean if a field has been set. func (o *CreateSnapshot) HasProperties() bool { - if o != nil && o.Properties != nil { + if o != nil && !IsNil(o.Properties) { return true } return false } +// SetProperties gets a reference to the given CreateSnapshotProperties and assigns it to the Properties field. +func (o *CreateSnapshot) SetProperties(v CreateSnapshotProperties) { + o.Properties = &v +} + func (o CreateSnapshot) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CreateSnapshot) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Properties != nil { + if !IsNil(o.Properties) { toSerialize["properties"] = o.Properties } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableCreateSnapshot struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_create_snapshot_properties.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_create_snapshot_properties.go similarity index 69% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_create_snapshot_properties.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_create_snapshot_properties.go index 563dc7f3a..d780530a2 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_create_snapshot_properties.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_create_snapshot_properties.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the CreateSnapshotProperties type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateSnapshotProperties{} + // CreateSnapshotProperties struct for CreateSnapshotProperties type CreateSnapshotProperties struct { // The name of the snapshot @@ -44,177 +47,157 @@ func NewCreateSnapshotPropertiesWithDefaults() *CreateSnapshotProperties { return &this } -// GetName returns the Name field value -// If the value is explicit nil, nil is returned -func (o *CreateSnapshotProperties) GetName() *string { - if o == nil { - return nil +// GetName returns the Name field value if set, zero value otherwise. +func (o *CreateSnapshotProperties) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret } - - return o.Name - + return *o.Name } -// GetNameOk returns a tuple with the Name field value +// GetNameOk returns a tuple with the Name 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 *CreateSnapshotProperties) GetNameOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Name) { return nil, false } - return o.Name, true } -// SetName sets field value -func (o *CreateSnapshotProperties) SetName(v string) { - - o.Name = &v - -} - // HasName returns a boolean if a field has been set. func (o *CreateSnapshotProperties) HasName() bool { - if o != nil && o.Name != nil { + if o != nil && !IsNil(o.Name) { return true } return false } -// GetDescription returns the Description field value -// If the value is explicit nil, nil is returned -func (o *CreateSnapshotProperties) GetDescription() *string { - if o == nil { - return nil - } - - return o.Description +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *CreateSnapshotProperties) SetName(v string) { + o.Name = &v +} +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *CreateSnapshotProperties) 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 +// GetDescriptionOk returns a tuple with the Description 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 *CreateSnapshotProperties) GetDescriptionOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Description) { return nil, false } - return o.Description, true } -// SetDescription sets field value -func (o *CreateSnapshotProperties) SetDescription(v string) { - - o.Description = &v - -} - // HasDescription returns a boolean if a field has been set. func (o *CreateSnapshotProperties) HasDescription() bool { - if o != nil && o.Description != nil { + if o != nil && !IsNil(o.Description) { return true } return false } -// GetSecAuthProtection returns the SecAuthProtection field value -// If the value is explicit nil, nil is returned -func (o *CreateSnapshotProperties) GetSecAuthProtection() *bool { - if o == nil { - return nil - } - - return o.SecAuthProtection +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *CreateSnapshotProperties) SetDescription(v string) { + o.Description = &v +} +// GetSecAuthProtection returns the SecAuthProtection field value if set, zero value otherwise. +func (o *CreateSnapshotProperties) GetSecAuthProtection() bool { + if o == nil || IsNil(o.SecAuthProtection) { + var ret bool + return ret + } + return *o.SecAuthProtection } -// GetSecAuthProtectionOk returns a tuple with the SecAuthProtection field value +// GetSecAuthProtectionOk returns a tuple with the SecAuthProtection 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 *CreateSnapshotProperties) GetSecAuthProtectionOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.SecAuthProtection) { return nil, false } - return o.SecAuthProtection, true } -// SetSecAuthProtection sets field value -func (o *CreateSnapshotProperties) SetSecAuthProtection(v bool) { - - o.SecAuthProtection = &v - -} - // HasSecAuthProtection returns a boolean if a field has been set. func (o *CreateSnapshotProperties) HasSecAuthProtection() bool { - if o != nil && o.SecAuthProtection != nil { + if o != nil && !IsNil(o.SecAuthProtection) { return true } return false } -// GetLicenceType returns the LicenceType field value -// If the value is explicit nil, nil is returned -func (o *CreateSnapshotProperties) GetLicenceType() *string { - if o == nil { - return nil - } - - return o.LicenceType +// SetSecAuthProtection gets a reference to the given bool and assigns it to the SecAuthProtection field. +func (o *CreateSnapshotProperties) SetSecAuthProtection(v bool) { + o.SecAuthProtection = &v +} +// GetLicenceType returns the LicenceType field value if set, zero value otherwise. +func (o *CreateSnapshotProperties) GetLicenceType() string { + if o == nil || IsNil(o.LicenceType) { + var ret string + return ret + } + return *o.LicenceType } -// GetLicenceTypeOk returns a tuple with the LicenceType field value +// GetLicenceTypeOk returns a tuple with the LicenceType 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 *CreateSnapshotProperties) GetLicenceTypeOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.LicenceType) { return nil, false } - return o.LicenceType, true } -// SetLicenceType sets field value -func (o *CreateSnapshotProperties) SetLicenceType(v string) { - - o.LicenceType = &v - -} - // HasLicenceType returns a boolean if a field has been set. func (o *CreateSnapshotProperties) HasLicenceType() bool { - if o != nil && o.LicenceType != nil { + if o != nil && !IsNil(o.LicenceType) { return true } return false } +// SetLicenceType gets a reference to the given string and assigns it to the LicenceType field. +func (o *CreateSnapshotProperties) SetLicenceType(v string) { + o.LicenceType = &v +} + func (o CreateSnapshotProperties) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CreateSnapshotProperties) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Name != nil { + if !IsNil(o.Name) { toSerialize["name"] = o.Name } - - if o.Description != nil { + if !IsNil(o.Description) { toSerialize["description"] = o.Description } - - if o.SecAuthProtection != nil { + if !IsNil(o.SecAuthProtection) { toSerialize["secAuthProtection"] = o.SecAuthProtection } - - if o.LicenceType != nil { + if !IsNil(o.LicenceType) { toSerialize["licenceType"] = o.LicenceType } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableCreateSnapshotProperties struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_datacenter.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_datacenter.go similarity index 61% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_datacenter.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_datacenter.go index 0e98f8bcd..109e07f3f 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_datacenter.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_datacenter.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the Datacenter type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Datacenter{} + // Datacenter struct for Datacenter type Datacenter struct { // The resource's unique identifier. @@ -23,8 +26,8 @@ type Datacenter struct { // URL to the object representation (absolute path). Href *string `json:"href,omitempty"` Metadata *DatacenterElementMetadata `json:"metadata,omitempty"` - Properties *DatacenterProperties `json:"properties"` - Entities *DataCenterEntities `json:"entities,omitempty"` + Properties DatacenterProperties `json:"properties"` + Entities *DatacenterEntities `json:"entities,omitempty"` } // NewDatacenter instantiates a new Datacenter object @@ -34,7 +37,7 @@ type Datacenter struct { func NewDatacenter(properties DatacenterProperties) *Datacenter { this := Datacenter{} - this.Properties = &properties + this.Properties = properties return &this } @@ -47,261 +50,217 @@ func NewDatacenterWithDefaults() *Datacenter { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *Datacenter) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *Datacenter) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *Datacenter) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *Datacenter) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *Datacenter) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *Datacenter) GetType() *Type { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Datacenter) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *Datacenter) GetType() Type { + if o == nil || IsNil(o.Type) { + var ret Type + return ret + } + return *o.Type } -// GetTypeOk returns a tuple with the Type field value +// GetTypeOk returns a tuple with the Type 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 *Datacenter) GetTypeOk() (*Type, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *Datacenter) SetType(v Type) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *Datacenter) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *Datacenter) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given Type and assigns it to the Type field. +func (o *Datacenter) SetType(v Type) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *Datacenter) 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 +// GetHrefOk returns a tuple with the Href 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 *Datacenter) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *Datacenter) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *Datacenter) HasHref() bool { - if o != nil && o.Href != nil { + if o != nil && !IsNil(o.Href) { return true } return false } -// GetMetadata returns the Metadata field value -// If the value is explicit nil, nil is returned -func (o *Datacenter) GetMetadata() *DatacenterElementMetadata { - if o == nil { - return nil - } - - return o.Metadata +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *Datacenter) SetHref(v string) { + o.Href = &v +} +// GetMetadata returns the Metadata field value if set, zero value otherwise. +func (o *Datacenter) GetMetadata() DatacenterElementMetadata { + if o == nil || IsNil(o.Metadata) { + var ret DatacenterElementMetadata + return ret + } + return *o.Metadata } -// GetMetadataOk returns a tuple with the Metadata field value +// GetMetadataOk returns a tuple with the Metadata 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 *Datacenter) GetMetadataOk() (*DatacenterElementMetadata, bool) { - if o == nil { + if o == nil || IsNil(o.Metadata) { return nil, false } - return o.Metadata, true } -// SetMetadata sets field value -func (o *Datacenter) SetMetadata(v DatacenterElementMetadata) { - - o.Metadata = &v - -} - // HasMetadata returns a boolean if a field has been set. func (o *Datacenter) HasMetadata() bool { - if o != nil && o.Metadata != nil { + if o != nil && !IsNil(o.Metadata) { return true } return false } +// SetMetadata gets a reference to the given DatacenterElementMetadata and assigns it to the Metadata field. +func (o *Datacenter) SetMetadata(v DatacenterElementMetadata) { + o.Metadata = &v +} + // GetProperties returns the Properties field value -// If the value is explicit nil, nil is returned -func (o *Datacenter) GetProperties() *DatacenterProperties { +func (o *Datacenter) GetProperties() DatacenterProperties { if o == nil { - return nil + var ret DatacenterProperties + return ret } return o.Properties - } // GetPropertiesOk returns a tuple with the Properties field value // 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 *Datacenter) GetPropertiesOk() (*DatacenterProperties, bool) { if o == nil { return nil, false } - - return o.Properties, true + return &o.Properties, true } // SetProperties sets field value func (o *Datacenter) SetProperties(v DatacenterProperties) { - - o.Properties = &v - -} - -// HasProperties returns a boolean if a field has been set. -func (o *Datacenter) HasProperties() bool { - if o != nil && o.Properties != nil { - return true - } - - return false + o.Properties = v } -// GetEntities returns the Entities field value -// If the value is explicit nil, nil is returned -func (o *Datacenter) GetEntities() *DataCenterEntities { - if o == nil { - return nil +// GetEntities returns the Entities field value if set, zero value otherwise. +func (o *Datacenter) GetEntities() DatacenterEntities { + if o == nil || IsNil(o.Entities) { + var ret DatacenterEntities + return ret } - - return o.Entities - + return *o.Entities } -// GetEntitiesOk returns a tuple with the Entities field value +// GetEntitiesOk returns a tuple with the Entities 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 *Datacenter) GetEntitiesOk() (*DataCenterEntities, bool) { - if o == nil { +func (o *Datacenter) GetEntitiesOk() (*DatacenterEntities, bool) { + if o == nil || IsNil(o.Entities) { return nil, false } - return o.Entities, true } -// SetEntities sets field value -func (o *Datacenter) SetEntities(v DataCenterEntities) { - - o.Entities = &v - -} - // HasEntities returns a boolean if a field has been set. func (o *Datacenter) HasEntities() bool { - if o != nil && o.Entities != nil { + if o != nil && !IsNil(o.Entities) { return true } return false } +// SetEntities gets a reference to the given DatacenterEntities and assigns it to the Entities field. +func (o *Datacenter) SetEntities(v DatacenterEntities) { + o.Entities = &v +} + func (o Datacenter) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Datacenter) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Metadata != nil { + if !IsNil(o.Metadata) { toSerialize["metadata"] = o.Metadata } - - if o.Properties != nil { - toSerialize["properties"] = o.Properties - } - - if o.Entities != nil { + toSerialize["properties"] = o.Properties + if !IsNil(o.Entities) { toSerialize["entities"] = o.Entities } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableDatacenter struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_datacenter_element_metadata.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_datacenter_element_metadata.go similarity index 67% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_datacenter_element_metadata.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_datacenter_element_metadata.go index e63b1d50d..a94dcc452 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_datacenter_element_metadata.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_datacenter_element_metadata.go @@ -12,21 +12,25 @@ package ionoscloud import ( "encoding/json" + "time" ) +// checks if the DatacenterElementMetadata type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DatacenterElementMetadata{} + // DatacenterElementMetadata struct for DatacenterElementMetadata type DatacenterElementMetadata struct { // Resource's Entity Tag as defined in http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.11 Entity Tag is also added as an 'ETag response header to requests which don't use 'depth' parameter. Etag *string `json:"etag,omitempty"` // The last time the resource was created. - CreatedDate *IonosTime + CreatedDate *IonosTime `json:"createdDate,omitempty"` // The user who created the resource. CreatedBy *string `json:"createdBy,omitempty"` // The unique ID of the user who created the resource. CreatedByUserId *string `json:"createdByUserId,omitempty"` // The last time the resource was modified. - LastModifiedDate *IonosTime + LastModifiedDate *IonosTime `json:"lastModifiedDate,omitempty"` // The user who last modified the resource. LastModifiedBy *string `json:"lastModifiedBy,omitempty"` // The unique ID of the user who last modified the resource. @@ -53,359 +57,297 @@ func NewDatacenterElementMetadataWithDefaults() *DatacenterElementMetadata { return &this } -// GetEtag returns the Etag field value -// If the value is explicit nil, nil is returned -func (o *DatacenterElementMetadata) GetEtag() *string { - if o == nil { - return nil +// GetEtag returns the Etag field value if set, zero value otherwise. +func (o *DatacenterElementMetadata) GetEtag() string { + if o == nil || IsNil(o.Etag) { + var ret string + return ret } - - return o.Etag - + return *o.Etag } -// GetEtagOk returns a tuple with the Etag field value +// GetEtagOk returns a tuple with the Etag 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 *DatacenterElementMetadata) GetEtagOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Etag) { return nil, false } - return o.Etag, true } -// SetEtag sets field value -func (o *DatacenterElementMetadata) SetEtag(v string) { - - o.Etag = &v - -} - // HasEtag returns a boolean if a field has been set. func (o *DatacenterElementMetadata) HasEtag() bool { - if o != nil && o.Etag != nil { + if o != nil && !IsNil(o.Etag) { return true } return false } -// GetCreatedDate returns the CreatedDate field value -// If the value is explicit nil, nil is returned -func (o *DatacenterElementMetadata) GetCreatedDate() *time.Time { - if o == nil { - return nil - } +// SetEtag gets a reference to the given string and assigns it to the Etag field. +func (o *DatacenterElementMetadata) SetEtag(v string) { + o.Etag = &v +} - if o.CreatedDate == nil { - return nil +// GetCreatedDate returns the CreatedDate field value if set, zero value otherwise. +func (o *DatacenterElementMetadata) GetCreatedDate() time.Time { + if o == nil || IsNil(o.CreatedDate) { + var ret time.Time + return ret } - return &o.CreatedDate.Time - + return o.CreatedDate.Time } -// GetCreatedDateOk returns a tuple with the CreatedDate field value +// GetCreatedDateOk returns a tuple with the CreatedDate 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 *DatacenterElementMetadata) GetCreatedDateOk() (*time.Time, bool) { - if o == nil { - return nil, false - } - - if o.CreatedDate == nil { + if o == nil || IsNil(o.CreatedDate) { return nil, false } return &o.CreatedDate.Time, true - -} - -// SetCreatedDate sets field value -func (o *DatacenterElementMetadata) SetCreatedDate(v time.Time) { - - o.CreatedDate = &IonosTime{v} - } // HasCreatedDate returns a boolean if a field has been set. func (o *DatacenterElementMetadata) HasCreatedDate() bool { - if o != nil && o.CreatedDate != nil { + if o != nil && !IsNil(o.CreatedDate) { return true } return false } -// GetCreatedBy returns the CreatedBy field value -// If the value is explicit nil, nil is returned -func (o *DatacenterElementMetadata) GetCreatedBy() *string { - if o == nil { - return nil - } - - return o.CreatedBy +// SetCreatedDate gets a reference to the given time.Time and assigns it to the CreatedDate field. +func (o *DatacenterElementMetadata) SetCreatedDate(v time.Time) { + o.CreatedDate = &IonosTime{v} +} +// GetCreatedBy returns the CreatedBy field value if set, zero value otherwise. +func (o *DatacenterElementMetadata) GetCreatedBy() string { + if o == nil || IsNil(o.CreatedBy) { + var ret string + return ret + } + return *o.CreatedBy } -// GetCreatedByOk returns a tuple with the CreatedBy field value +// GetCreatedByOk returns a tuple with the CreatedBy 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 *DatacenterElementMetadata) GetCreatedByOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.CreatedBy) { return nil, false } - return o.CreatedBy, true } -// SetCreatedBy sets field value -func (o *DatacenterElementMetadata) SetCreatedBy(v string) { - - o.CreatedBy = &v - -} - // HasCreatedBy returns a boolean if a field has been set. func (o *DatacenterElementMetadata) HasCreatedBy() bool { - if o != nil && o.CreatedBy != nil { + if o != nil && !IsNil(o.CreatedBy) { return true } return false } -// GetCreatedByUserId returns the CreatedByUserId field value -// If the value is explicit nil, nil is returned -func (o *DatacenterElementMetadata) GetCreatedByUserId() *string { - if o == nil { - return nil - } - - return o.CreatedByUserId +// SetCreatedBy gets a reference to the given string and assigns it to the CreatedBy field. +func (o *DatacenterElementMetadata) SetCreatedBy(v string) { + o.CreatedBy = &v +} +// GetCreatedByUserId returns the CreatedByUserId field value if set, zero value otherwise. +func (o *DatacenterElementMetadata) GetCreatedByUserId() string { + if o == nil || IsNil(o.CreatedByUserId) { + var ret string + return ret + } + return *o.CreatedByUserId } -// GetCreatedByUserIdOk returns a tuple with the CreatedByUserId field value +// GetCreatedByUserIdOk returns a tuple with the CreatedByUserId 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 *DatacenterElementMetadata) GetCreatedByUserIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.CreatedByUserId) { return nil, false } - return o.CreatedByUserId, true } -// SetCreatedByUserId sets field value -func (o *DatacenterElementMetadata) SetCreatedByUserId(v string) { - - o.CreatedByUserId = &v - -} - // HasCreatedByUserId returns a boolean if a field has been set. func (o *DatacenterElementMetadata) HasCreatedByUserId() bool { - if o != nil && o.CreatedByUserId != nil { + if o != nil && !IsNil(o.CreatedByUserId) { return true } return false } -// GetLastModifiedDate returns the LastModifiedDate field value -// If the value is explicit nil, nil is returned -func (o *DatacenterElementMetadata) GetLastModifiedDate() *time.Time { - if o == nil { - return nil - } +// SetCreatedByUserId gets a reference to the given string and assigns it to the CreatedByUserId field. +func (o *DatacenterElementMetadata) SetCreatedByUserId(v string) { + o.CreatedByUserId = &v +} - if o.LastModifiedDate == nil { - return nil +// GetLastModifiedDate returns the LastModifiedDate field value if set, zero value otherwise. +func (o *DatacenterElementMetadata) GetLastModifiedDate() time.Time { + if o == nil || IsNil(o.LastModifiedDate) { + var ret time.Time + return ret } - return &o.LastModifiedDate.Time - + return o.LastModifiedDate.Time } -// GetLastModifiedDateOk returns a tuple with the LastModifiedDate field value +// GetLastModifiedDateOk returns a tuple with the LastModifiedDate 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 *DatacenterElementMetadata) GetLastModifiedDateOk() (*time.Time, bool) { - if o == nil { - return nil, false - } - - if o.LastModifiedDate == nil { + if o == nil || IsNil(o.LastModifiedDate) { return nil, false } return &o.LastModifiedDate.Time, true - -} - -// SetLastModifiedDate sets field value -func (o *DatacenterElementMetadata) SetLastModifiedDate(v time.Time) { - - o.LastModifiedDate = &IonosTime{v} - } // HasLastModifiedDate returns a boolean if a field has been set. func (o *DatacenterElementMetadata) HasLastModifiedDate() bool { - if o != nil && o.LastModifiedDate != nil { + if o != nil && !IsNil(o.LastModifiedDate) { return true } return false } -// GetLastModifiedBy returns the LastModifiedBy field value -// If the value is explicit nil, nil is returned -func (o *DatacenterElementMetadata) GetLastModifiedBy() *string { - if o == nil { - return nil - } - - return o.LastModifiedBy +// SetLastModifiedDate gets a reference to the given time.Time and assigns it to the LastModifiedDate field. +func (o *DatacenterElementMetadata) SetLastModifiedDate(v time.Time) { + o.LastModifiedDate = &IonosTime{v} +} +// GetLastModifiedBy returns the LastModifiedBy field value if set, zero value otherwise. +func (o *DatacenterElementMetadata) GetLastModifiedBy() string { + if o == nil || IsNil(o.LastModifiedBy) { + var ret string + return ret + } + return *o.LastModifiedBy } -// GetLastModifiedByOk returns a tuple with the LastModifiedBy field value +// GetLastModifiedByOk returns a tuple with the LastModifiedBy 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 *DatacenterElementMetadata) GetLastModifiedByOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.LastModifiedBy) { return nil, false } - return o.LastModifiedBy, true } -// SetLastModifiedBy sets field value -func (o *DatacenterElementMetadata) SetLastModifiedBy(v string) { - - o.LastModifiedBy = &v - -} - // HasLastModifiedBy returns a boolean if a field has been set. func (o *DatacenterElementMetadata) HasLastModifiedBy() bool { - if o != nil && o.LastModifiedBy != nil { + if o != nil && !IsNil(o.LastModifiedBy) { return true } return false } -// GetLastModifiedByUserId returns the LastModifiedByUserId field value -// If the value is explicit nil, nil is returned -func (o *DatacenterElementMetadata) GetLastModifiedByUserId() *string { - if o == nil { - return nil - } - - return o.LastModifiedByUserId +// SetLastModifiedBy gets a reference to the given string and assigns it to the LastModifiedBy field. +func (o *DatacenterElementMetadata) SetLastModifiedBy(v string) { + o.LastModifiedBy = &v +} +// GetLastModifiedByUserId returns the LastModifiedByUserId field value if set, zero value otherwise. +func (o *DatacenterElementMetadata) GetLastModifiedByUserId() string { + if o == nil || IsNil(o.LastModifiedByUserId) { + var ret string + return ret + } + return *o.LastModifiedByUserId } -// GetLastModifiedByUserIdOk returns a tuple with the LastModifiedByUserId field value +// GetLastModifiedByUserIdOk returns a tuple with the LastModifiedByUserId 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 *DatacenterElementMetadata) GetLastModifiedByUserIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.LastModifiedByUserId) { return nil, false } - return o.LastModifiedByUserId, true } -// SetLastModifiedByUserId sets field value -func (o *DatacenterElementMetadata) SetLastModifiedByUserId(v string) { - - o.LastModifiedByUserId = &v - -} - // HasLastModifiedByUserId returns a boolean if a field has been set. func (o *DatacenterElementMetadata) HasLastModifiedByUserId() bool { - if o != nil && o.LastModifiedByUserId != nil { + if o != nil && !IsNil(o.LastModifiedByUserId) { return true } return false } -// GetState returns the State field value -// If the value is explicit nil, nil is returned -func (o *DatacenterElementMetadata) GetState() *string { - if o == nil { - return nil - } - - return o.State +// SetLastModifiedByUserId gets a reference to the given string and assigns it to the LastModifiedByUserId field. +func (o *DatacenterElementMetadata) SetLastModifiedByUserId(v string) { + o.LastModifiedByUserId = &v +} +// GetState returns the State field value if set, zero value otherwise. +func (o *DatacenterElementMetadata) 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 +// GetStateOk returns a tuple with the State 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 *DatacenterElementMetadata) GetStateOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.State) { return nil, false } - return o.State, true } -// SetState sets field value -func (o *DatacenterElementMetadata) SetState(v string) { - - o.State = &v - -} - // HasState returns a boolean if a field has been set. func (o *DatacenterElementMetadata) HasState() bool { - if o != nil && o.State != nil { + 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 *DatacenterElementMetadata) SetState(v string) { + o.State = &v +} + func (o DatacenterElementMetadata) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o DatacenterElementMetadata) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Etag != nil { + if !IsNil(o.Etag) { toSerialize["etag"] = o.Etag } - - if o.CreatedDate != nil { + if !IsNil(o.CreatedDate) { toSerialize["createdDate"] = o.CreatedDate } - - if o.CreatedBy != nil { + if !IsNil(o.CreatedBy) { toSerialize["createdBy"] = o.CreatedBy } - - if o.CreatedByUserId != nil { + if !IsNil(o.CreatedByUserId) { toSerialize["createdByUserId"] = o.CreatedByUserId } - - if o.LastModifiedDate != nil { + if !IsNil(o.LastModifiedDate) { toSerialize["lastModifiedDate"] = o.LastModifiedDate } - - if o.LastModifiedBy != nil { + if !IsNil(o.LastModifiedBy) { toSerialize["lastModifiedBy"] = o.LastModifiedBy } - - if o.LastModifiedByUserId != nil { + if !IsNil(o.LastModifiedByUserId) { toSerialize["lastModifiedByUserId"] = o.LastModifiedByUserId } - - if o.State != nil { + if !IsNil(o.State) { toSerialize["state"] = o.State } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableDatacenterElementMetadata struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_datacenter_entities.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_datacenter_entities.go new file mode 100644 index 000000000..4d4b32efb --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_datacenter_entities.go @@ -0,0 +1,341 @@ +/* + * CLOUD API + * + * IONOS Enterprise-grade Infrastructure as a Service (IaaS) solutions can be managed through the Cloud API, in addition or as an alternative to the \"Data Center Designer\" (DCD) browser-based tool. Both methods employ consistent concepts and features, deliver similar power and flexibility, and can be used to perform a multitude of management tasks, including adding servers, volumes, configuring networks, and so on. + * + * API version: 6.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + "encoding/json" +) + +// checks if the DatacenterEntities type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DatacenterEntities{} + +// DatacenterEntities struct for DatacenterEntities +type DatacenterEntities struct { + Servers *Servers `json:"servers,omitempty"` + Volumes *Volumes `json:"volumes,omitempty"` + Loadbalancers *Loadbalancers `json:"loadbalancers,omitempty"` + Lans *Lans `json:"lans,omitempty"` + Networkloadbalancers *NetworkLoadBalancers `json:"networkloadbalancers,omitempty"` + Natgateways *NatGateways `json:"natgateways,omitempty"` + Securitygroups *SecurityGroups `json:"securitygroups,omitempty"` +} + +// NewDatacenterEntities instantiates a new DatacenterEntities 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 NewDatacenterEntities() *DatacenterEntities { + this := DatacenterEntities{} + + return &this +} + +// NewDatacenterEntitiesWithDefaults instantiates a new DatacenterEntities 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 NewDatacenterEntitiesWithDefaults() *DatacenterEntities { + this := DatacenterEntities{} + return &this +} + +// GetServers returns the Servers field value if set, zero value otherwise. +func (o *DatacenterEntities) GetServers() Servers { + if o == nil || IsNil(o.Servers) { + var ret Servers + 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 *DatacenterEntities) GetServersOk() (*Servers, 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 *DatacenterEntities) HasServers() bool { + if o != nil && !IsNil(o.Servers) { + return true + } + + return false +} + +// SetServers gets a reference to the given Servers and assigns it to the Servers field. +func (o *DatacenterEntities) SetServers(v Servers) { + o.Servers = &v +} + +// GetVolumes returns the Volumes field value if set, zero value otherwise. +func (o *DatacenterEntities) GetVolumes() Volumes { + if o == nil || IsNil(o.Volumes) { + var ret Volumes + 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 *DatacenterEntities) GetVolumesOk() (*Volumes, 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 *DatacenterEntities) HasVolumes() bool { + if o != nil && !IsNil(o.Volumes) { + return true + } + + return false +} + +// SetVolumes gets a reference to the given Volumes and assigns it to the Volumes field. +func (o *DatacenterEntities) SetVolumes(v Volumes) { + o.Volumes = &v +} + +// GetLoadbalancers returns the Loadbalancers field value if set, zero value otherwise. +func (o *DatacenterEntities) GetLoadbalancers() Loadbalancers { + if o == nil || IsNil(o.Loadbalancers) { + var ret Loadbalancers + return ret + } + return *o.Loadbalancers +} + +// GetLoadbalancersOk returns a tuple with the Loadbalancers field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DatacenterEntities) GetLoadbalancersOk() (*Loadbalancers, bool) { + if o == nil || IsNil(o.Loadbalancers) { + return nil, false + } + return o.Loadbalancers, true +} + +// HasLoadbalancers returns a boolean if a field has been set. +func (o *DatacenterEntities) HasLoadbalancers() bool { + if o != nil && !IsNil(o.Loadbalancers) { + return true + } + + return false +} + +// SetLoadbalancers gets a reference to the given Loadbalancers and assigns it to the Loadbalancers field. +func (o *DatacenterEntities) SetLoadbalancers(v Loadbalancers) { + o.Loadbalancers = &v +} + +// GetLans returns the Lans field value if set, zero value otherwise. +func (o *DatacenterEntities) GetLans() Lans { + if o == nil || IsNil(o.Lans) { + var ret Lans + return ret + } + return *o.Lans +} + +// GetLansOk returns a tuple with the Lans field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DatacenterEntities) GetLansOk() (*Lans, bool) { + if o == nil || IsNil(o.Lans) { + return nil, false + } + return o.Lans, true +} + +// HasLans returns a boolean if a field has been set. +func (o *DatacenterEntities) HasLans() bool { + if o != nil && !IsNil(o.Lans) { + return true + } + + return false +} + +// SetLans gets a reference to the given Lans and assigns it to the Lans field. +func (o *DatacenterEntities) SetLans(v Lans) { + o.Lans = &v +} + +// GetNetworkloadbalancers returns the Networkloadbalancers field value if set, zero value otherwise. +func (o *DatacenterEntities) GetNetworkloadbalancers() NetworkLoadBalancers { + if o == nil || IsNil(o.Networkloadbalancers) { + var ret NetworkLoadBalancers + return ret + } + return *o.Networkloadbalancers +} + +// GetNetworkloadbalancersOk returns a tuple with the Networkloadbalancers field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DatacenterEntities) GetNetworkloadbalancersOk() (*NetworkLoadBalancers, bool) { + if o == nil || IsNil(o.Networkloadbalancers) { + return nil, false + } + return o.Networkloadbalancers, true +} + +// HasNetworkloadbalancers returns a boolean if a field has been set. +func (o *DatacenterEntities) HasNetworkloadbalancers() bool { + if o != nil && !IsNil(o.Networkloadbalancers) { + return true + } + + return false +} + +// SetNetworkloadbalancers gets a reference to the given NetworkLoadBalancers and assigns it to the Networkloadbalancers field. +func (o *DatacenterEntities) SetNetworkloadbalancers(v NetworkLoadBalancers) { + o.Networkloadbalancers = &v +} + +// GetNatgateways returns the Natgateways field value if set, zero value otherwise. +func (o *DatacenterEntities) GetNatgateways() NatGateways { + if o == nil || IsNil(o.Natgateways) { + var ret NatGateways + return ret + } + return *o.Natgateways +} + +// GetNatgatewaysOk returns a tuple with the Natgateways field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DatacenterEntities) GetNatgatewaysOk() (*NatGateways, bool) { + if o == nil || IsNil(o.Natgateways) { + return nil, false + } + return o.Natgateways, true +} + +// HasNatgateways returns a boolean if a field has been set. +func (o *DatacenterEntities) HasNatgateways() bool { + if o != nil && !IsNil(o.Natgateways) { + return true + } + + return false +} + +// SetNatgateways gets a reference to the given NatGateways and assigns it to the Natgateways field. +func (o *DatacenterEntities) SetNatgateways(v NatGateways) { + o.Natgateways = &v +} + +// GetSecuritygroups returns the Securitygroups field value if set, zero value otherwise. +func (o *DatacenterEntities) GetSecuritygroups() SecurityGroups { + if o == nil || IsNil(o.Securitygroups) { + var ret SecurityGroups + return ret + } + return *o.Securitygroups +} + +// GetSecuritygroupsOk returns a tuple with the Securitygroups field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DatacenterEntities) GetSecuritygroupsOk() (*SecurityGroups, bool) { + if o == nil || IsNil(o.Securitygroups) { + return nil, false + } + return o.Securitygroups, true +} + +// HasSecuritygroups returns a boolean if a field has been set. +func (o *DatacenterEntities) HasSecuritygroups() bool { + if o != nil && !IsNil(o.Securitygroups) { + return true + } + + return false +} + +// SetSecuritygroups gets a reference to the given SecurityGroups and assigns it to the Securitygroups field. +func (o *DatacenterEntities) SetSecuritygroups(v SecurityGroups) { + o.Securitygroups = &v +} + +func (o DatacenterEntities) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o DatacenterEntities) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Servers) { + toSerialize["servers"] = o.Servers + } + if !IsNil(o.Volumes) { + toSerialize["volumes"] = o.Volumes + } + if !IsNil(o.Loadbalancers) { + toSerialize["loadbalancers"] = o.Loadbalancers + } + if !IsNil(o.Lans) { + toSerialize["lans"] = o.Lans + } + if !IsNil(o.Networkloadbalancers) { + toSerialize["networkloadbalancers"] = o.Networkloadbalancers + } + if !IsNil(o.Natgateways) { + toSerialize["natgateways"] = o.Natgateways + } + if !IsNil(o.Securitygroups) { + toSerialize["securitygroups"] = o.Securitygroups + } + return toSerialize, nil +} + +type NullableDatacenterEntities struct { + value *DatacenterEntities + isSet bool +} + +func (v NullableDatacenterEntities) Get() *DatacenterEntities { + return v.value +} + +func (v *NullableDatacenterEntities) Set(val *DatacenterEntities) { + v.value = val + v.isSet = true +} + +func (v NullableDatacenterEntities) IsSet() bool { + return v.isSet +} + +func (v *NullableDatacenterEntities) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDatacenterEntities(val *DatacenterEntities) *NullableDatacenterEntities { + return &NullableDatacenterEntities{value: val, isSet: true} +} + +func (v NullableDatacenterEntities) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDatacenterEntities) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_datacenter_post.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_datacenter_post.go similarity index 70% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_datacenter_post.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_datacenter_post.go index 3134f01c0..2118eee12 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_datacenter_post.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_datacenter_post.go @@ -14,10 +14,13 @@ import ( "encoding/json" ) +// checks if the DatacenterPost type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DatacenterPost{} + // DatacenterPost struct for DatacenterPost type DatacenterPost struct { - Properties *DatacenterPropertiesPost `json:"properties"` - Entities *DataCenterEntities `json:"entities,omitempty"` + Properties DatacenterPropertiesPost `json:"properties"` + Entities *DatacenterEntities `json:"entities,omitempty"` } // NewDatacenterPost instantiates a new DatacenterPost object @@ -27,7 +30,7 @@ type DatacenterPost struct { func NewDatacenterPost(properties DatacenterPropertiesPost) *DatacenterPost { this := DatacenterPost{} - this.Properties = &properties + this.Properties = properties return &this } @@ -41,92 +44,76 @@ func NewDatacenterPostWithDefaults() *DatacenterPost { } // GetProperties returns the Properties field value -// If the value is explicit nil, nil is returned -func (o *DatacenterPost) GetProperties() *DatacenterPropertiesPost { +func (o *DatacenterPost) GetProperties() DatacenterPropertiesPost { if o == nil { - return nil + var ret DatacenterPropertiesPost + return ret } return o.Properties - } // GetPropertiesOk returns a tuple with the Properties field value // 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 *DatacenterPost) GetPropertiesOk() (*DatacenterPropertiesPost, bool) { if o == nil { return nil, false } - - return o.Properties, true + return &o.Properties, true } // SetProperties sets field value func (o *DatacenterPost) SetProperties(v DatacenterPropertiesPost) { - - o.Properties = &v - + o.Properties = v } -// HasProperties returns a boolean if a field has been set. -func (o *DatacenterPost) HasProperties() bool { - if o != nil && o.Properties != nil { - return true +// GetEntities returns the Entities field value if set, zero value otherwise. +func (o *DatacenterPost) GetEntities() DatacenterEntities { + if o == nil || IsNil(o.Entities) { + var ret DatacenterEntities + return ret } - - return false + return *o.Entities } -// GetEntities returns the Entities field value -// If the value is explicit nil, nil is returned -func (o *DatacenterPost) GetEntities() *DataCenterEntities { - if o == nil { - return nil - } - - return o.Entities - -} - -// GetEntitiesOk returns a tuple with the Entities field value +// GetEntitiesOk returns a tuple with the Entities 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 *DatacenterPost) GetEntitiesOk() (*DataCenterEntities, bool) { - if o == nil { +func (o *DatacenterPost) GetEntitiesOk() (*DatacenterEntities, bool) { + if o == nil || IsNil(o.Entities) { return nil, false } - return o.Entities, true } -// SetEntities sets field value -func (o *DatacenterPost) SetEntities(v DataCenterEntities) { - - o.Entities = &v - -} - // HasEntities returns a boolean if a field has been set. func (o *DatacenterPost) HasEntities() bool { - if o != nil && o.Entities != nil { + if o != nil && !IsNil(o.Entities) { return true } return false } +// SetEntities gets a reference to the given DatacenterEntities and assigns it to the Entities field. +func (o *DatacenterPost) SetEntities(v DatacenterEntities) { + o.Entities = &v +} + func (o DatacenterPost) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.Properties != nil { - toSerialize["properties"] = o.Properties + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } + return json.Marshal(toSerialize) +} - if o.Entities != nil { +func (o DatacenterPost) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["properties"] = o.Properties + if !IsNil(o.Entities) { toSerialize["entities"] = o.Entities } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableDatacenterPost struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_datacenter_properties.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_datacenter_properties.go similarity index 60% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_datacenter_properties.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_datacenter_properties.go index 4cb8ab17d..7286fce73 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_datacenter_properties.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_datacenter_properties.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the DatacenterProperties type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DatacenterProperties{} + // DatacenterProperties struct for DatacenterProperties type DatacenterProperties struct { // The name of the resource. @@ -21,18 +24,17 @@ type DatacenterProperties struct { // A description for the datacenter, such as staging, production. Description *string `json:"description,omitempty"` // The physical location where the datacenter will be created. This will be where all of your servers live. Property cannot be modified after datacenter creation (disallowed in update requests). - Location *string `json:"location"` + Location string `json:"location"` // The version of the data center; incremented with every change. Version *int32 `json:"version,omitempty"` // List of features supported by the location where this data center is provisioned. - Features *[]string `json:"features,omitempty"` + Features []string `json:"features,omitempty"` // Boolean value representing if the data center requires extra protection, such as two-step verification. SecAuthProtection *bool `json:"secAuthProtection,omitempty"` // Array of features and CPU families available in a location - CpuArchitecture *[]CpuArchitectureProperties `json:"cpuArchitecture,omitempty"` + CpuArchitecture []CpuArchitectureProperties `json:"cpuArchitecture,omitempty"` // This value is either 'null' or contains an automatically-assigned /56 IPv6 CIDR block if IPv6 is enabled on this virtual data center. It can neither be changed nor removed. - // to set this field to `nil` in order to be marshalled, the explicit nil address `Nilstring` can be used, or the setter `SetIpv6CidrBlockNil` - Ipv6CidrBlock *string `json:"ipv6CidrBlock,omitempty"` + Ipv6CidrBlock NullableString `json:"ipv6CidrBlock,omitempty"` // Optional property to define the default security group of the datacenter. DefaultSecurityGroupId *string `json:"defaultSecurityGroupId,omitempty"` } @@ -44,7 +46,7 @@ type DatacenterProperties struct { func NewDatacenterProperties(location string) *DatacenterProperties { this := DatacenterProperties{} - this.Location = &location + this.Location = location return &this } @@ -57,393 +59,333 @@ func NewDatacenterPropertiesWithDefaults() *DatacenterProperties { return &this } -// GetName returns the Name field value -// If the value is explicit nil, nil is returned -func (o *DatacenterProperties) GetName() *string { - if o == nil { - return nil +// GetName returns the Name field value if set, zero value otherwise. +func (o *DatacenterProperties) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret } - - return o.Name - + return *o.Name } -// GetNameOk returns a tuple with the Name field value +// GetNameOk returns a tuple with the Name 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 *DatacenterProperties) GetNameOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Name) { return nil, false } - return o.Name, true } -// SetName sets field value -func (o *DatacenterProperties) SetName(v string) { - - o.Name = &v - -} - // HasName returns a boolean if a field has been set. func (o *DatacenterProperties) HasName() bool { - if o != nil && o.Name != nil { + if o != nil && !IsNil(o.Name) { return true } return false } -// GetDescription returns the Description field value -// If the value is explicit nil, nil is returned -func (o *DatacenterProperties) GetDescription() *string { - if o == nil { - return nil - } - - return o.Description +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *DatacenterProperties) SetName(v string) { + o.Name = &v +} +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *DatacenterProperties) 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 +// GetDescriptionOk returns a tuple with the Description 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 *DatacenterProperties) GetDescriptionOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Description) { return nil, false } - return o.Description, true } -// SetDescription sets field value -func (o *DatacenterProperties) SetDescription(v string) { - - o.Description = &v - -} - // HasDescription returns a boolean if a field has been set. func (o *DatacenterProperties) HasDescription() bool { - if o != nil && o.Description != nil { + 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 *DatacenterProperties) SetDescription(v string) { + o.Description = &v +} + // GetLocation returns the Location field value -// If the value is explicit nil, nil is returned -func (o *DatacenterProperties) GetLocation() *string { +func (o *DatacenterProperties) GetLocation() string { if o == nil { - return nil + var ret string + return ret } return o.Location - } // GetLocationOk returns a tuple with the Location field value // 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 *DatacenterProperties) GetLocationOk() (*string, bool) { if o == nil { return nil, false } - - return o.Location, true + return &o.Location, true } // SetLocation sets field value func (o *DatacenterProperties) SetLocation(v string) { - - o.Location = &v - + o.Location = v } -// HasLocation returns a boolean if a field has been set. -func (o *DatacenterProperties) HasLocation() bool { - if o != nil && o.Location != nil { - return true - } - - return false -} - -// GetVersion returns the Version field value -// If the value is explicit nil, nil is returned -func (o *DatacenterProperties) GetVersion() *int32 { - if o == nil { - return nil +// GetVersion returns the Version field value if set, zero value otherwise. +func (o *DatacenterProperties) GetVersion() int32 { + if o == nil || IsNil(o.Version) { + var ret int32 + return ret } - - return o.Version - + return *o.Version } -// GetVersionOk returns a tuple with the Version field value +// GetVersionOk returns a tuple with the Version 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 *DatacenterProperties) GetVersionOk() (*int32, bool) { - if o == nil { + if o == nil || IsNil(o.Version) { return nil, false } - return o.Version, true } -// SetVersion sets field value -func (o *DatacenterProperties) SetVersion(v int32) { - - o.Version = &v - -} - // HasVersion returns a boolean if a field has been set. func (o *DatacenterProperties) HasVersion() bool { - if o != nil && o.Version != nil { + if o != nil && !IsNil(o.Version) { return true } return false } -// GetFeatures returns the Features field value -// If the value is explicit nil, nil is returned -func (o *DatacenterProperties) GetFeatures() *[]string { - if o == nil { - return nil - } +// SetVersion gets a reference to the given int32 and assigns it to the Version field. +func (o *DatacenterProperties) SetVersion(v int32) { + o.Version = &v +} +// GetFeatures returns the Features field value if set, zero value otherwise. +func (o *DatacenterProperties) 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 +// GetFeaturesOk returns a tuple with the Features 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 *DatacenterProperties) GetFeaturesOk() (*[]string, bool) { - if o == nil { +func (o *DatacenterProperties) GetFeaturesOk() ([]string, bool) { + if o == nil || IsNil(o.Features) { return nil, false } - return o.Features, true } -// SetFeatures sets field value -func (o *DatacenterProperties) SetFeatures(v []string) { - - o.Features = &v - -} - // HasFeatures returns a boolean if a field has been set. func (o *DatacenterProperties) HasFeatures() bool { - if o != nil && o.Features != nil { + if o != nil && !IsNil(o.Features) { return true } return false } -// GetSecAuthProtection returns the SecAuthProtection field value -// If the value is explicit nil, nil is returned -func (o *DatacenterProperties) GetSecAuthProtection() *bool { - if o == nil { - return nil - } - - return o.SecAuthProtection +// SetFeatures gets a reference to the given []string and assigns it to the Features field. +func (o *DatacenterProperties) SetFeatures(v []string) { + o.Features = v +} +// GetSecAuthProtection returns the SecAuthProtection field value if set, zero value otherwise. +func (o *DatacenterProperties) GetSecAuthProtection() bool { + if o == nil || IsNil(o.SecAuthProtection) { + var ret bool + return ret + } + return *o.SecAuthProtection } -// GetSecAuthProtectionOk returns a tuple with the SecAuthProtection field value +// GetSecAuthProtectionOk returns a tuple with the SecAuthProtection 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 *DatacenterProperties) GetSecAuthProtectionOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.SecAuthProtection) { return nil, false } - return o.SecAuthProtection, true } -// SetSecAuthProtection sets field value -func (o *DatacenterProperties) SetSecAuthProtection(v bool) { - - o.SecAuthProtection = &v - -} - // HasSecAuthProtection returns a boolean if a field has been set. func (o *DatacenterProperties) HasSecAuthProtection() bool { - if o != nil && o.SecAuthProtection != nil { + if o != nil && !IsNil(o.SecAuthProtection) { return true } return false } -// GetCpuArchitecture returns the CpuArchitecture field value -// If the value is explicit nil, nil is returned -func (o *DatacenterProperties) GetCpuArchitecture() *[]CpuArchitectureProperties { - if o == nil { - return nil - } +// SetSecAuthProtection gets a reference to the given bool and assigns it to the SecAuthProtection field. +func (o *DatacenterProperties) SetSecAuthProtection(v bool) { + o.SecAuthProtection = &v +} +// GetCpuArchitecture returns the CpuArchitecture field value if set, zero value otherwise. +func (o *DatacenterProperties) GetCpuArchitecture() []CpuArchitectureProperties { + if o == nil || IsNil(o.CpuArchitecture) { + var ret []CpuArchitectureProperties + return ret + } return o.CpuArchitecture - } -// GetCpuArchitectureOk returns a tuple with the CpuArchitecture field value +// GetCpuArchitectureOk returns a tuple with the CpuArchitecture 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 *DatacenterProperties) GetCpuArchitectureOk() (*[]CpuArchitectureProperties, bool) { - if o == nil { +func (o *DatacenterProperties) GetCpuArchitectureOk() ([]CpuArchitectureProperties, bool) { + if o == nil || IsNil(o.CpuArchitecture) { return nil, false } - return o.CpuArchitecture, true } -// SetCpuArchitecture sets field value -func (o *DatacenterProperties) SetCpuArchitecture(v []CpuArchitectureProperties) { - - o.CpuArchitecture = &v - -} - // HasCpuArchitecture returns a boolean if a field has been set. func (o *DatacenterProperties) HasCpuArchitecture() bool { - if o != nil && o.CpuArchitecture != nil { + if o != nil && !IsNil(o.CpuArchitecture) { return true } return false } -// GetIpv6CidrBlock returns the Ipv6CidrBlock field value -// If the value is explicit nil, nil is returned -func (o *DatacenterProperties) GetIpv6CidrBlock() *string { - if o == nil { - return nil - } - - return o.Ipv6CidrBlock +// SetCpuArchitecture gets a reference to the given []CpuArchitectureProperties and assigns it to the CpuArchitecture field. +func (o *DatacenterProperties) SetCpuArchitecture(v []CpuArchitectureProperties) { + o.CpuArchitecture = v +} +// GetIpv6CidrBlock returns the Ipv6CidrBlock field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *DatacenterProperties) GetIpv6CidrBlock() string { + if o == nil || IsNil(o.Ipv6CidrBlock.Get()) { + var ret string + return ret + } + return *o.Ipv6CidrBlock.Get() } -// GetIpv6CidrBlockOk returns a tuple with the Ipv6CidrBlock field value +// GetIpv6CidrBlockOk returns a tuple with the Ipv6CidrBlock 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 *DatacenterProperties) GetIpv6CidrBlockOk() (*string, bool) { if o == nil { return nil, false } - - return o.Ipv6CidrBlock, true -} - -// SetIpv6CidrBlock sets field value -func (o *DatacenterProperties) SetIpv6CidrBlock(v string) { - - o.Ipv6CidrBlock = &v - -} - -// sets Ipv6CidrBlock to the explicit address that will be encoded as nil when marshaled -func (o *DatacenterProperties) SetIpv6CidrBlockNil() { - o.Ipv6CidrBlock = &Nilstring + return o.Ipv6CidrBlock.Get(), o.Ipv6CidrBlock.IsSet() } // HasIpv6CidrBlock returns a boolean if a field has been set. func (o *DatacenterProperties) HasIpv6CidrBlock() bool { - if o != nil && o.Ipv6CidrBlock != nil { + if o != nil && o.Ipv6CidrBlock.IsSet() { return true } return false } -// GetDefaultSecurityGroupId returns the DefaultSecurityGroupId field value -// If the value is explicit nil, nil is returned -func (o *DatacenterProperties) GetDefaultSecurityGroupId() *string { - if o == nil { - return nil - } +// SetIpv6CidrBlock gets a reference to the given NullableString and assigns it to the Ipv6CidrBlock field. +func (o *DatacenterProperties) SetIpv6CidrBlock(v string) { + o.Ipv6CidrBlock.Set(&v) +} - return o.DefaultSecurityGroupId +// SetIpv6CidrBlockNil sets the value for Ipv6CidrBlock to be an explicit nil +func (o *DatacenterProperties) SetIpv6CidrBlockNil() { + o.Ipv6CidrBlock.Set(nil) +} +// UnsetIpv6CidrBlock ensures that no value is present for Ipv6CidrBlock, not even an explicit nil +func (o *DatacenterProperties) UnsetIpv6CidrBlock() { + o.Ipv6CidrBlock.Unset() } -// GetDefaultSecurityGroupIdOk returns a tuple with the DefaultSecurityGroupId field value +// GetDefaultSecurityGroupId returns the DefaultSecurityGroupId field value if set, zero value otherwise. +func (o *DatacenterProperties) GetDefaultSecurityGroupId() string { + if o == nil || IsNil(o.DefaultSecurityGroupId) { + var ret string + return ret + } + return *o.DefaultSecurityGroupId +} + +// GetDefaultSecurityGroupIdOk returns a tuple with the DefaultSecurityGroupId 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 *DatacenterProperties) GetDefaultSecurityGroupIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.DefaultSecurityGroupId) { return nil, false } - return o.DefaultSecurityGroupId, true } -// SetDefaultSecurityGroupId sets field value -func (o *DatacenterProperties) SetDefaultSecurityGroupId(v string) { - - o.DefaultSecurityGroupId = &v - -} - // HasDefaultSecurityGroupId returns a boolean if a field has been set. func (o *DatacenterProperties) HasDefaultSecurityGroupId() bool { - if o != nil && o.DefaultSecurityGroupId != nil { + if o != nil && !IsNil(o.DefaultSecurityGroupId) { return true } return false } +// SetDefaultSecurityGroupId gets a reference to the given string and assigns it to the DefaultSecurityGroupId field. +func (o *DatacenterProperties) SetDefaultSecurityGroupId(v string) { + o.DefaultSecurityGroupId = &v +} + func (o DatacenterProperties) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o DatacenterProperties) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Name != nil { + if !IsNil(o.Name) { toSerialize["name"] = o.Name } - - if o.Description != nil { + if !IsNil(o.Description) { toSerialize["description"] = o.Description } - - if o.Location != nil { - toSerialize["location"] = o.Location - } - - if o.Version != nil { + toSerialize["location"] = o.Location + if !IsNil(o.Version) { toSerialize["version"] = o.Version } - - if o.Features != nil { + if !IsNil(o.Features) { toSerialize["features"] = o.Features } - - if o.SecAuthProtection != nil { + if !IsNil(o.SecAuthProtection) { toSerialize["secAuthProtection"] = o.SecAuthProtection } - - if o.CpuArchitecture != nil { + if !IsNil(o.CpuArchitecture) { toSerialize["cpuArchitecture"] = o.CpuArchitecture } - - if o.Ipv6CidrBlock == &Nilstring { - toSerialize["ipv6CidrBlock"] = nil - } else if o.Ipv6CidrBlock != nil { - toSerialize["ipv6CidrBlock"] = o.Ipv6CidrBlock + if o.Ipv6CidrBlock.IsSet() { + toSerialize["ipv6CidrBlock"] = o.Ipv6CidrBlock.Get() } - if o.DefaultSecurityGroupId != nil { + if !IsNil(o.DefaultSecurityGroupId) { toSerialize["defaultSecurityGroupId"] = o.DefaultSecurityGroupId } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableDatacenterProperties struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_datacenter_properties_post.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_datacenter_properties_post.go similarity index 56% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_datacenter_properties_post.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_datacenter_properties_post.go index b08a19a11..ab79fdebe 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_datacenter_properties_post.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_datacenter_properties_post.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the DatacenterPropertiesPost type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DatacenterPropertiesPost{} + // DatacenterPropertiesPost struct for DatacenterPropertiesPost type DatacenterPropertiesPost struct { // The name of the resource. @@ -21,15 +24,17 @@ type DatacenterPropertiesPost struct { // A description for the datacenter, such as staging, production. Description *string `json:"description,omitempty"` // The physical location where the datacenter will be created. This will be where all of your servers live. Property cannot be modified after datacenter creation (disallowed in update requests). - Location *string `json:"location"` + Location string `json:"location"` // The version of the data center; incremented with every change. Version *int32 `json:"version,omitempty"` // List of features supported by the location where this data center is provisioned. - Features *[]string `json:"features,omitempty"` + Features []string `json:"features,omitempty"` // Boolean value representing if the data center requires extra protection, such as two-step verification. SecAuthProtection *bool `json:"secAuthProtection,omitempty"` // Array of features and CPU families available in a location - CpuArchitecture *[]CpuArchitectureProperties `json:"cpuArchitecture,omitempty"` + CpuArchitecture []CpuArchitectureProperties `json:"cpuArchitecture,omitempty"` + // This value is either 'null' or contains an automatically-assigned /56 IPv6 CIDR block if IPv6 is enabled on this virtual data center. It can neither be changed nor removed. + Ipv6CidrBlock NullableString `json:"ipv6CidrBlock,omitempty"` // If true, a default security group, with predefined rules, will be created for the datacenter. Default value is false. CreateDefaultSecurityGroup *bool `json:"createDefaultSecurityGroup,omitempty"` } @@ -41,7 +46,7 @@ type DatacenterPropertiesPost struct { func NewDatacenterPropertiesPost(location string) *DatacenterPropertiesPost { this := DatacenterPropertiesPost{} - this.Location = &location + this.Location = location return &this } @@ -54,345 +59,333 @@ func NewDatacenterPropertiesPostWithDefaults() *DatacenterPropertiesPost { return &this } -// GetName returns the Name field value -// If the value is explicit nil, nil is returned -func (o *DatacenterPropertiesPost) GetName() *string { - if o == nil { - return nil +// GetName returns the Name field value if set, zero value otherwise. +func (o *DatacenterPropertiesPost) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret } - - return o.Name - + return *o.Name } -// GetNameOk returns a tuple with the Name field value +// GetNameOk returns a tuple with the Name 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 *DatacenterPropertiesPost) GetNameOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Name) { return nil, false } - return o.Name, true } -// SetName sets field value -func (o *DatacenterPropertiesPost) SetName(v string) { - - o.Name = &v - -} - // HasName returns a boolean if a field has been set. func (o *DatacenterPropertiesPost) HasName() bool { - if o != nil && o.Name != nil { + if o != nil && !IsNil(o.Name) { return true } return false } -// GetDescription returns the Description field value -// If the value is explicit nil, nil is returned -func (o *DatacenterPropertiesPost) GetDescription() *string { - if o == nil { - return nil - } - - return o.Description +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *DatacenterPropertiesPost) SetName(v string) { + o.Name = &v +} +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *DatacenterPropertiesPost) 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 +// GetDescriptionOk returns a tuple with the Description 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 *DatacenterPropertiesPost) GetDescriptionOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Description) { return nil, false } - return o.Description, true } -// SetDescription sets field value -func (o *DatacenterPropertiesPost) SetDescription(v string) { - - o.Description = &v - -} - // HasDescription returns a boolean if a field has been set. func (o *DatacenterPropertiesPost) HasDescription() bool { - if o != nil && o.Description != nil { + 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 *DatacenterPropertiesPost) SetDescription(v string) { + o.Description = &v +} + // GetLocation returns the Location field value -// If the value is explicit nil, nil is returned -func (o *DatacenterPropertiesPost) GetLocation() *string { +func (o *DatacenterPropertiesPost) GetLocation() string { if o == nil { - return nil + var ret string + return ret } return o.Location - } // GetLocationOk returns a tuple with the Location field value // 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 *DatacenterPropertiesPost) GetLocationOk() (*string, bool) { if o == nil { return nil, false } - - return o.Location, true + return &o.Location, true } // SetLocation sets field value func (o *DatacenterPropertiesPost) SetLocation(v string) { - - o.Location = &v - -} - -// HasLocation returns a boolean if a field has been set. -func (o *DatacenterPropertiesPost) HasLocation() bool { - if o != nil && o.Location != nil { - return true - } - - return false + o.Location = v } -// GetVersion returns the Version field value -// If the value is explicit nil, nil is returned -func (o *DatacenterPropertiesPost) GetVersion() *int32 { - if o == nil { - return nil +// GetVersion returns the Version field value if set, zero value otherwise. +func (o *DatacenterPropertiesPost) GetVersion() int32 { + if o == nil || IsNil(o.Version) { + var ret int32 + return ret } - - return o.Version - + return *o.Version } -// GetVersionOk returns a tuple with the Version field value +// GetVersionOk returns a tuple with the Version 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 *DatacenterPropertiesPost) GetVersionOk() (*int32, bool) { - if o == nil { + if o == nil || IsNil(o.Version) { return nil, false } - return o.Version, true } -// SetVersion sets field value -func (o *DatacenterPropertiesPost) SetVersion(v int32) { - - o.Version = &v - -} - // HasVersion returns a boolean if a field has been set. func (o *DatacenterPropertiesPost) HasVersion() bool { - if o != nil && o.Version != nil { + if o != nil && !IsNil(o.Version) { return true } return false } -// GetFeatures returns the Features field value -// If the value is explicit nil, nil is returned -func (o *DatacenterPropertiesPost) GetFeatures() *[]string { - if o == nil { - return nil - } +// SetVersion gets a reference to the given int32 and assigns it to the Version field. +func (o *DatacenterPropertiesPost) SetVersion(v int32) { + o.Version = &v +} +// GetFeatures returns the Features field value if set, zero value otherwise. +func (o *DatacenterPropertiesPost) 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 +// GetFeaturesOk returns a tuple with the Features 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 *DatacenterPropertiesPost) GetFeaturesOk() (*[]string, bool) { - if o == nil { +func (o *DatacenterPropertiesPost) GetFeaturesOk() ([]string, bool) { + if o == nil || IsNil(o.Features) { return nil, false } - return o.Features, true } -// SetFeatures sets field value -func (o *DatacenterPropertiesPost) SetFeatures(v []string) { - - o.Features = &v - -} - // HasFeatures returns a boolean if a field has been set. func (o *DatacenterPropertiesPost) HasFeatures() bool { - if o != nil && o.Features != nil { + if o != nil && !IsNil(o.Features) { return true } return false } -// GetSecAuthProtection returns the SecAuthProtection field value -// If the value is explicit nil, nil is returned -func (o *DatacenterPropertiesPost) GetSecAuthProtection() *bool { - if o == nil { - return nil - } - - return o.SecAuthProtection +// SetFeatures gets a reference to the given []string and assigns it to the Features field. +func (o *DatacenterPropertiesPost) SetFeatures(v []string) { + o.Features = v +} +// GetSecAuthProtection returns the SecAuthProtection field value if set, zero value otherwise. +func (o *DatacenterPropertiesPost) GetSecAuthProtection() bool { + if o == nil || IsNil(o.SecAuthProtection) { + var ret bool + return ret + } + return *o.SecAuthProtection } -// GetSecAuthProtectionOk returns a tuple with the SecAuthProtection field value +// GetSecAuthProtectionOk returns a tuple with the SecAuthProtection 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 *DatacenterPropertiesPost) GetSecAuthProtectionOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.SecAuthProtection) { return nil, false } - return o.SecAuthProtection, true } -// SetSecAuthProtection sets field value -func (o *DatacenterPropertiesPost) SetSecAuthProtection(v bool) { - - o.SecAuthProtection = &v - -} - // HasSecAuthProtection returns a boolean if a field has been set. func (o *DatacenterPropertiesPost) HasSecAuthProtection() bool { - if o != nil && o.SecAuthProtection != nil { + if o != nil && !IsNil(o.SecAuthProtection) { return true } return false } -// GetCpuArchitecture returns the CpuArchitecture field value -// If the value is explicit nil, nil is returned -func (o *DatacenterPropertiesPost) GetCpuArchitecture() *[]CpuArchitectureProperties { - if o == nil { - return nil - } +// SetSecAuthProtection gets a reference to the given bool and assigns it to the SecAuthProtection field. +func (o *DatacenterPropertiesPost) SetSecAuthProtection(v bool) { + o.SecAuthProtection = &v +} +// GetCpuArchitecture returns the CpuArchitecture field value if set, zero value otherwise. +func (o *DatacenterPropertiesPost) GetCpuArchitecture() []CpuArchitectureProperties { + if o == nil || IsNil(o.CpuArchitecture) { + var ret []CpuArchitectureProperties + return ret + } return o.CpuArchitecture - } -// GetCpuArchitectureOk returns a tuple with the CpuArchitecture field value +// GetCpuArchitectureOk returns a tuple with the CpuArchitecture 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 *DatacenterPropertiesPost) GetCpuArchitectureOk() (*[]CpuArchitectureProperties, bool) { - if o == nil { +func (o *DatacenterPropertiesPost) GetCpuArchitectureOk() ([]CpuArchitectureProperties, bool) { + if o == nil || IsNil(o.CpuArchitecture) { return nil, false } - return o.CpuArchitecture, true } -// SetCpuArchitecture sets field value -func (o *DatacenterPropertiesPost) SetCpuArchitecture(v []CpuArchitectureProperties) { - - o.CpuArchitecture = &v - -} - // HasCpuArchitecture returns a boolean if a field has been set. func (o *DatacenterPropertiesPost) HasCpuArchitecture() bool { - if o != nil && o.CpuArchitecture != nil { + if o != nil && !IsNil(o.CpuArchitecture) { return true } return false } -// GetCreateDefaultSecurityGroup returns the CreateDefaultSecurityGroup field value -// If the value is explicit nil, nil is returned -func (o *DatacenterPropertiesPost) GetCreateDefaultSecurityGroup() *bool { - if o == nil { - return nil - } - - return o.CreateDefaultSecurityGroup +// SetCpuArchitecture gets a reference to the given []CpuArchitectureProperties and assigns it to the CpuArchitecture field. +func (o *DatacenterPropertiesPost) SetCpuArchitecture(v []CpuArchitectureProperties) { + o.CpuArchitecture = v +} +// GetIpv6CidrBlock returns the Ipv6CidrBlock field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *DatacenterPropertiesPost) GetIpv6CidrBlock() string { + if o == nil || IsNil(o.Ipv6CidrBlock.Get()) { + var ret string + return ret + } + return *o.Ipv6CidrBlock.Get() } -// GetCreateDefaultSecurityGroupOk returns a tuple with the CreateDefaultSecurityGroup field value +// GetIpv6CidrBlockOk returns a tuple with the Ipv6CidrBlock 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 *DatacenterPropertiesPost) GetCreateDefaultSecurityGroupOk() (*bool, bool) { +func (o *DatacenterPropertiesPost) GetIpv6CidrBlockOk() (*string, bool) { if o == nil { return nil, false } + return o.Ipv6CidrBlock.Get(), o.Ipv6CidrBlock.IsSet() +} - return o.CreateDefaultSecurityGroup, true +// HasIpv6CidrBlock returns a boolean if a field has been set. +func (o *DatacenterPropertiesPost) HasIpv6CidrBlock() bool { + if o != nil && o.Ipv6CidrBlock.IsSet() { + return true + } + + return false } -// SetCreateDefaultSecurityGroup sets field value -func (o *DatacenterPropertiesPost) SetCreateDefaultSecurityGroup(v bool) { +// SetIpv6CidrBlock gets a reference to the given NullableString and assigns it to the Ipv6CidrBlock field. +func (o *DatacenterPropertiesPost) SetIpv6CidrBlock(v string) { + o.Ipv6CidrBlock.Set(&v) +} - o.CreateDefaultSecurityGroup = &v +// SetIpv6CidrBlockNil sets the value for Ipv6CidrBlock to be an explicit nil +func (o *DatacenterPropertiesPost) SetIpv6CidrBlockNil() { + o.Ipv6CidrBlock.Set(nil) +} + +// UnsetIpv6CidrBlock ensures that no value is present for Ipv6CidrBlock, not even an explicit nil +func (o *DatacenterPropertiesPost) UnsetIpv6CidrBlock() { + o.Ipv6CidrBlock.Unset() +} +// GetCreateDefaultSecurityGroup returns the CreateDefaultSecurityGroup field value if set, zero value otherwise. +func (o *DatacenterPropertiesPost) GetCreateDefaultSecurityGroup() bool { + if o == nil || IsNil(o.CreateDefaultSecurityGroup) { + var ret bool + return ret + } + return *o.CreateDefaultSecurityGroup +} + +// GetCreateDefaultSecurityGroupOk returns a tuple with the CreateDefaultSecurityGroup field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DatacenterPropertiesPost) GetCreateDefaultSecurityGroupOk() (*bool, bool) { + if o == nil || IsNil(o.CreateDefaultSecurityGroup) { + return nil, false + } + return o.CreateDefaultSecurityGroup, true } // HasCreateDefaultSecurityGroup returns a boolean if a field has been set. func (o *DatacenterPropertiesPost) HasCreateDefaultSecurityGroup() bool { - if o != nil && o.CreateDefaultSecurityGroup != nil { + if o != nil && !IsNil(o.CreateDefaultSecurityGroup) { return true } return false } +// SetCreateDefaultSecurityGroup gets a reference to the given bool and assigns it to the CreateDefaultSecurityGroup field. +func (o *DatacenterPropertiesPost) SetCreateDefaultSecurityGroup(v bool) { + o.CreateDefaultSecurityGroup = &v +} + func (o DatacenterPropertiesPost) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o DatacenterPropertiesPost) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Name != nil { + if !IsNil(o.Name) { toSerialize["name"] = o.Name } - - if o.Description != nil { + if !IsNil(o.Description) { toSerialize["description"] = o.Description } - - if o.Location != nil { - toSerialize["location"] = o.Location - } - - if o.Version != nil { + toSerialize["location"] = o.Location + if !IsNil(o.Version) { toSerialize["version"] = o.Version } - - if o.Features != nil { + if !IsNil(o.Features) { toSerialize["features"] = o.Features } - - if o.SecAuthProtection != nil { + if !IsNil(o.SecAuthProtection) { toSerialize["secAuthProtection"] = o.SecAuthProtection } - - if o.CpuArchitecture != nil { + if !IsNil(o.CpuArchitecture) { toSerialize["cpuArchitecture"] = o.CpuArchitecture } - - if o.CreateDefaultSecurityGroup != nil { + if o.Ipv6CidrBlock.IsSet() { + toSerialize["ipv6CidrBlock"] = o.Ipv6CidrBlock.Get() + } + if !IsNil(o.CreateDefaultSecurityGroup) { toSerialize["createDefaultSecurityGroup"] = o.CreateDefaultSecurityGroup } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableDatacenterPropertiesPost struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_datacenter_properties_put.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_datacenter_properties_put.go similarity index 58% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_datacenter_properties_put.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_datacenter_properties_put.go index df3e5d217..bfa51e008 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_datacenter_properties_put.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_datacenter_properties_put.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the DatacenterPropertiesPut type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DatacenterPropertiesPut{} + // DatacenterPropertiesPut struct for DatacenterPropertiesPut type DatacenterPropertiesPut struct { // The name of the resource. @@ -21,15 +24,17 @@ type DatacenterPropertiesPut struct { // A description for the datacenter, such as staging, production. Description *string `json:"description,omitempty"` // The physical location where the datacenter will be created. This will be where all of your servers live. Property cannot be modified after datacenter creation (disallowed in update requests). - Location *string `json:"location"` + Location string `json:"location"` // The version of the data center; incremented with every change. Version *int32 `json:"version,omitempty"` // List of features supported by the location where this data center is provisioned. - Features *[]string `json:"features,omitempty"` + Features []string `json:"features,omitempty"` // Boolean value representing if the data center requires extra protection, such as two-step verification. SecAuthProtection *bool `json:"secAuthProtection,omitempty"` // Array of features and CPU families available in a location - CpuArchitecture *[]CpuArchitectureProperties `json:"cpuArchitecture,omitempty"` + CpuArchitecture []CpuArchitectureProperties `json:"cpuArchitecture,omitempty"` + // This value is either 'null' or contains an automatically-assigned /56 IPv6 CIDR block if IPv6 is enabled on this virtual data center. It can neither be changed nor removed. + Ipv6CidrBlock NullableString `json:"ipv6CidrBlock,omitempty"` // This will become the default security group for the datacenter, replacing the old one if already exists. This security group must already exists prior to this request. Provide this field only if the `createDefaultSecurityGroup` field is missing. You cannot provide both of them DefaultSecurityGroupId *string `json:"defaultSecurityGroupId,omitempty"` // If this field is set on true and this datacenter has no default security group then a default security group, with predefined rules, will be created for this datacenter. Default value is false. Provide this field only if the `defaultSecurityGroupId` field is missing. You cannot provide both of them @@ -43,7 +48,7 @@ type DatacenterPropertiesPut struct { func NewDatacenterPropertiesPut(location string) *DatacenterPropertiesPut { this := DatacenterPropertiesPut{} - this.Location = &location + this.Location = location return &this } @@ -56,387 +61,368 @@ func NewDatacenterPropertiesPutWithDefaults() *DatacenterPropertiesPut { return &this } -// GetName returns the Name field value -// If the value is explicit nil, nil is returned -func (o *DatacenterPropertiesPut) GetName() *string { - if o == nil { - return nil +// GetName returns the Name field value if set, zero value otherwise. +func (o *DatacenterPropertiesPut) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret } - - return o.Name - + return *o.Name } -// GetNameOk returns a tuple with the Name field value +// GetNameOk returns a tuple with the Name 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 *DatacenterPropertiesPut) GetNameOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Name) { return nil, false } - return o.Name, true } -// SetName sets field value -func (o *DatacenterPropertiesPut) SetName(v string) { - - o.Name = &v - -} - // HasName returns a boolean if a field has been set. func (o *DatacenterPropertiesPut) HasName() bool { - if o != nil && o.Name != nil { + if o != nil && !IsNil(o.Name) { return true } return false } -// GetDescription returns the Description field value -// If the value is explicit nil, nil is returned -func (o *DatacenterPropertiesPut) GetDescription() *string { - if o == nil { - return nil - } - - return o.Description +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *DatacenterPropertiesPut) SetName(v string) { + o.Name = &v +} +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *DatacenterPropertiesPut) 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 +// GetDescriptionOk returns a tuple with the Description 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 *DatacenterPropertiesPut) GetDescriptionOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Description) { return nil, false } - return o.Description, true } -// SetDescription sets field value -func (o *DatacenterPropertiesPut) SetDescription(v string) { - - o.Description = &v - -} - // HasDescription returns a boolean if a field has been set. func (o *DatacenterPropertiesPut) HasDescription() bool { - if o != nil && o.Description != nil { + 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 *DatacenterPropertiesPut) SetDescription(v string) { + o.Description = &v +} + // GetLocation returns the Location field value -// If the value is explicit nil, nil is returned -func (o *DatacenterPropertiesPut) GetLocation() *string { +func (o *DatacenterPropertiesPut) GetLocation() string { if o == nil { - return nil + var ret string + return ret } return o.Location - } // GetLocationOk returns a tuple with the Location field value // 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 *DatacenterPropertiesPut) GetLocationOk() (*string, bool) { if o == nil { return nil, false } - - return o.Location, true + return &o.Location, true } // SetLocation sets field value func (o *DatacenterPropertiesPut) SetLocation(v string) { - - o.Location = &v - -} - -// HasLocation returns a boolean if a field has been set. -func (o *DatacenterPropertiesPut) HasLocation() bool { - if o != nil && o.Location != nil { - return true - } - - return false + o.Location = v } -// GetVersion returns the Version field value -// If the value is explicit nil, nil is returned -func (o *DatacenterPropertiesPut) GetVersion() *int32 { - if o == nil { - return nil +// GetVersion returns the Version field value if set, zero value otherwise. +func (o *DatacenterPropertiesPut) GetVersion() int32 { + if o == nil || IsNil(o.Version) { + var ret int32 + return ret } - - return o.Version - + return *o.Version } -// GetVersionOk returns a tuple with the Version field value +// GetVersionOk returns a tuple with the Version 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 *DatacenterPropertiesPut) GetVersionOk() (*int32, bool) { - if o == nil { + if o == nil || IsNil(o.Version) { return nil, false } - return o.Version, true } -// SetVersion sets field value -func (o *DatacenterPropertiesPut) SetVersion(v int32) { - - o.Version = &v - -} - // HasVersion returns a boolean if a field has been set. func (o *DatacenterPropertiesPut) HasVersion() bool { - if o != nil && o.Version != nil { + if o != nil && !IsNil(o.Version) { return true } return false } -// GetFeatures returns the Features field value -// If the value is explicit nil, nil is returned -func (o *DatacenterPropertiesPut) GetFeatures() *[]string { - if o == nil { - return nil - } +// SetVersion gets a reference to the given int32 and assigns it to the Version field. +func (o *DatacenterPropertiesPut) SetVersion(v int32) { + o.Version = &v +} +// GetFeatures returns the Features field value if set, zero value otherwise. +func (o *DatacenterPropertiesPut) 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 +// GetFeaturesOk returns a tuple with the Features 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 *DatacenterPropertiesPut) GetFeaturesOk() (*[]string, bool) { - if o == nil { +func (o *DatacenterPropertiesPut) GetFeaturesOk() ([]string, bool) { + if o == nil || IsNil(o.Features) { return nil, false } - return o.Features, true } -// SetFeatures sets field value -func (o *DatacenterPropertiesPut) SetFeatures(v []string) { - - o.Features = &v - -} - // HasFeatures returns a boolean if a field has been set. func (o *DatacenterPropertiesPut) HasFeatures() bool { - if o != nil && o.Features != nil { + if o != nil && !IsNil(o.Features) { return true } return false } -// GetSecAuthProtection returns the SecAuthProtection field value -// If the value is explicit nil, nil is returned -func (o *DatacenterPropertiesPut) GetSecAuthProtection() *bool { - if o == nil { - return nil - } - - return o.SecAuthProtection +// SetFeatures gets a reference to the given []string and assigns it to the Features field. +func (o *DatacenterPropertiesPut) SetFeatures(v []string) { + o.Features = v +} +// GetSecAuthProtection returns the SecAuthProtection field value if set, zero value otherwise. +func (o *DatacenterPropertiesPut) GetSecAuthProtection() bool { + if o == nil || IsNil(o.SecAuthProtection) { + var ret bool + return ret + } + return *o.SecAuthProtection } -// GetSecAuthProtectionOk returns a tuple with the SecAuthProtection field value +// GetSecAuthProtectionOk returns a tuple with the SecAuthProtection 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 *DatacenterPropertiesPut) GetSecAuthProtectionOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.SecAuthProtection) { return nil, false } - return o.SecAuthProtection, true } -// SetSecAuthProtection sets field value -func (o *DatacenterPropertiesPut) SetSecAuthProtection(v bool) { - - o.SecAuthProtection = &v - -} - // HasSecAuthProtection returns a boolean if a field has been set. func (o *DatacenterPropertiesPut) HasSecAuthProtection() bool { - if o != nil && o.SecAuthProtection != nil { + if o != nil && !IsNil(o.SecAuthProtection) { return true } return false } -// GetCpuArchitecture returns the CpuArchitecture field value -// If the value is explicit nil, nil is returned -func (o *DatacenterPropertiesPut) GetCpuArchitecture() *[]CpuArchitectureProperties { - if o == nil { - return nil - } +// SetSecAuthProtection gets a reference to the given bool and assigns it to the SecAuthProtection field. +func (o *DatacenterPropertiesPut) SetSecAuthProtection(v bool) { + o.SecAuthProtection = &v +} +// GetCpuArchitecture returns the CpuArchitecture field value if set, zero value otherwise. +func (o *DatacenterPropertiesPut) GetCpuArchitecture() []CpuArchitectureProperties { + if o == nil || IsNil(o.CpuArchitecture) { + var ret []CpuArchitectureProperties + return ret + } return o.CpuArchitecture - } -// GetCpuArchitectureOk returns a tuple with the CpuArchitecture field value +// GetCpuArchitectureOk returns a tuple with the CpuArchitecture 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 *DatacenterPropertiesPut) GetCpuArchitectureOk() (*[]CpuArchitectureProperties, bool) { - if o == nil { +func (o *DatacenterPropertiesPut) GetCpuArchitectureOk() ([]CpuArchitectureProperties, bool) { + if o == nil || IsNil(o.CpuArchitecture) { return nil, false } - return o.CpuArchitecture, true } -// SetCpuArchitecture sets field value -func (o *DatacenterPropertiesPut) SetCpuArchitecture(v []CpuArchitectureProperties) { - - o.CpuArchitecture = &v - -} - // HasCpuArchitecture returns a boolean if a field has been set. func (o *DatacenterPropertiesPut) HasCpuArchitecture() bool { - if o != nil && o.CpuArchitecture != nil { + if o != nil && !IsNil(o.CpuArchitecture) { return true } return false } -// GetDefaultSecurityGroupId returns the DefaultSecurityGroupId field value -// If the value is explicit nil, nil is returned -func (o *DatacenterPropertiesPut) GetDefaultSecurityGroupId() *string { - if o == nil { - return nil - } - - return o.DefaultSecurityGroupId +// SetCpuArchitecture gets a reference to the given []CpuArchitectureProperties and assigns it to the CpuArchitecture field. +func (o *DatacenterPropertiesPut) SetCpuArchitecture(v []CpuArchitectureProperties) { + o.CpuArchitecture = v +} +// GetIpv6CidrBlock returns the Ipv6CidrBlock field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *DatacenterPropertiesPut) GetIpv6CidrBlock() string { + if o == nil || IsNil(o.Ipv6CidrBlock.Get()) { + var ret string + return ret + } + return *o.Ipv6CidrBlock.Get() } -// GetDefaultSecurityGroupIdOk returns a tuple with the DefaultSecurityGroupId field value +// GetIpv6CidrBlockOk returns a tuple with the Ipv6CidrBlock 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 *DatacenterPropertiesPut) GetDefaultSecurityGroupIdOk() (*string, bool) { +func (o *DatacenterPropertiesPut) GetIpv6CidrBlockOk() (*string, bool) { if o == nil { return nil, false } + return o.Ipv6CidrBlock.Get(), o.Ipv6CidrBlock.IsSet() +} - return o.DefaultSecurityGroupId, true +// HasIpv6CidrBlock returns a boolean if a field has been set. +func (o *DatacenterPropertiesPut) HasIpv6CidrBlock() bool { + if o != nil && o.Ipv6CidrBlock.IsSet() { + return true + } + + return false } -// SetDefaultSecurityGroupId sets field value -func (o *DatacenterPropertiesPut) SetDefaultSecurityGroupId(v string) { +// SetIpv6CidrBlock gets a reference to the given NullableString and assigns it to the Ipv6CidrBlock field. +func (o *DatacenterPropertiesPut) SetIpv6CidrBlock(v string) { + o.Ipv6CidrBlock.Set(&v) +} - o.DefaultSecurityGroupId = &v +// SetIpv6CidrBlockNil sets the value for Ipv6CidrBlock to be an explicit nil +func (o *DatacenterPropertiesPut) SetIpv6CidrBlockNil() { + o.Ipv6CidrBlock.Set(nil) +} + +// UnsetIpv6CidrBlock ensures that no value is present for Ipv6CidrBlock, not even an explicit nil +func (o *DatacenterPropertiesPut) UnsetIpv6CidrBlock() { + o.Ipv6CidrBlock.Unset() +} + +// GetDefaultSecurityGroupId returns the DefaultSecurityGroupId field value if set, zero value otherwise. +func (o *DatacenterPropertiesPut) GetDefaultSecurityGroupId() string { + if o == nil || IsNil(o.DefaultSecurityGroupId) { + var ret string + return ret + } + return *o.DefaultSecurityGroupId +} +// GetDefaultSecurityGroupIdOk returns a tuple with the DefaultSecurityGroupId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DatacenterPropertiesPut) GetDefaultSecurityGroupIdOk() (*string, bool) { + if o == nil || IsNil(o.DefaultSecurityGroupId) { + return nil, false + } + return o.DefaultSecurityGroupId, true } // HasDefaultSecurityGroupId returns a boolean if a field has been set. func (o *DatacenterPropertiesPut) HasDefaultSecurityGroupId() bool { - if o != nil && o.DefaultSecurityGroupId != nil { + if o != nil && !IsNil(o.DefaultSecurityGroupId) { return true } return false } -// GetCreateDefaultSecurityGroup returns the CreateDefaultSecurityGroup field value -// If the value is explicit nil, nil is returned -func (o *DatacenterPropertiesPut) GetCreateDefaultSecurityGroup() *bool { - if o == nil { - return nil - } - - return o.CreateDefaultSecurityGroup +// SetDefaultSecurityGroupId gets a reference to the given string and assigns it to the DefaultSecurityGroupId field. +func (o *DatacenterPropertiesPut) SetDefaultSecurityGroupId(v string) { + o.DefaultSecurityGroupId = &v +} +// GetCreateDefaultSecurityGroup returns the CreateDefaultSecurityGroup field value if set, zero value otherwise. +func (o *DatacenterPropertiesPut) GetCreateDefaultSecurityGroup() bool { + if o == nil || IsNil(o.CreateDefaultSecurityGroup) { + var ret bool + return ret + } + return *o.CreateDefaultSecurityGroup } -// GetCreateDefaultSecurityGroupOk returns a tuple with the CreateDefaultSecurityGroup field value +// GetCreateDefaultSecurityGroupOk returns a tuple with the CreateDefaultSecurityGroup 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 *DatacenterPropertiesPut) GetCreateDefaultSecurityGroupOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.CreateDefaultSecurityGroup) { return nil, false } - return o.CreateDefaultSecurityGroup, true } -// SetCreateDefaultSecurityGroup sets field value -func (o *DatacenterPropertiesPut) SetCreateDefaultSecurityGroup(v bool) { - - o.CreateDefaultSecurityGroup = &v - -} - // HasCreateDefaultSecurityGroup returns a boolean if a field has been set. func (o *DatacenterPropertiesPut) HasCreateDefaultSecurityGroup() bool { - if o != nil && o.CreateDefaultSecurityGroup != nil { + if o != nil && !IsNil(o.CreateDefaultSecurityGroup) { return true } return false } +// SetCreateDefaultSecurityGroup gets a reference to the given bool and assigns it to the CreateDefaultSecurityGroup field. +func (o *DatacenterPropertiesPut) SetCreateDefaultSecurityGroup(v bool) { + o.CreateDefaultSecurityGroup = &v +} + func (o DatacenterPropertiesPut) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o DatacenterPropertiesPut) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Name != nil { + if !IsNil(o.Name) { toSerialize["name"] = o.Name } - - if o.Description != nil { + if !IsNil(o.Description) { toSerialize["description"] = o.Description } - - if o.Location != nil { - toSerialize["location"] = o.Location - } - - if o.Version != nil { + toSerialize["location"] = o.Location + if !IsNil(o.Version) { toSerialize["version"] = o.Version } - - if o.Features != nil { + if !IsNil(o.Features) { toSerialize["features"] = o.Features } - - if o.SecAuthProtection != nil { + if !IsNil(o.SecAuthProtection) { toSerialize["secAuthProtection"] = o.SecAuthProtection } - - if o.CpuArchitecture != nil { + if !IsNil(o.CpuArchitecture) { toSerialize["cpuArchitecture"] = o.CpuArchitecture } - - if o.DefaultSecurityGroupId != nil { + if o.Ipv6CidrBlock.IsSet() { + toSerialize["ipv6CidrBlock"] = o.Ipv6CidrBlock.Get() + } + if !IsNil(o.DefaultSecurityGroupId) { toSerialize["defaultSecurityGroupId"] = o.DefaultSecurityGroupId } - - if o.CreateDefaultSecurityGroup != nil { + if !IsNil(o.CreateDefaultSecurityGroup) { toSerialize["createDefaultSecurityGroup"] = o.CreateDefaultSecurityGroup } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableDatacenterPropertiesPut struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_datacenter_put.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_datacenter_put.go similarity index 70% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_datacenter_put.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_datacenter_put.go index 925378b4b..7fb447801 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_datacenter_put.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_datacenter_put.go @@ -14,10 +14,13 @@ import ( "encoding/json" ) +// checks if the DatacenterPut type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DatacenterPut{} + // DatacenterPut struct for DatacenterPut type DatacenterPut struct { - Properties *DatacenterPropertiesPut `json:"properties"` - Entities *DataCenterEntities `json:"entities,omitempty"` + Properties DatacenterPropertiesPut `json:"properties"` + Entities *DatacenterEntities `json:"entities,omitempty"` } // NewDatacenterPut instantiates a new DatacenterPut object @@ -27,7 +30,7 @@ type DatacenterPut struct { func NewDatacenterPut(properties DatacenterPropertiesPut) *DatacenterPut { this := DatacenterPut{} - this.Properties = &properties + this.Properties = properties return &this } @@ -41,92 +44,76 @@ func NewDatacenterPutWithDefaults() *DatacenterPut { } // GetProperties returns the Properties field value -// If the value is explicit nil, nil is returned -func (o *DatacenterPut) GetProperties() *DatacenterPropertiesPut { +func (o *DatacenterPut) GetProperties() DatacenterPropertiesPut { if o == nil { - return nil + var ret DatacenterPropertiesPut + return ret } return o.Properties - } // GetPropertiesOk returns a tuple with the Properties field value // 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 *DatacenterPut) GetPropertiesOk() (*DatacenterPropertiesPut, bool) { if o == nil { return nil, false } - - return o.Properties, true + return &o.Properties, true } // SetProperties sets field value func (o *DatacenterPut) SetProperties(v DatacenterPropertiesPut) { - - o.Properties = &v - + o.Properties = v } -// HasProperties returns a boolean if a field has been set. -func (o *DatacenterPut) HasProperties() bool { - if o != nil && o.Properties != nil { - return true +// GetEntities returns the Entities field value if set, zero value otherwise. +func (o *DatacenterPut) GetEntities() DatacenterEntities { + if o == nil || IsNil(o.Entities) { + var ret DatacenterEntities + return ret } - - return false + return *o.Entities } -// GetEntities returns the Entities field value -// If the value is explicit nil, nil is returned -func (o *DatacenterPut) GetEntities() *DataCenterEntities { - if o == nil { - return nil - } - - return o.Entities - -} - -// GetEntitiesOk returns a tuple with the Entities field value +// GetEntitiesOk returns a tuple with the Entities 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 *DatacenterPut) GetEntitiesOk() (*DataCenterEntities, bool) { - if o == nil { +func (o *DatacenterPut) GetEntitiesOk() (*DatacenterEntities, bool) { + if o == nil || IsNil(o.Entities) { return nil, false } - return o.Entities, true } -// SetEntities sets field value -func (o *DatacenterPut) SetEntities(v DataCenterEntities) { - - o.Entities = &v - -} - // HasEntities returns a boolean if a field has been set. func (o *DatacenterPut) HasEntities() bool { - if o != nil && o.Entities != nil { + if o != nil && !IsNil(o.Entities) { return true } return false } +// SetEntities gets a reference to the given DatacenterEntities and assigns it to the Entities field. +func (o *DatacenterPut) SetEntities(v DatacenterEntities) { + o.Entities = &v +} + func (o DatacenterPut) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.Properties != nil { - toSerialize["properties"] = o.Properties + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } + return json.Marshal(toSerialize) +} - if o.Entities != nil { +func (o DatacenterPut) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["properties"] = o.Properties + if !IsNil(o.Entities) { toSerialize["entities"] = o.Entities } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableDatacenterPut struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_datacenters.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_datacenters.go similarity index 60% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_datacenters.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_datacenters.go index 6b5106658..767abd4b9 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_datacenters.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_datacenters.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the Datacenters type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Datacenters{} + // Datacenters struct for Datacenters type Datacenters struct { // The resource's unique identifier. @@ -23,7 +26,7 @@ type Datacenters struct { // URL to the object representation (absolute path). Href *string `json:"href,omitempty"` // Array of items in the collection. - Items *[]Datacenter `json:"items,omitempty"` + Items []Datacenter `json:"items,omitempty"` // The offset (if specified in the request). Offset *float32 `json:"offset,omitempty"` // The limit (if specified in the request). @@ -49,303 +52,262 @@ func NewDatacentersWithDefaults() *Datacenters { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *Datacenters) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *Datacenters) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *Datacenters) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *Datacenters) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *Datacenters) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *Datacenters) GetType() *Type { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Datacenters) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *Datacenters) GetType() Type { + if o == nil || IsNil(o.Type) { + var ret Type + return ret + } + return *o.Type } -// GetTypeOk returns a tuple with the Type field value +// GetTypeOk returns a tuple with the Type 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 *Datacenters) GetTypeOk() (*Type, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *Datacenters) SetType(v Type) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *Datacenters) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *Datacenters) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given Type and assigns it to the Type field. +func (o *Datacenters) SetType(v Type) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *Datacenters) 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 +// GetHrefOk returns a tuple with the Href 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 *Datacenters) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *Datacenters) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *Datacenters) HasHref() bool { - if o != nil && o.Href != nil { + if o != nil && !IsNil(o.Href) { return true } return false } -// GetItems returns the Items field value -// If the value is explicit nil, nil is returned -func (o *Datacenters) GetItems() *[]Datacenter { - if o == nil { - return nil - } +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *Datacenters) SetHref(v string) { + o.Href = &v +} +// GetItems returns the Items field value if set, zero value otherwise. +func (o *Datacenters) GetItems() []Datacenter { + if o == nil || IsNil(o.Items) { + var ret []Datacenter + return ret + } return o.Items - } -// GetItemsOk returns a tuple with the Items field value +// GetItemsOk returns a tuple with the Items 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 *Datacenters) GetItemsOk() (*[]Datacenter, bool) { - if o == nil { +func (o *Datacenters) GetItemsOk() ([]Datacenter, bool) { + if o == nil || IsNil(o.Items) { return nil, false } - return o.Items, true } -// SetItems sets field value -func (o *Datacenters) SetItems(v []Datacenter) { - - o.Items = &v - -} - // HasItems returns a boolean if a field has been set. func (o *Datacenters) HasItems() bool { - if o != nil && o.Items != nil { + if o != nil && !IsNil(o.Items) { return true } return false } -// GetOffset returns the Offset field value -// If the value is explicit nil, nil is returned -func (o *Datacenters) GetOffset() *float32 { - if o == nil { - return nil - } - - return o.Offset +// SetItems gets a reference to the given []Datacenter and assigns it to the Items field. +func (o *Datacenters) SetItems(v []Datacenter) { + o.Items = v +} +// GetOffset returns the Offset field value if set, zero value otherwise. +func (o *Datacenters) GetOffset() float32 { + if o == nil || IsNil(o.Offset) { + var ret float32 + return ret + } + return *o.Offset } -// GetOffsetOk returns a tuple with the Offset field value +// GetOffsetOk returns a tuple with the Offset 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 *Datacenters) GetOffsetOk() (*float32, bool) { - if o == nil { + if o == nil || IsNil(o.Offset) { return nil, false } - return o.Offset, true } -// SetOffset sets field value -func (o *Datacenters) SetOffset(v float32) { - - o.Offset = &v - -} - // HasOffset returns a boolean if a field has been set. func (o *Datacenters) HasOffset() bool { - if o != nil && o.Offset != nil { + if o != nil && !IsNil(o.Offset) { return true } return false } -// GetLimit returns the Limit field value -// If the value is explicit nil, nil is returned -func (o *Datacenters) GetLimit() *float32 { - if o == nil { - return nil - } - - return o.Limit +// SetOffset gets a reference to the given float32 and assigns it to the Offset field. +func (o *Datacenters) SetOffset(v float32) { + o.Offset = &v +} +// GetLimit returns the Limit field value if set, zero value otherwise. +func (o *Datacenters) GetLimit() float32 { + if o == nil || IsNil(o.Limit) { + var ret float32 + return ret + } + return *o.Limit } -// GetLimitOk returns a tuple with the Limit field value +// GetLimitOk returns a tuple with the Limit 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 *Datacenters) GetLimitOk() (*float32, bool) { - if o == nil { + if o == nil || IsNil(o.Limit) { return nil, false } - return o.Limit, true } -// SetLimit sets field value -func (o *Datacenters) SetLimit(v float32) { - - o.Limit = &v - -} - // HasLimit returns a boolean if a field has been set. func (o *Datacenters) HasLimit() bool { - if o != nil && o.Limit != nil { + if o != nil && !IsNil(o.Limit) { return true } return false } -// GetLinks returns the Links field value -// If the value is explicit nil, nil is returned -func (o *Datacenters) GetLinks() *PaginationLinks { - if o == nil { - return nil - } - - return o.Links +// SetLimit gets a reference to the given float32 and assigns it to the Limit field. +func (o *Datacenters) SetLimit(v float32) { + o.Limit = &v +} +// GetLinks returns the Links field value if set, zero value otherwise. +func (o *Datacenters) GetLinks() PaginationLinks { + if o == nil || IsNil(o.Links) { + var ret PaginationLinks + return ret + } + return *o.Links } -// GetLinksOk returns a tuple with the Links field value +// GetLinksOk returns a tuple with the Links 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 *Datacenters) GetLinksOk() (*PaginationLinks, bool) { - if o == nil { + if o == nil || IsNil(o.Links) { return nil, false } - return o.Links, true } -// SetLinks sets field value -func (o *Datacenters) SetLinks(v PaginationLinks) { - - o.Links = &v - -} - // HasLinks returns a boolean if a field has been set. func (o *Datacenters) HasLinks() bool { - if o != nil && o.Links != nil { + if o != nil && !IsNil(o.Links) { return true } return false } +// SetLinks gets a reference to the given PaginationLinks and assigns it to the Links field. +func (o *Datacenters) SetLinks(v PaginationLinks) { + o.Links = &v +} + func (o Datacenters) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Datacenters) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Items != nil { + if !IsNil(o.Items) { toSerialize["items"] = o.Items } - - if o.Offset != nil { + if !IsNil(o.Offset) { toSerialize["offset"] = o.Offset } - - if o.Limit != nil { + if !IsNil(o.Limit) { toSerialize["limit"] = o.Limit } - - if o.Links != nil { + if !IsNil(o.Links) { toSerialize["_links"] = o.Links } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableDatacenters struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_error.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_error.go similarity index 67% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_error.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_error.go index ebec2963b..0116258af 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_error.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_error.go @@ -14,11 +14,14 @@ import ( "encoding/json" ) +// checks if the Error type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Error{} + // Error struct for Error type Error struct { // HTTP status code of the operation. - HttpStatus *int32 `json:"httpStatus,omitempty"` - Messages *[]ErrorMessage `json:"messages,omitempty"` + HttpStatus *int32 `json:"httpStatus,omitempty"` + Messages []ErrorMessage `json:"messages,omitempty"` } // NewError instantiates a new Error object @@ -39,93 +42,87 @@ func NewErrorWithDefaults() *Error { return &this } -// GetHttpStatus returns the HttpStatus field value -// If the value is explicit nil, nil is returned -func (o *Error) GetHttpStatus() *int32 { - if o == nil { - return nil +// GetHttpStatus returns the HttpStatus field value if set, zero value otherwise. +func (o *Error) GetHttpStatus() int32 { + if o == nil || IsNil(o.HttpStatus) { + var ret int32 + return ret } - - return o.HttpStatus - + return *o.HttpStatus } -// GetHttpStatusOk returns a tuple with the HttpStatus field value +// GetHttpStatusOk returns a tuple with the HttpStatus 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 *Error) GetHttpStatusOk() (*int32, bool) { - if o == nil { + if o == nil || IsNil(o.HttpStatus) { return nil, false } - return o.HttpStatus, true } -// SetHttpStatus sets field value -func (o *Error) SetHttpStatus(v int32) { - - o.HttpStatus = &v - -} - // HasHttpStatus returns a boolean if a field has been set. func (o *Error) HasHttpStatus() bool { - if o != nil && o.HttpStatus != nil { + if o != nil && !IsNil(o.HttpStatus) { return true } return false } -// GetMessages returns the Messages field value -// If the value is explicit nil, nil is returned -func (o *Error) GetMessages() *[]ErrorMessage { - if o == nil { - return nil - } +// SetHttpStatus gets a reference to the given int32 and assigns it to the HttpStatus field. +func (o *Error) SetHttpStatus(v int32) { + o.HttpStatus = &v +} +// GetMessages returns the Messages field value if set, zero value otherwise. +func (o *Error) GetMessages() []ErrorMessage { + if o == nil || IsNil(o.Messages) { + var ret []ErrorMessage + return ret + } return o.Messages - } -// GetMessagesOk returns a tuple with the Messages field value +// GetMessagesOk returns a tuple with the Messages 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 *Error) GetMessagesOk() (*[]ErrorMessage, bool) { - if o == nil { +func (o *Error) GetMessagesOk() ([]ErrorMessage, bool) { + if o == nil || IsNil(o.Messages) { return nil, false } - return o.Messages, true } -// SetMessages sets field value -func (o *Error) SetMessages(v []ErrorMessage) { - - o.Messages = &v - -} - // HasMessages returns a boolean if a field has been set. func (o *Error) HasMessages() bool { - if o != nil && o.Messages != nil { + if o != nil && !IsNil(o.Messages) { return true } return false } +// SetMessages gets a reference to the given []ErrorMessage and assigns it to the Messages field. +func (o *Error) SetMessages(v []ErrorMessage) { + o.Messages = 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 o.HttpStatus != nil { + if !IsNil(o.HttpStatus) { toSerialize["httpStatus"] = o.HttpStatus } - - if o.Messages != nil { + if !IsNil(o.Messages) { toSerialize["messages"] = o.Messages } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableError struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_error_message.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_error_message.go similarity index 73% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_error_message.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_error_message.go index 6abecfdec..d08765b0d 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_error_message.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_error_message.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the ErrorMessage type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ErrorMessage{} + // ErrorMessage struct for ErrorMessage type ErrorMessage struct { // Application internal error code. @@ -40,93 +43,87 @@ func NewErrorMessageWithDefaults() *ErrorMessage { return &this } -// GetErrorCode returns the ErrorCode field value -// If the value is explicit nil, nil is returned -func (o *ErrorMessage) GetErrorCode() *string { - if o == nil { - return nil +// GetErrorCode returns the ErrorCode field value if set, zero value otherwise. +func (o *ErrorMessage) GetErrorCode() string { + if o == nil || IsNil(o.ErrorCode) { + var ret string + return ret } - - return o.ErrorCode - + return *o.ErrorCode } -// GetErrorCodeOk returns a tuple with the ErrorCode field value +// GetErrorCodeOk returns a tuple with the ErrorCode 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 *ErrorMessage) GetErrorCodeOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.ErrorCode) { return nil, false } - return o.ErrorCode, true } -// SetErrorCode sets field value -func (o *ErrorMessage) SetErrorCode(v string) { - - o.ErrorCode = &v - -} - // HasErrorCode returns a boolean if a field has been set. func (o *ErrorMessage) HasErrorCode() bool { - if o != nil && o.ErrorCode != nil { + if o != nil && !IsNil(o.ErrorCode) { return true } return false } -// GetMessage returns the Message field value -// If the value is explicit nil, nil is returned -func (o *ErrorMessage) GetMessage() *string { - if o == nil { - return nil - } - - return o.Message +// SetErrorCode gets a reference to the given string and assigns it to the ErrorCode field. +func (o *ErrorMessage) SetErrorCode(v string) { + o.ErrorCode = &v +} +// GetMessage returns the Message field value if set, zero value otherwise. +func (o *ErrorMessage) 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 +// GetMessageOk returns a tuple with the Message 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 *ErrorMessage) GetMessageOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Message) { return nil, false } - return o.Message, true } -// SetMessage sets field value -func (o *ErrorMessage) SetMessage(v string) { - - o.Message = &v - -} - // HasMessage returns a boolean if a field has been set. func (o *ErrorMessage) HasMessage() bool { - if o != nil && o.Message != nil { + 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 *ErrorMessage) SetMessage(v string) { + o.Message = &v +} + func (o ErrorMessage) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ErrorMessage) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.ErrorCode != nil { + if !IsNil(o.ErrorCode) { toSerialize["errorCode"] = o.ErrorCode } - - if o.Message != nil { + if !IsNil(o.Message) { toSerialize["message"] = o.Message } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableErrorMessage struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_firewall_rule.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_firewall_rule.go similarity index 65% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_firewall_rule.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_firewall_rule.go index b83cb2e48..1bc34e9f6 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_firewall_rule.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_firewall_rule.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the FirewallRule type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &FirewallRule{} + // FirewallRule struct for FirewallRule type FirewallRule struct { // The resource's unique identifier. @@ -23,7 +26,7 @@ type FirewallRule struct { // URL to the object representation (absolute path). Href *string `json:"href,omitempty"` Metadata *DatacenterElementMetadata `json:"metadata,omitempty"` - Properties *FirewallruleProperties `json:"properties"` + Properties FirewallruleProperties `json:"properties"` } // NewFirewallRule instantiates a new FirewallRule object @@ -33,7 +36,7 @@ type FirewallRule struct { func NewFirewallRule(properties FirewallruleProperties) *FirewallRule { this := FirewallRule{} - this.Properties = &properties + this.Properties = properties return &this } @@ -46,219 +49,182 @@ func NewFirewallRuleWithDefaults() *FirewallRule { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *FirewallRule) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *FirewallRule) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *FirewallRule) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *FirewallRule) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *FirewallRule) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *FirewallRule) GetType() *Type { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *FirewallRule) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *FirewallRule) GetType() Type { + if o == nil || IsNil(o.Type) { + var ret Type + return ret + } + return *o.Type } -// GetTypeOk returns a tuple with the Type field value +// GetTypeOk returns a tuple with the Type 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 *FirewallRule) GetTypeOk() (*Type, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *FirewallRule) SetType(v Type) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *FirewallRule) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *FirewallRule) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given Type and assigns it to the Type field. +func (o *FirewallRule) SetType(v Type) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *FirewallRule) 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 +// GetHrefOk returns a tuple with the Href 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 *FirewallRule) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *FirewallRule) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *FirewallRule) HasHref() bool { - if o != nil && o.Href != nil { + if o != nil && !IsNil(o.Href) { return true } return false } -// GetMetadata returns the Metadata field value -// If the value is explicit nil, nil is returned -func (o *FirewallRule) GetMetadata() *DatacenterElementMetadata { - if o == nil { - return nil - } - - return o.Metadata +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *FirewallRule) SetHref(v string) { + o.Href = &v +} +// GetMetadata returns the Metadata field value if set, zero value otherwise. +func (o *FirewallRule) GetMetadata() DatacenterElementMetadata { + if o == nil || IsNil(o.Metadata) { + var ret DatacenterElementMetadata + return ret + } + return *o.Metadata } -// GetMetadataOk returns a tuple with the Metadata field value +// GetMetadataOk returns a tuple with the Metadata 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 *FirewallRule) GetMetadataOk() (*DatacenterElementMetadata, bool) { - if o == nil { + if o == nil || IsNil(o.Metadata) { return nil, false } - return o.Metadata, true } -// SetMetadata sets field value -func (o *FirewallRule) SetMetadata(v DatacenterElementMetadata) { - - o.Metadata = &v - -} - // HasMetadata returns a boolean if a field has been set. func (o *FirewallRule) HasMetadata() bool { - if o != nil && o.Metadata != nil { + if o != nil && !IsNil(o.Metadata) { return true } return false } +// SetMetadata gets a reference to the given DatacenterElementMetadata and assigns it to the Metadata field. +func (o *FirewallRule) SetMetadata(v DatacenterElementMetadata) { + o.Metadata = &v +} + // GetProperties returns the Properties field value -// If the value is explicit nil, nil is returned -func (o *FirewallRule) GetProperties() *FirewallruleProperties { +func (o *FirewallRule) GetProperties() FirewallruleProperties { if o == nil { - return nil + var ret FirewallruleProperties + return ret } return o.Properties - } // GetPropertiesOk returns a tuple with the Properties field value // 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 *FirewallRule) GetPropertiesOk() (*FirewallruleProperties, bool) { if o == nil { return nil, false } - - return o.Properties, true + return &o.Properties, true } // SetProperties sets field value func (o *FirewallRule) SetProperties(v FirewallruleProperties) { - - o.Properties = &v - + o.Properties = v } -// HasProperties returns a boolean if a field has been set. -func (o *FirewallRule) HasProperties() bool { - if o != nil && o.Properties != nil { - return true +func (o FirewallRule) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } - - return false + return json.Marshal(toSerialize) } -func (o FirewallRule) MarshalJSON() ([]byte, error) { +func (o FirewallRule) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Metadata != nil { + if !IsNil(o.Metadata) { toSerialize["metadata"] = o.Metadata } - - if o.Properties != nil { - toSerialize["properties"] = o.Properties - } - - return json.Marshal(toSerialize) + toSerialize["properties"] = o.Properties + return toSerialize, nil } type NullableFirewallRule struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_firewall_rules.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_firewall_rules.go similarity index 60% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_firewall_rules.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_firewall_rules.go index f32146cfa..0bb5fa133 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_firewall_rules.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_firewall_rules.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the FirewallRules type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &FirewallRules{} + // FirewallRules struct for FirewallRules type FirewallRules struct { // The resource's unique identifier. @@ -23,7 +26,7 @@ type FirewallRules struct { // URL to the object representation (absolute path). Href *string `json:"href,omitempty"` // Array of items in the collection. - Items *[]FirewallRule `json:"items,omitempty"` + Items []FirewallRule `json:"items,omitempty"` // The offset (if specified in the request). Offset *float32 `json:"offset,omitempty"` // The limit (if specified in the request). @@ -49,303 +52,262 @@ func NewFirewallRulesWithDefaults() *FirewallRules { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *FirewallRules) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *FirewallRules) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *FirewallRules) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *FirewallRules) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *FirewallRules) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *FirewallRules) GetType() *Type { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *FirewallRules) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *FirewallRules) GetType() Type { + if o == nil || IsNil(o.Type) { + var ret Type + return ret + } + return *o.Type } -// GetTypeOk returns a tuple with the Type field value +// GetTypeOk returns a tuple with the Type 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 *FirewallRules) GetTypeOk() (*Type, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *FirewallRules) SetType(v Type) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *FirewallRules) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *FirewallRules) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given Type and assigns it to the Type field. +func (o *FirewallRules) SetType(v Type) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *FirewallRules) 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 +// GetHrefOk returns a tuple with the Href 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 *FirewallRules) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *FirewallRules) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *FirewallRules) HasHref() bool { - if o != nil && o.Href != nil { + if o != nil && !IsNil(o.Href) { return true } return false } -// GetItems returns the Items field value -// If the value is explicit nil, nil is returned -func (o *FirewallRules) GetItems() *[]FirewallRule { - if o == nil { - return nil - } +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *FirewallRules) SetHref(v string) { + o.Href = &v +} +// GetItems returns the Items field value if set, zero value otherwise. +func (o *FirewallRules) GetItems() []FirewallRule { + if o == nil || IsNil(o.Items) { + var ret []FirewallRule + return ret + } return o.Items - } -// GetItemsOk returns a tuple with the Items field value +// GetItemsOk returns a tuple with the Items 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 *FirewallRules) GetItemsOk() (*[]FirewallRule, bool) { - if o == nil { +func (o *FirewallRules) GetItemsOk() ([]FirewallRule, bool) { + if o == nil || IsNil(o.Items) { return nil, false } - return o.Items, true } -// SetItems sets field value -func (o *FirewallRules) SetItems(v []FirewallRule) { - - o.Items = &v - -} - // HasItems returns a boolean if a field has been set. func (o *FirewallRules) HasItems() bool { - if o != nil && o.Items != nil { + if o != nil && !IsNil(o.Items) { return true } return false } -// GetOffset returns the Offset field value -// If the value is explicit nil, nil is returned -func (o *FirewallRules) GetOffset() *float32 { - if o == nil { - return nil - } - - return o.Offset +// SetItems gets a reference to the given []FirewallRule and assigns it to the Items field. +func (o *FirewallRules) SetItems(v []FirewallRule) { + o.Items = v +} +// GetOffset returns the Offset field value if set, zero value otherwise. +func (o *FirewallRules) GetOffset() float32 { + if o == nil || IsNil(o.Offset) { + var ret float32 + return ret + } + return *o.Offset } -// GetOffsetOk returns a tuple with the Offset field value +// GetOffsetOk returns a tuple with the Offset 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 *FirewallRules) GetOffsetOk() (*float32, bool) { - if o == nil { + if o == nil || IsNil(o.Offset) { return nil, false } - return o.Offset, true } -// SetOffset sets field value -func (o *FirewallRules) SetOffset(v float32) { - - o.Offset = &v - -} - // HasOffset returns a boolean if a field has been set. func (o *FirewallRules) HasOffset() bool { - if o != nil && o.Offset != nil { + if o != nil && !IsNil(o.Offset) { return true } return false } -// GetLimit returns the Limit field value -// If the value is explicit nil, nil is returned -func (o *FirewallRules) GetLimit() *float32 { - if o == nil { - return nil - } - - return o.Limit +// SetOffset gets a reference to the given float32 and assigns it to the Offset field. +func (o *FirewallRules) SetOffset(v float32) { + o.Offset = &v +} +// GetLimit returns the Limit field value if set, zero value otherwise. +func (o *FirewallRules) GetLimit() float32 { + if o == nil || IsNil(o.Limit) { + var ret float32 + return ret + } + return *o.Limit } -// GetLimitOk returns a tuple with the Limit field value +// GetLimitOk returns a tuple with the Limit 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 *FirewallRules) GetLimitOk() (*float32, bool) { - if o == nil { + if o == nil || IsNil(o.Limit) { return nil, false } - return o.Limit, true } -// SetLimit sets field value -func (o *FirewallRules) SetLimit(v float32) { - - o.Limit = &v - -} - // HasLimit returns a boolean if a field has been set. func (o *FirewallRules) HasLimit() bool { - if o != nil && o.Limit != nil { + if o != nil && !IsNil(o.Limit) { return true } return false } -// GetLinks returns the Links field value -// If the value is explicit nil, nil is returned -func (o *FirewallRules) GetLinks() *PaginationLinks { - if o == nil { - return nil - } - - return o.Links +// SetLimit gets a reference to the given float32 and assigns it to the Limit field. +func (o *FirewallRules) SetLimit(v float32) { + o.Limit = &v +} +// GetLinks returns the Links field value if set, zero value otherwise. +func (o *FirewallRules) GetLinks() PaginationLinks { + if o == nil || IsNil(o.Links) { + var ret PaginationLinks + return ret + } + return *o.Links } -// GetLinksOk returns a tuple with the Links field value +// GetLinksOk returns a tuple with the Links 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 *FirewallRules) GetLinksOk() (*PaginationLinks, bool) { - if o == nil { + if o == nil || IsNil(o.Links) { return nil, false } - return o.Links, true } -// SetLinks sets field value -func (o *FirewallRules) SetLinks(v PaginationLinks) { - - o.Links = &v - -} - // HasLinks returns a boolean if a field has been set. func (o *FirewallRules) HasLinks() bool { - if o != nil && o.Links != nil { + if o != nil && !IsNil(o.Links) { return true } return false } +// SetLinks gets a reference to the given PaginationLinks and assigns it to the Links field. +func (o *FirewallRules) SetLinks(v PaginationLinks) { + o.Links = &v +} + func (o FirewallRules) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o FirewallRules) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Items != nil { + if !IsNil(o.Items) { toSerialize["items"] = o.Items } - - if o.Offset != nil { + if !IsNil(o.Offset) { toSerialize["offset"] = o.Offset } - - if o.Limit != nil { + if !IsNil(o.Limit) { toSerialize["limit"] = o.Limit } - - if o.Links != nil { + if !IsNil(o.Links) { toSerialize["_links"] = o.Links } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableFirewallRules struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_firewallrule_properties.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_firewallrule_properties.go similarity index 55% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_firewallrule_properties.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_firewallrule_properties.go index 09590f5c9..ef81c64d9 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_firewallrule_properties.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_firewallrule_properties.go @@ -14,30 +14,27 @@ import ( "encoding/json" ) +// checks if the FirewallruleProperties type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &FirewallruleProperties{} + // FirewallruleProperties struct for FirewallruleProperties type FirewallruleProperties struct { // The name of the resource. Name *string `json:"name,omitempty"` // The protocol for the rule. Property cannot be modified after it is created (disallowed in update requests). - Protocol *string `json:"protocol"` + Protocol string `json:"protocol"` // Only traffic originating from the respective MAC address is allowed. Valid format: aa:bb:cc:dd:ee:ff. Value null allows traffic from any MAC address. - // to set this field to `nil` in order to be marshalled, the explicit nil address `Nilstring` can be used, or the setter `SetSourceMacNil` - SourceMac *string `json:"sourceMac,omitempty"` + SourceMac NullableString `json:"sourceMac,omitempty"` // The IP version for this rule. If sourceIp or targetIp are specified, you can omit this value - the IP version will then be deduced from the IP address(es) used; if you specify it anyway, it must match the specified IP address(es). If neither sourceIp nor targetIp are specified, this rule allows traffic only for the specified IP version. If neither sourceIp, targetIp nor ipVersion are specified, this rule will only allow IPv4 traffic. - // to set this field to `nil` in order to be marshalled, the explicit nil address `Nilstring` can be used, or the setter `SetIpVersionNil` - IpVersion *string `json:"ipVersion,omitempty"` + IpVersion NullableString `json:"ipVersion,omitempty"` // Only traffic originating from the respective IP address (or CIDR block) is allowed. Value null allows traffic from any IP address (according to the selected ipVersion). - // to set this field to `nil` in order to be marshalled, the explicit nil address `Nilstring` can be used, or the setter `SetSourceIpNil` - SourceIp *string `json:"sourceIp,omitempty"` + SourceIp NullableString `json:"sourceIp,omitempty"` // If the target NIC has multiple IP addresses, only the traffic directed to the respective IP address (or CIDR block) of the NIC is allowed. Value null allows traffic to any target IP address (according to the selected ipVersion). - // to set this field to `nil` in order to be marshalled, the explicit nil address `Nilstring` can be used, or the setter `SetTargetIpNil` - TargetIp *string `json:"targetIp,omitempty"` + TargetIp NullableString `json:"targetIp,omitempty"` // Defines the allowed code (from 0 to 254) if protocol ICMP or ICMPv6 is chosen. Value null allows all codes. - // to set this field to `nil` in order to be marshalled, the explicit nil address `Nilint32` can be used, or the setter `SetIcmpCodeNil` - IcmpCode *int32 `json:"icmpCode,omitempty"` + IcmpCode NullableInt32 `json:"icmpCode,omitempty"` // Defines the allowed type (from 0 to 254) if the protocol ICMP or ICMPv6 is chosen. Value null allows all types. - // to set this field to `nil` in order to be marshalled, the explicit nil address `Nilint32` can be used, or the setter `SetIcmpTypeNil` - IcmpType *int32 `json:"icmpType,omitempty"` + IcmpType NullableInt32 `json:"icmpType,omitempty"` // Defines the start range of the allowed port (from 1 to 65535) if protocol TCP or UDP is chosen. Leave portRangeStart and portRangeEnd value null to allow all ports. PortRangeStart *int32 `json:"portRangeStart,omitempty"` // Defines the end range of the allowed port (from 1 to 65535) if the protocol TCP or UDP is chosen. Leave portRangeStart and portRangeEnd null to allow all ports. @@ -53,7 +50,7 @@ type FirewallruleProperties struct { func NewFirewallruleProperties(protocol string) *FirewallruleProperties { this := FirewallruleProperties{} - this.Protocol = &protocol + this.Protocol = protocol return &this } @@ -66,512 +63,458 @@ func NewFirewallrulePropertiesWithDefaults() *FirewallruleProperties { return &this } -// GetName returns the Name field value -// If the value is explicit nil, nil is returned -func (o *FirewallruleProperties) GetName() *string { - if o == nil { - return nil +// GetName returns the Name field value if set, zero value otherwise. +func (o *FirewallruleProperties) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret } - - return o.Name - + return *o.Name } -// GetNameOk returns a tuple with the Name field value +// GetNameOk returns a tuple with the Name 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 *FirewallruleProperties) GetNameOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Name) { return nil, false } - return o.Name, true } -// SetName sets field value -func (o *FirewallruleProperties) SetName(v string) { - - o.Name = &v - -} - // HasName returns a boolean if a field has been set. func (o *FirewallruleProperties) HasName() bool { - if o != nil && o.Name != nil { + 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 *FirewallruleProperties) SetName(v string) { + o.Name = &v +} + // GetProtocol returns the Protocol field value -// If the value is explicit nil, nil is returned -func (o *FirewallruleProperties) GetProtocol() *string { +func (o *FirewallruleProperties) GetProtocol() string { if o == nil { - return nil + var ret string + return ret } return o.Protocol - } // GetProtocolOk returns a tuple with the Protocol field value // 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 *FirewallruleProperties) GetProtocolOk() (*string, bool) { if o == nil { return nil, false } - - return o.Protocol, true + return &o.Protocol, true } // SetProtocol sets field value func (o *FirewallruleProperties) SetProtocol(v string) { - - o.Protocol = &v - -} - -// HasProtocol returns a boolean if a field has been set. -func (o *FirewallruleProperties) HasProtocol() bool { - if o != nil && o.Protocol != nil { - return true - } - - return false + o.Protocol = v } -// GetSourceMac returns the SourceMac field value -// If the value is explicit nil, nil is returned -func (o *FirewallruleProperties) GetSourceMac() *string { - if o == nil { - return nil +// GetSourceMac returns the SourceMac field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *FirewallruleProperties) GetSourceMac() string { + if o == nil || IsNil(o.SourceMac.Get()) { + var ret string + return ret } - - return o.SourceMac - + return *o.SourceMac.Get() } -// GetSourceMacOk returns a tuple with the SourceMac field value +// GetSourceMacOk returns a tuple with the SourceMac 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 *FirewallruleProperties) GetSourceMacOk() (*string, bool) { if o == nil { return nil, false } - - return o.SourceMac, true -} - -// SetSourceMac sets field value -func (o *FirewallruleProperties) SetSourceMac(v string) { - - o.SourceMac = &v - -} - -// sets SourceMac to the explicit address that will be encoded as nil when marshaled -func (o *FirewallruleProperties) SetSourceMacNil() { - o.SourceMac = &Nilstring + return o.SourceMac.Get(), o.SourceMac.IsSet() } // HasSourceMac returns a boolean if a field has been set. func (o *FirewallruleProperties) HasSourceMac() bool { - if o != nil && o.SourceMac != nil { + if o != nil && o.SourceMac.IsSet() { return true } return false } -// GetIpVersion returns the IpVersion field value -// If the value is explicit nil, nil is returned -func (o *FirewallruleProperties) GetIpVersion() *string { - if o == nil { - return nil - } +// SetSourceMac gets a reference to the given NullableString and assigns it to the SourceMac field. +func (o *FirewallruleProperties) SetSourceMac(v string) { + o.SourceMac.Set(&v) +} - return o.IpVersion +// SetSourceMacNil sets the value for SourceMac to be an explicit nil +func (o *FirewallruleProperties) SetSourceMacNil() { + o.SourceMac.Set(nil) +} + +// UnsetSourceMac ensures that no value is present for SourceMac, not even an explicit nil +func (o *FirewallruleProperties) UnsetSourceMac() { + o.SourceMac.Unset() +} +// GetIpVersion returns the IpVersion field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *FirewallruleProperties) GetIpVersion() string { + if o == nil || IsNil(o.IpVersion.Get()) { + var ret string + return ret + } + return *o.IpVersion.Get() } -// GetIpVersionOk returns a tuple with the IpVersion field value +// GetIpVersionOk returns a tuple with the IpVersion 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 *FirewallruleProperties) GetIpVersionOk() (*string, bool) { if o == nil { return nil, false } - - return o.IpVersion, true -} - -// SetIpVersion sets field value -func (o *FirewallruleProperties) SetIpVersion(v string) { - - o.IpVersion = &v - -} - -// sets IpVersion to the explicit address that will be encoded as nil when marshaled -func (o *FirewallruleProperties) SetIpVersionNil() { - o.IpVersion = &Nilstring + return o.IpVersion.Get(), o.IpVersion.IsSet() } // HasIpVersion returns a boolean if a field has been set. func (o *FirewallruleProperties) HasIpVersion() bool { - if o != nil && o.IpVersion != nil { + if o != nil && o.IpVersion.IsSet() { return true } return false } -// GetSourceIp returns the SourceIp field value -// If the value is explicit nil, nil is returned -func (o *FirewallruleProperties) GetSourceIp() *string { - if o == nil { - return nil - } +// SetIpVersion gets a reference to the given NullableString and assigns it to the IpVersion field. +func (o *FirewallruleProperties) SetIpVersion(v string) { + o.IpVersion.Set(&v) +} - return o.SourceIp +// SetIpVersionNil sets the value for IpVersion to be an explicit nil +func (o *FirewallruleProperties) SetIpVersionNil() { + o.IpVersion.Set(nil) +} + +// UnsetIpVersion ensures that no value is present for IpVersion, not even an explicit nil +func (o *FirewallruleProperties) UnsetIpVersion() { + o.IpVersion.Unset() +} +// GetSourceIp returns the SourceIp field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *FirewallruleProperties) GetSourceIp() string { + if o == nil || IsNil(o.SourceIp.Get()) { + var ret string + return ret + } + return *o.SourceIp.Get() } -// GetSourceIpOk returns a tuple with the SourceIp field value +// GetSourceIpOk returns a tuple with the SourceIp 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 *FirewallruleProperties) GetSourceIpOk() (*string, bool) { if o == nil { return nil, false } - - return o.SourceIp, true -} - -// SetSourceIp sets field value -func (o *FirewallruleProperties) SetSourceIp(v string) { - - o.SourceIp = &v - -} - -// sets SourceIp to the explicit address that will be encoded as nil when marshaled -func (o *FirewallruleProperties) SetSourceIpNil() { - o.SourceIp = &Nilstring + return o.SourceIp.Get(), o.SourceIp.IsSet() } // HasSourceIp returns a boolean if a field has been set. func (o *FirewallruleProperties) HasSourceIp() bool { - if o != nil && o.SourceIp != nil { + if o != nil && o.SourceIp.IsSet() { return true } return false } -// GetTargetIp returns the TargetIp field value -// If the value is explicit nil, nil is returned -func (o *FirewallruleProperties) GetTargetIp() *string { - if o == nil { - return nil - } +// SetSourceIp gets a reference to the given NullableString and assigns it to the SourceIp field. +func (o *FirewallruleProperties) SetSourceIp(v string) { + o.SourceIp.Set(&v) +} - return o.TargetIp +// SetSourceIpNil sets the value for SourceIp to be an explicit nil +func (o *FirewallruleProperties) SetSourceIpNil() { + o.SourceIp.Set(nil) +} +// UnsetSourceIp ensures that no value is present for SourceIp, not even an explicit nil +func (o *FirewallruleProperties) UnsetSourceIp() { + o.SourceIp.Unset() } -// GetTargetIpOk returns a tuple with the TargetIp field value +// GetTargetIp returns the TargetIp field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *FirewallruleProperties) GetTargetIp() string { + if o == nil || IsNil(o.TargetIp.Get()) { + var ret string + return ret + } + return *o.TargetIp.Get() +} + +// GetTargetIpOk returns a tuple with the TargetIp 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 *FirewallruleProperties) GetTargetIpOk() (*string, bool) { if o == nil { return nil, false } - - return o.TargetIp, true -} - -// SetTargetIp sets field value -func (o *FirewallruleProperties) SetTargetIp(v string) { - - o.TargetIp = &v - -} - -// sets TargetIp to the explicit address that will be encoded as nil when marshaled -func (o *FirewallruleProperties) SetTargetIpNil() { - o.TargetIp = &Nilstring + return o.TargetIp.Get(), o.TargetIp.IsSet() } // HasTargetIp returns a boolean if a field has been set. func (o *FirewallruleProperties) HasTargetIp() bool { - if o != nil && o.TargetIp != nil { + if o != nil && o.TargetIp.IsSet() { return true } return false } -// GetIcmpCode returns the IcmpCode field value -// If the value is explicit nil, nil is returned -func (o *FirewallruleProperties) GetIcmpCode() *int32 { - if o == nil { - return nil - } +// SetTargetIp gets a reference to the given NullableString and assigns it to the TargetIp field. +func (o *FirewallruleProperties) SetTargetIp(v string) { + o.TargetIp.Set(&v) +} + +// SetTargetIpNil sets the value for TargetIp to be an explicit nil +func (o *FirewallruleProperties) SetTargetIpNil() { + o.TargetIp.Set(nil) +} - return o.IcmpCode +// UnsetTargetIp ensures that no value is present for TargetIp, not even an explicit nil +func (o *FirewallruleProperties) UnsetTargetIp() { + o.TargetIp.Unset() +} +// GetIcmpCode returns the IcmpCode field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *FirewallruleProperties) GetIcmpCode() int32 { + if o == nil || IsNil(o.IcmpCode.Get()) { + var ret int32 + return ret + } + return *o.IcmpCode.Get() } -// GetIcmpCodeOk returns a tuple with the IcmpCode field value +// GetIcmpCodeOk returns a tuple with the IcmpCode 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 *FirewallruleProperties) GetIcmpCodeOk() (*int32, bool) { if o == nil { return nil, false } - - return o.IcmpCode, true -} - -// SetIcmpCode sets field value -func (o *FirewallruleProperties) SetIcmpCode(v int32) { - - o.IcmpCode = &v - -} - -// sets IcmpCode to the explicit address that will be encoded as nil when marshaled -func (o *FirewallruleProperties) SetIcmpCodeNil() { - o.IcmpCode = &Nilint32 + return o.IcmpCode.Get(), o.IcmpCode.IsSet() } // HasIcmpCode returns a boolean if a field has been set. func (o *FirewallruleProperties) HasIcmpCode() bool { - if o != nil && o.IcmpCode != nil { + if o != nil && o.IcmpCode.IsSet() { return true } return false } -// GetIcmpType returns the IcmpType field value -// If the value is explicit nil, nil is returned -func (o *FirewallruleProperties) GetIcmpType() *int32 { - if o == nil { - return nil - } +// SetIcmpCode gets a reference to the given NullableInt32 and assigns it to the IcmpCode field. +func (o *FirewallruleProperties) SetIcmpCode(v int32) { + o.IcmpCode.Set(&v) +} + +// SetIcmpCodeNil sets the value for IcmpCode to be an explicit nil +func (o *FirewallruleProperties) SetIcmpCodeNil() { + o.IcmpCode.Set(nil) +} - return o.IcmpType +// UnsetIcmpCode ensures that no value is present for IcmpCode, not even an explicit nil +func (o *FirewallruleProperties) UnsetIcmpCode() { + o.IcmpCode.Unset() +} +// GetIcmpType returns the IcmpType field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *FirewallruleProperties) GetIcmpType() int32 { + if o == nil || IsNil(o.IcmpType.Get()) { + var ret int32 + return ret + } + return *o.IcmpType.Get() } -// GetIcmpTypeOk returns a tuple with the IcmpType field value +// GetIcmpTypeOk returns a tuple with the IcmpType 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 *FirewallruleProperties) GetIcmpTypeOk() (*int32, bool) { if o == nil { return nil, false } - - return o.IcmpType, true -} - -// SetIcmpType sets field value -func (o *FirewallruleProperties) SetIcmpType(v int32) { - - o.IcmpType = &v - -} - -// sets IcmpType to the explicit address that will be encoded as nil when marshaled -func (o *FirewallruleProperties) SetIcmpTypeNil() { - o.IcmpType = &Nilint32 + return o.IcmpType.Get(), o.IcmpType.IsSet() } // HasIcmpType returns a boolean if a field has been set. func (o *FirewallruleProperties) HasIcmpType() bool { - if o != nil && o.IcmpType != nil { + if o != nil && o.IcmpType.IsSet() { return true } return false } -// GetPortRangeStart returns the PortRangeStart field value -// If the value is explicit nil, nil is returned -func (o *FirewallruleProperties) GetPortRangeStart() *int32 { - if o == nil { - return nil - } +// SetIcmpType gets a reference to the given NullableInt32 and assigns it to the IcmpType field. +func (o *FirewallruleProperties) SetIcmpType(v int32) { + o.IcmpType.Set(&v) +} - return o.PortRangeStart +// SetIcmpTypeNil sets the value for IcmpType to be an explicit nil +func (o *FirewallruleProperties) SetIcmpTypeNil() { + o.IcmpType.Set(nil) +} +// UnsetIcmpType ensures that no value is present for IcmpType, not even an explicit nil +func (o *FirewallruleProperties) UnsetIcmpType() { + o.IcmpType.Unset() } -// GetPortRangeStartOk returns a tuple with the PortRangeStart field value +// GetPortRangeStart returns the PortRangeStart field value if set, zero value otherwise. +func (o *FirewallruleProperties) GetPortRangeStart() int32 { + if o == nil || IsNil(o.PortRangeStart) { + var ret int32 + return ret + } + return *o.PortRangeStart +} + +// GetPortRangeStartOk returns a tuple with the PortRangeStart 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 *FirewallruleProperties) GetPortRangeStartOk() (*int32, bool) { - if o == nil { + if o == nil || IsNil(o.PortRangeStart) { return nil, false } - return o.PortRangeStart, true } -// SetPortRangeStart sets field value -func (o *FirewallruleProperties) SetPortRangeStart(v int32) { - - o.PortRangeStart = &v - -} - // HasPortRangeStart returns a boolean if a field has been set. func (o *FirewallruleProperties) HasPortRangeStart() bool { - if o != nil && o.PortRangeStart != nil { + if o != nil && !IsNil(o.PortRangeStart) { return true } return false } -// GetPortRangeEnd returns the PortRangeEnd field value -// If the value is explicit nil, nil is returned -func (o *FirewallruleProperties) GetPortRangeEnd() *int32 { - if o == nil { - return nil - } - - return o.PortRangeEnd +// SetPortRangeStart gets a reference to the given int32 and assigns it to the PortRangeStart field. +func (o *FirewallruleProperties) SetPortRangeStart(v int32) { + o.PortRangeStart = &v +} +// GetPortRangeEnd returns the PortRangeEnd field value if set, zero value otherwise. +func (o *FirewallruleProperties) GetPortRangeEnd() int32 { + if o == nil || IsNil(o.PortRangeEnd) { + var ret int32 + return ret + } + return *o.PortRangeEnd } -// GetPortRangeEndOk returns a tuple with the PortRangeEnd field value +// GetPortRangeEndOk returns a tuple with the PortRangeEnd 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 *FirewallruleProperties) GetPortRangeEndOk() (*int32, bool) { - if o == nil { + if o == nil || IsNil(o.PortRangeEnd) { return nil, false } - return o.PortRangeEnd, true } -// SetPortRangeEnd sets field value -func (o *FirewallruleProperties) SetPortRangeEnd(v int32) { - - o.PortRangeEnd = &v - -} - // HasPortRangeEnd returns a boolean if a field has been set. func (o *FirewallruleProperties) HasPortRangeEnd() bool { - if o != nil && o.PortRangeEnd != nil { + if o != nil && !IsNil(o.PortRangeEnd) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *FirewallruleProperties) GetType() *string { - if o == nil { - return nil - } - - return o.Type +// SetPortRangeEnd gets a reference to the given int32 and assigns it to the PortRangeEnd field. +func (o *FirewallruleProperties) SetPortRangeEnd(v int32) { + o.PortRangeEnd = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *FirewallruleProperties) 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 +// GetTypeOk returns a tuple with the Type 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 *FirewallruleProperties) GetTypeOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *FirewallruleProperties) SetType(v string) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *FirewallruleProperties) HasType() bool { - if o != nil && o.Type != nil { + 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 *FirewallruleProperties) SetType(v string) { + o.Type = &v +} + func (o FirewallruleProperties) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.Name != nil { - toSerialize["name"] = o.Name + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } + return json.Marshal(toSerialize) +} - if o.Protocol != nil { - toSerialize["protocol"] = o.Protocol +func (o FirewallruleProperties) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Name) { + toSerialize["name"] = o.Name } - - if o.SourceMac == &Nilstring { - toSerialize["sourceMac"] = nil - } else if o.SourceMac != nil { - toSerialize["sourceMac"] = o.SourceMac + toSerialize["protocol"] = o.Protocol + if o.SourceMac.IsSet() { + toSerialize["sourceMac"] = o.SourceMac.Get() } - - if o.IpVersion == &Nilstring { - toSerialize["ipVersion"] = nil - } else if o.IpVersion != nil { - toSerialize["ipVersion"] = o.IpVersion + if o.IpVersion.IsSet() { + toSerialize["ipVersion"] = o.IpVersion.Get() } - - if o.SourceIp == &Nilstring { - toSerialize["sourceIp"] = nil - } else if o.SourceIp != nil { - toSerialize["sourceIp"] = o.SourceIp + if o.SourceIp.IsSet() { + toSerialize["sourceIp"] = o.SourceIp.Get() } - - if o.TargetIp == &Nilstring { - toSerialize["targetIp"] = nil - } else if o.TargetIp != nil { - toSerialize["targetIp"] = o.TargetIp + if o.TargetIp.IsSet() { + toSerialize["targetIp"] = o.TargetIp.Get() } - - if o.IcmpCode == &Nilint32 { - toSerialize["icmpCode"] = nil - } else if o.IcmpCode != nil { - toSerialize["icmpCode"] = o.IcmpCode + if o.IcmpCode.IsSet() { + toSerialize["icmpCode"] = o.IcmpCode.Get() } - - if o.IcmpType == &Nilint32 { - toSerialize["icmpType"] = nil - } else if o.IcmpType != nil { - toSerialize["icmpType"] = o.IcmpType + if o.IcmpType.IsSet() { + toSerialize["icmpType"] = o.IcmpType.Get() } - if o.PortRangeStart != nil { + if !IsNil(o.PortRangeStart) { toSerialize["portRangeStart"] = o.PortRangeStart } - - if o.PortRangeEnd != nil { + if !IsNil(o.PortRangeEnd) { toSerialize["portRangeEnd"] = o.PortRangeEnd } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableFirewallruleProperties struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_flow_log.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_flow_log.go similarity index 65% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_flow_log.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_flow_log.go index 8e593e81c..3060bd694 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_flow_log.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_flow_log.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the FlowLog type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &FlowLog{} + // FlowLog struct for FlowLog type FlowLog struct { // The resource's unique identifier. @@ -23,7 +26,7 @@ type FlowLog struct { // The URL to the object representation (absolute path). Href *string `json:"href,omitempty"` Metadata *DatacenterElementMetadata `json:"metadata,omitempty"` - Properties *FlowLogProperties `json:"properties"` + Properties FlowLogProperties `json:"properties"` } // NewFlowLog instantiates a new FlowLog object @@ -33,7 +36,7 @@ type FlowLog struct { func NewFlowLog(properties FlowLogProperties) *FlowLog { this := FlowLog{} - this.Properties = &properties + this.Properties = properties return &this } @@ -46,219 +49,182 @@ func NewFlowLogWithDefaults() *FlowLog { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *FlowLog) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *FlowLog) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *FlowLog) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *FlowLog) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *FlowLog) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *FlowLog) GetType() *Type { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *FlowLog) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *FlowLog) GetType() Type { + if o == nil || IsNil(o.Type) { + var ret Type + return ret + } + return *o.Type } -// GetTypeOk returns a tuple with the Type field value +// GetTypeOk returns a tuple with the Type 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 *FlowLog) GetTypeOk() (*Type, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *FlowLog) SetType(v Type) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *FlowLog) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *FlowLog) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given Type and assigns it to the Type field. +func (o *FlowLog) SetType(v Type) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *FlowLog) 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 +// GetHrefOk returns a tuple with the Href 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 *FlowLog) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *FlowLog) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *FlowLog) HasHref() bool { - if o != nil && o.Href != nil { + if o != nil && !IsNil(o.Href) { return true } return false } -// GetMetadata returns the Metadata field value -// If the value is explicit nil, nil is returned -func (o *FlowLog) GetMetadata() *DatacenterElementMetadata { - if o == nil { - return nil - } - - return o.Metadata +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *FlowLog) SetHref(v string) { + o.Href = &v +} +// GetMetadata returns the Metadata field value if set, zero value otherwise. +func (o *FlowLog) GetMetadata() DatacenterElementMetadata { + if o == nil || IsNil(o.Metadata) { + var ret DatacenterElementMetadata + return ret + } + return *o.Metadata } -// GetMetadataOk returns a tuple with the Metadata field value +// GetMetadataOk returns a tuple with the Metadata 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 *FlowLog) GetMetadataOk() (*DatacenterElementMetadata, bool) { - if o == nil { + if o == nil || IsNil(o.Metadata) { return nil, false } - return o.Metadata, true } -// SetMetadata sets field value -func (o *FlowLog) SetMetadata(v DatacenterElementMetadata) { - - o.Metadata = &v - -} - // HasMetadata returns a boolean if a field has been set. func (o *FlowLog) HasMetadata() bool { - if o != nil && o.Metadata != nil { + if o != nil && !IsNil(o.Metadata) { return true } return false } +// SetMetadata gets a reference to the given DatacenterElementMetadata and assigns it to the Metadata field. +func (o *FlowLog) SetMetadata(v DatacenterElementMetadata) { + o.Metadata = &v +} + // GetProperties returns the Properties field value -// If the value is explicit nil, nil is returned -func (o *FlowLog) GetProperties() *FlowLogProperties { +func (o *FlowLog) GetProperties() FlowLogProperties { if o == nil { - return nil + var ret FlowLogProperties + return ret } return o.Properties - } // GetPropertiesOk returns a tuple with the Properties field value // 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 *FlowLog) GetPropertiesOk() (*FlowLogProperties, bool) { if o == nil { return nil, false } - - return o.Properties, true + return &o.Properties, true } // SetProperties sets field value func (o *FlowLog) SetProperties(v FlowLogProperties) { - - o.Properties = &v - + o.Properties = v } -// HasProperties returns a boolean if a field has been set. -func (o *FlowLog) HasProperties() bool { - if o != nil && o.Properties != nil { - return true +func (o FlowLog) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } - - return false + return json.Marshal(toSerialize) } -func (o FlowLog) MarshalJSON() ([]byte, error) { +func (o FlowLog) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Metadata != nil { + if !IsNil(o.Metadata) { toSerialize["metadata"] = o.Metadata } - - if o.Properties != nil { - toSerialize["properties"] = o.Properties - } - - return json.Marshal(toSerialize) + toSerialize["properties"] = o.Properties + return toSerialize, nil } type NullableFlowLog struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_flow_log_properties.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_flow_log_properties.go similarity index 66% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_flow_log_properties.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_flow_log_properties.go index b6297cdda..b640aac26 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_flow_log_properties.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_flow_log_properties.go @@ -14,16 +14,19 @@ import ( "encoding/json" ) +// checks if the FlowLogProperties type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &FlowLogProperties{} + // FlowLogProperties struct for FlowLogProperties type FlowLogProperties struct { // The resource name. - Name *string `json:"name"` + Name string `json:"name"` // Specifies the traffic action pattern. - Action *string `json:"action"` + Action string `json:"action"` // Specifies the traffic direction pattern. - Direction *string `json:"direction"` + Direction string `json:"direction"` // The bucket name of an existing IONOS Cloud Object storage bucket. - Bucket *string `json:"bucket"` + Bucket string `json:"bucket"` } // NewFlowLogProperties instantiates a new FlowLogProperties object @@ -33,10 +36,10 @@ type FlowLogProperties struct { func NewFlowLogProperties(name string, action string, direction string, bucket string) *FlowLogProperties { this := FlowLogProperties{} - this.Name = &name - this.Action = &action - this.Direction = &direction - this.Bucket = &bucket + this.Name = name + this.Action = action + this.Direction = direction + this.Bucket = bucket return &this } @@ -50,176 +53,116 @@ func NewFlowLogPropertiesWithDefaults() *FlowLogProperties { } // GetName returns the Name field value -// If the value is explicit nil, nil is returned -func (o *FlowLogProperties) GetName() *string { +func (o *FlowLogProperties) GetName() string { if o == nil { - return 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. -// NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *FlowLogProperties) GetNameOk() (*string, bool) { if o == nil { return nil, false } - - return o.Name, true + return &o.Name, true } // SetName sets field value func (o *FlowLogProperties) SetName(v string) { - - o.Name = &v - -} - -// HasName returns a boolean if a field has been set. -func (o *FlowLogProperties) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false + o.Name = v } // GetAction returns the Action field value -// If the value is explicit nil, nil is returned -func (o *FlowLogProperties) GetAction() *string { +func (o *FlowLogProperties) GetAction() string { if o == nil { - return nil + var ret string + return ret } return o.Action - } // GetActionOk returns a tuple with the Action field value // 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 *FlowLogProperties) GetActionOk() (*string, bool) { if o == nil { return nil, false } - - return o.Action, true + return &o.Action, true } // SetAction sets field value func (o *FlowLogProperties) SetAction(v string) { - - o.Action = &v - -} - -// HasAction returns a boolean if a field has been set. -func (o *FlowLogProperties) HasAction() bool { - if o != nil && o.Action != nil { - return true - } - - return false + o.Action = v } // GetDirection returns the Direction field value -// If the value is explicit nil, nil is returned -func (o *FlowLogProperties) GetDirection() *string { +func (o *FlowLogProperties) GetDirection() string { if o == nil { - return nil + var ret string + return ret } return o.Direction - } // GetDirectionOk returns a tuple with the Direction field value // 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 *FlowLogProperties) GetDirectionOk() (*string, bool) { if o == nil { return nil, false } - - return o.Direction, true + return &o.Direction, true } // SetDirection sets field value func (o *FlowLogProperties) SetDirection(v string) { - - o.Direction = &v - -} - -// HasDirection returns a boolean if a field has been set. -func (o *FlowLogProperties) HasDirection() bool { - if o != nil && o.Direction != nil { - return true - } - - return false + o.Direction = v } // GetBucket returns the Bucket field value -// If the value is explicit nil, nil is returned -func (o *FlowLogProperties) GetBucket() *string { +func (o *FlowLogProperties) GetBucket() string { if o == nil { - return nil + var ret string + return ret } return o.Bucket - } // GetBucketOk returns a tuple with the Bucket field value // 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 *FlowLogProperties) GetBucketOk() (*string, bool) { if o == nil { return nil, false } - - return o.Bucket, true + return &o.Bucket, true } // SetBucket sets field value func (o *FlowLogProperties) SetBucket(v string) { - - o.Bucket = &v - + o.Bucket = v } -// HasBucket returns a boolean if a field has been set. -func (o *FlowLogProperties) HasBucket() bool { - if o != nil && o.Bucket != nil { - return true +func (o FlowLogProperties) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } - - return false + return json.Marshal(toSerialize) } -func (o FlowLogProperties) MarshalJSON() ([]byte, error) { +func (o FlowLogProperties) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Name != nil { - toSerialize["name"] = o.Name - } - - if o.Action != nil { - toSerialize["action"] = o.Action - } - - if o.Direction != nil { - toSerialize["direction"] = o.Direction - } - - if o.Bucket != nil { - toSerialize["bucket"] = o.Bucket - } - - return json.Marshal(toSerialize) + toSerialize["name"] = o.Name + toSerialize["action"] = o.Action + toSerialize["direction"] = o.Direction + toSerialize["bucket"] = o.Bucket + return toSerialize, nil } type NullableFlowLogProperties struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_flow_log_put.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_flow_log_put.go similarity index 67% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_flow_log_put.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_flow_log_put.go index ec6e58e82..6a9a7dd16 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_flow_log_put.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_flow_log_put.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the FlowLogPut type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &FlowLogPut{} + // FlowLogPut struct for FlowLogPut type FlowLogPut struct { // The resource's unique identifier. @@ -21,8 +24,8 @@ type FlowLogPut struct { // The type of object that has been created. Type *Type `json:"type,omitempty"` // URL to the object representation (absolute path). - Href *string `json:"href,omitempty"` - Properties *FlowLogProperties `json:"properties"` + Href *string `json:"href,omitempty"` + Properties FlowLogProperties `json:"properties"` } // NewFlowLogPut instantiates a new FlowLogPut object @@ -32,7 +35,7 @@ type FlowLogPut struct { func NewFlowLogPut(properties FlowLogProperties) *FlowLogPut { this := FlowLogPut{} - this.Properties = &properties + this.Properties = properties return &this } @@ -45,177 +48,147 @@ func NewFlowLogPutWithDefaults() *FlowLogPut { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *FlowLogPut) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *FlowLogPut) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *FlowLogPut) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *FlowLogPut) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *FlowLogPut) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *FlowLogPut) GetType() *Type { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *FlowLogPut) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *FlowLogPut) GetType() Type { + if o == nil || IsNil(o.Type) { + var ret Type + return ret + } + return *o.Type } -// GetTypeOk returns a tuple with the Type field value +// GetTypeOk returns a tuple with the Type 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 *FlowLogPut) GetTypeOk() (*Type, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *FlowLogPut) SetType(v Type) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *FlowLogPut) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *FlowLogPut) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given Type and assigns it to the Type field. +func (o *FlowLogPut) SetType(v Type) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *FlowLogPut) 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 +// GetHrefOk returns a tuple with the Href 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 *FlowLogPut) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *FlowLogPut) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *FlowLogPut) HasHref() bool { - if o != nil && o.Href != nil { + 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 *FlowLogPut) SetHref(v string) { + o.Href = &v +} + // GetProperties returns the Properties field value -// If the value is explicit nil, nil is returned -func (o *FlowLogPut) GetProperties() *FlowLogProperties { +func (o *FlowLogPut) GetProperties() FlowLogProperties { if o == nil { - return nil + var ret FlowLogProperties + return ret } return o.Properties - } // GetPropertiesOk returns a tuple with the Properties field value // 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 *FlowLogPut) GetPropertiesOk() (*FlowLogProperties, bool) { if o == nil { return nil, false } - - return o.Properties, true + return &o.Properties, true } // SetProperties sets field value func (o *FlowLogPut) SetProperties(v FlowLogProperties) { - - o.Properties = &v - + o.Properties = v } -// HasProperties returns a boolean if a field has been set. -func (o *FlowLogPut) HasProperties() bool { - if o != nil && o.Properties != nil { - return true +func (o FlowLogPut) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } - - return false + return json.Marshal(toSerialize) } -func (o FlowLogPut) MarshalJSON() ([]byte, error) { +func (o FlowLogPut) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Properties != nil { - toSerialize["properties"] = o.Properties - } - - return json.Marshal(toSerialize) + toSerialize["properties"] = o.Properties + return toSerialize, nil } type NullableFlowLogPut struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_flow_logs.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_flow_logs.go similarity index 60% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_flow_logs.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_flow_logs.go index 226772ac5..58edfc025 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_flow_logs.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_flow_logs.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the FlowLogs type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &FlowLogs{} + // FlowLogs struct for FlowLogs type FlowLogs struct { // The resource's unique identifier. @@ -23,7 +26,7 @@ type FlowLogs struct { // The URL to the object representation (absolute path). Href *string `json:"href,omitempty"` // Array of items in the collection. - Items *[]FlowLog `json:"items,omitempty"` + Items []FlowLog `json:"items,omitempty"` // The offset (if specified in the request). Offset *float32 `json:"offset,omitempty"` // The limit (if specified in the request). @@ -49,303 +52,262 @@ func NewFlowLogsWithDefaults() *FlowLogs { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *FlowLogs) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *FlowLogs) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *FlowLogs) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *FlowLogs) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *FlowLogs) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *FlowLogs) GetType() *Type { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *FlowLogs) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *FlowLogs) GetType() Type { + if o == nil || IsNil(o.Type) { + var ret Type + return ret + } + return *o.Type } -// GetTypeOk returns a tuple with the Type field value +// GetTypeOk returns a tuple with the Type 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 *FlowLogs) GetTypeOk() (*Type, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *FlowLogs) SetType(v Type) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *FlowLogs) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *FlowLogs) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given Type and assigns it to the Type field. +func (o *FlowLogs) SetType(v Type) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *FlowLogs) 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 +// GetHrefOk returns a tuple with the Href 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 *FlowLogs) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *FlowLogs) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *FlowLogs) HasHref() bool { - if o != nil && o.Href != nil { + if o != nil && !IsNil(o.Href) { return true } return false } -// GetItems returns the Items field value -// If the value is explicit nil, nil is returned -func (o *FlowLogs) GetItems() *[]FlowLog { - if o == nil { - return nil - } +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *FlowLogs) SetHref(v string) { + o.Href = &v +} +// GetItems returns the Items field value if set, zero value otherwise. +func (o *FlowLogs) GetItems() []FlowLog { + if o == nil || IsNil(o.Items) { + var ret []FlowLog + return ret + } return o.Items - } -// GetItemsOk returns a tuple with the Items field value +// GetItemsOk returns a tuple with the Items 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 *FlowLogs) GetItemsOk() (*[]FlowLog, bool) { - if o == nil { +func (o *FlowLogs) GetItemsOk() ([]FlowLog, bool) { + if o == nil || IsNil(o.Items) { return nil, false } - return o.Items, true } -// SetItems sets field value -func (o *FlowLogs) SetItems(v []FlowLog) { - - o.Items = &v - -} - // HasItems returns a boolean if a field has been set. func (o *FlowLogs) HasItems() bool { - if o != nil && o.Items != nil { + if o != nil && !IsNil(o.Items) { return true } return false } -// GetOffset returns the Offset field value -// If the value is explicit nil, nil is returned -func (o *FlowLogs) GetOffset() *float32 { - if o == nil { - return nil - } - - return o.Offset +// SetItems gets a reference to the given []FlowLog and assigns it to the Items field. +func (o *FlowLogs) SetItems(v []FlowLog) { + o.Items = v +} +// GetOffset returns the Offset field value if set, zero value otherwise. +func (o *FlowLogs) GetOffset() float32 { + if o == nil || IsNil(o.Offset) { + var ret float32 + return ret + } + return *o.Offset } -// GetOffsetOk returns a tuple with the Offset field value +// GetOffsetOk returns a tuple with the Offset 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 *FlowLogs) GetOffsetOk() (*float32, bool) { - if o == nil { + if o == nil || IsNil(o.Offset) { return nil, false } - return o.Offset, true } -// SetOffset sets field value -func (o *FlowLogs) SetOffset(v float32) { - - o.Offset = &v - -} - // HasOffset returns a boolean if a field has been set. func (o *FlowLogs) HasOffset() bool { - if o != nil && o.Offset != nil { + if o != nil && !IsNil(o.Offset) { return true } return false } -// GetLimit returns the Limit field value -// If the value is explicit nil, nil is returned -func (o *FlowLogs) GetLimit() *float32 { - if o == nil { - return nil - } - - return o.Limit +// SetOffset gets a reference to the given float32 and assigns it to the Offset field. +func (o *FlowLogs) SetOffset(v float32) { + o.Offset = &v +} +// GetLimit returns the Limit field value if set, zero value otherwise. +func (o *FlowLogs) GetLimit() float32 { + if o == nil || IsNil(o.Limit) { + var ret float32 + return ret + } + return *o.Limit } -// GetLimitOk returns a tuple with the Limit field value +// GetLimitOk returns a tuple with the Limit 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 *FlowLogs) GetLimitOk() (*float32, bool) { - if o == nil { + if o == nil || IsNil(o.Limit) { return nil, false } - return o.Limit, true } -// SetLimit sets field value -func (o *FlowLogs) SetLimit(v float32) { - - o.Limit = &v - -} - // HasLimit returns a boolean if a field has been set. func (o *FlowLogs) HasLimit() bool { - if o != nil && o.Limit != nil { + if o != nil && !IsNil(o.Limit) { return true } return false } -// GetLinks returns the Links field value -// If the value is explicit nil, nil is returned -func (o *FlowLogs) GetLinks() *PaginationLinks { - if o == nil { - return nil - } - - return o.Links +// SetLimit gets a reference to the given float32 and assigns it to the Limit field. +func (o *FlowLogs) SetLimit(v float32) { + o.Limit = &v +} +// GetLinks returns the Links field value if set, zero value otherwise. +func (o *FlowLogs) GetLinks() PaginationLinks { + if o == nil || IsNil(o.Links) { + var ret PaginationLinks + return ret + } + return *o.Links } -// GetLinksOk returns a tuple with the Links field value +// GetLinksOk returns a tuple with the Links 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 *FlowLogs) GetLinksOk() (*PaginationLinks, bool) { - if o == nil { + if o == nil || IsNil(o.Links) { return nil, false } - return o.Links, true } -// SetLinks sets field value -func (o *FlowLogs) SetLinks(v PaginationLinks) { - - o.Links = &v - -} - // HasLinks returns a boolean if a field has been set. func (o *FlowLogs) HasLinks() bool { - if o != nil && o.Links != nil { + if o != nil && !IsNil(o.Links) { return true } return false } +// SetLinks gets a reference to the given PaginationLinks and assigns it to the Links field. +func (o *FlowLogs) SetLinks(v PaginationLinks) { + o.Links = &v +} + func (o FlowLogs) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o FlowLogs) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Items != nil { + if !IsNil(o.Items) { toSerialize["items"] = o.Items } - - if o.Offset != nil { + if !IsNil(o.Offset) { toSerialize["offset"] = o.Offset } - - if o.Limit != nil { + if !IsNil(o.Limit) { toSerialize["limit"] = o.Limit } - - if o.Links != nil { + if !IsNil(o.Links) { toSerialize["_links"] = o.Links } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableFlowLogs struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_group.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_group.go similarity index 63% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_group.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_group.go index 9b5502293..e94436701 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_group.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_group.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the Group type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Group{} + // Group struct for Group type Group struct { // The resource's unique identifier. @@ -21,9 +24,9 @@ type Group struct { // The type of the resource. Type *Type `json:"type,omitempty"` // URL to the object representation (absolute path). - Href *string `json:"href,omitempty"` - Properties *GroupProperties `json:"properties"` - Entities *GroupEntities `json:"entities,omitempty"` + Href *string `json:"href,omitempty"` + Properties GroupProperties `json:"properties"` + Entities *GroupEntities `json:"entities,omitempty"` } // NewGroup instantiates a new Group object @@ -33,7 +36,7 @@ type Group struct { func NewGroup(properties GroupProperties) *Group { this := Group{} - this.Properties = &properties + this.Properties = properties return &this } @@ -46,219 +49,182 @@ func NewGroupWithDefaults() *Group { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *Group) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *Group) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *Group) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *Group) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *Group) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *Group) GetType() *Type { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Group) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *Group) GetType() Type { + if o == nil || IsNil(o.Type) { + var ret Type + return ret + } + return *o.Type } -// GetTypeOk returns a tuple with the Type field value +// GetTypeOk returns a tuple with the Type 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 *Group) GetTypeOk() (*Type, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *Group) SetType(v Type) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *Group) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *Group) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given Type and assigns it to the Type field. +func (o *Group) SetType(v Type) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *Group) 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 +// GetHrefOk returns a tuple with the Href 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 *Group) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *Group) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *Group) HasHref() bool { - if o != nil && o.Href != nil { + 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 *Group) SetHref(v string) { + o.Href = &v +} + // GetProperties returns the Properties field value -// If the value is explicit nil, nil is returned -func (o *Group) GetProperties() *GroupProperties { +func (o *Group) GetProperties() GroupProperties { if o == nil { - return nil + var ret GroupProperties + return ret } return o.Properties - } // GetPropertiesOk returns a tuple with the Properties field value // 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 *Group) GetPropertiesOk() (*GroupProperties, bool) { if o == nil { return nil, false } - - return o.Properties, true + return &o.Properties, true } // SetProperties sets field value func (o *Group) SetProperties(v GroupProperties) { - - o.Properties = &v - + o.Properties = v } -// HasProperties returns a boolean if a field has been set. -func (o *Group) HasProperties() bool { - if o != nil && o.Properties != nil { - return true +// GetEntities returns the Entities field value if set, zero value otherwise. +func (o *Group) GetEntities() GroupEntities { + if o == nil || IsNil(o.Entities) { + var ret GroupEntities + return ret } - - return false -} - -// GetEntities returns the Entities field value -// If the value is explicit nil, nil is returned -func (o *Group) GetEntities() *GroupEntities { - if o == nil { - return nil - } - - return o.Entities - + return *o.Entities } -// GetEntitiesOk returns a tuple with the Entities field value +// GetEntitiesOk returns a tuple with the Entities 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 *Group) GetEntitiesOk() (*GroupEntities, bool) { - if o == nil { + if o == nil || IsNil(o.Entities) { return nil, false } - return o.Entities, true } -// SetEntities sets field value -func (o *Group) SetEntities(v GroupEntities) { - - o.Entities = &v - -} - // HasEntities returns a boolean if a field has been set. func (o *Group) HasEntities() bool { - if o != nil && o.Entities != nil { + if o != nil && !IsNil(o.Entities) { return true } return false } +// SetEntities gets a reference to the given GroupEntities and assigns it to the Entities field. +func (o *Group) SetEntities(v GroupEntities) { + o.Entities = &v +} + func (o Group) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Group) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Properties != nil { - toSerialize["properties"] = o.Properties - } - - if o.Entities != nil { + toSerialize["properties"] = o.Properties + if !IsNil(o.Entities) { toSerialize["entities"] = o.Entities } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableGroup struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_group_entities.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_group_entities.go similarity index 72% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_group_entities.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_group_entities.go index ae305181d..9976d90a1 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_group_entities.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_group_entities.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the GroupEntities type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GroupEntities{} + // GroupEntities struct for GroupEntities type GroupEntities struct { Users *GroupMembers `json:"users,omitempty"` @@ -38,93 +41,87 @@ func NewGroupEntitiesWithDefaults() *GroupEntities { return &this } -// GetUsers returns the Users field value -// If the value is explicit nil, nil is returned -func (o *GroupEntities) GetUsers() *GroupMembers { - if o == nil { - return nil +// GetUsers returns the Users field value if set, zero value otherwise. +func (o *GroupEntities) GetUsers() GroupMembers { + if o == nil || IsNil(o.Users) { + var ret GroupMembers + return ret } - - return o.Users - + return *o.Users } -// GetUsersOk returns a tuple with the Users field value +// GetUsersOk returns a tuple with the Users 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 *GroupEntities) GetUsersOk() (*GroupMembers, bool) { - if o == nil { + if o == nil || IsNil(o.Users) { return nil, false } - return o.Users, true } -// SetUsers sets field value -func (o *GroupEntities) SetUsers(v GroupMembers) { - - o.Users = &v - -} - // HasUsers returns a boolean if a field has been set. func (o *GroupEntities) HasUsers() bool { - if o != nil && o.Users != nil { + if o != nil && !IsNil(o.Users) { return true } return false } -// GetResources returns the Resources field value -// If the value is explicit nil, nil is returned -func (o *GroupEntities) GetResources() *ResourceGroups { - if o == nil { - return nil - } - - return o.Resources +// SetUsers gets a reference to the given GroupMembers and assigns it to the Users field. +func (o *GroupEntities) SetUsers(v GroupMembers) { + o.Users = &v +} +// GetResources returns the Resources field value if set, zero value otherwise. +func (o *GroupEntities) GetResources() ResourceGroups { + if o == nil || IsNil(o.Resources) { + var ret ResourceGroups + return ret + } + return *o.Resources } -// GetResourcesOk returns a tuple with the Resources field value +// GetResourcesOk returns a tuple with the Resources 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 *GroupEntities) GetResourcesOk() (*ResourceGroups, bool) { - if o == nil { + if o == nil || IsNil(o.Resources) { return nil, false } - return o.Resources, true } -// SetResources sets field value -func (o *GroupEntities) SetResources(v ResourceGroups) { - - o.Resources = &v - -} - // HasResources returns a boolean if a field has been set. func (o *GroupEntities) HasResources() bool { - if o != nil && o.Resources != nil { + if o != nil && !IsNil(o.Resources) { return true } return false } +// SetResources gets a reference to the given ResourceGroups and assigns it to the Resources field. +func (o *GroupEntities) SetResources(v ResourceGroups) { + o.Resources = &v +} + func (o GroupEntities) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o GroupEntities) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Users != nil { + if !IsNil(o.Users) { toSerialize["users"] = o.Users } - - if o.Resources != nil { + if !IsNil(o.Resources) { toSerialize["resources"] = o.Resources } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableGroupEntities struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_group_members.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_group_members.go similarity index 65% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_group_members.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_group_members.go index c361872a1..15c272b0c 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_group_members.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_group_members.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the GroupMembers type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GroupMembers{} + // GroupMembers struct for GroupMembers type GroupMembers struct { // The resource's unique identifier. @@ -23,7 +26,7 @@ type GroupMembers struct { // URL to the object representation (absolute path). Href *string `json:"href,omitempty"` // Array of items in the collection. - Items *[]User `json:"items,omitempty"` + Items []User `json:"items,omitempty"` } // NewGroupMembers instantiates a new GroupMembers object @@ -44,177 +47,157 @@ func NewGroupMembersWithDefaults() *GroupMembers { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *GroupMembers) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *GroupMembers) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *GroupMembers) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *GroupMembers) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *GroupMembers) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *GroupMembers) GetType() *Type { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *GroupMembers) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *GroupMembers) GetType() Type { + if o == nil || IsNil(o.Type) { + var ret Type + return ret + } + return *o.Type } -// GetTypeOk returns a tuple with the Type field value +// GetTypeOk returns a tuple with the Type 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 *GroupMembers) GetTypeOk() (*Type, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *GroupMembers) SetType(v Type) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *GroupMembers) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *GroupMembers) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given Type and assigns it to the Type field. +func (o *GroupMembers) SetType(v Type) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *GroupMembers) 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 +// GetHrefOk returns a tuple with the Href 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 *GroupMembers) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *GroupMembers) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *GroupMembers) HasHref() bool { - if o != nil && o.Href != nil { + if o != nil && !IsNil(o.Href) { return true } return false } -// GetItems returns the Items field value -// If the value is explicit nil, nil is returned -func (o *GroupMembers) GetItems() *[]User { - if o == nil { - return nil - } +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *GroupMembers) SetHref(v string) { + o.Href = &v +} +// GetItems returns the Items field value if set, zero value otherwise. +func (o *GroupMembers) GetItems() []User { + if o == nil || IsNil(o.Items) { + var ret []User + return ret + } return o.Items - } -// GetItemsOk returns a tuple with the Items field value +// GetItemsOk returns a tuple with the Items 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 *GroupMembers) GetItemsOk() (*[]User, bool) { - if o == nil { +func (o *GroupMembers) GetItemsOk() ([]User, bool) { + if o == nil || IsNil(o.Items) { return nil, false } - return o.Items, true } -// SetItems sets field value -func (o *GroupMembers) SetItems(v []User) { - - o.Items = &v - -} - // HasItems returns a boolean if a field has been set. func (o *GroupMembers) HasItems() bool { - if o != nil && o.Items != nil { + if o != nil && !IsNil(o.Items) { return true } return false } +// SetItems gets a reference to the given []User and assigns it to the Items field. +func (o *GroupMembers) SetItems(v []User) { + o.Items = v +} + func (o GroupMembers) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o GroupMembers) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Items != nil { + if !IsNil(o.Items) { toSerialize["items"] = o.Items } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableGroupMembers struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_group_properties.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_group_properties.go similarity index 59% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_group_properties.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_group_properties.go index 830070bf3..6a0a59ad8 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_group_properties.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_group_properties.go @@ -14,12 +14,15 @@ import ( "encoding/json" ) +// checks if the GroupProperties type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GroupProperties{} + // GroupProperties struct for GroupProperties type GroupProperties struct { // The name of the resource. Name *string `json:"name,omitempty"` // Create data center privilege. - CreateDataCenter *bool `json:"createDataCenter,omitempty"` + CreateDatacenter *bool `json:"createDatacenter,omitempty"` // Create snapshot privilege. CreateSnapshot *bool `json:"createSnapshot,omitempty"` // Reserve IP block privilege. @@ -88,1101 +91,927 @@ func NewGroupPropertiesWithDefaults() *GroupProperties { return &this } -// GetName returns the Name field value -// If the value is explicit nil, nil is returned -func (o *GroupProperties) GetName() *string { - if o == nil { - return nil +// GetName returns the Name field value if set, zero value otherwise. +func (o *GroupProperties) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret } - - return o.Name - + return *o.Name } -// GetNameOk returns a tuple with the Name field value +// GetNameOk returns a tuple with the Name 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 *GroupProperties) GetNameOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Name) { return nil, false } - return o.Name, true } -// SetName sets field value -func (o *GroupProperties) SetName(v string) { - - o.Name = &v - -} - // HasName returns a boolean if a field has been set. func (o *GroupProperties) HasName() bool { - if o != nil && o.Name != nil { + if o != nil && !IsNil(o.Name) { return true } return false } -// GetCreateDataCenter returns the CreateDataCenter field value -// If the value is explicit nil, nil is returned -func (o *GroupProperties) GetCreateDataCenter() *bool { - if o == nil { - return nil - } - - return o.CreateDataCenter +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *GroupProperties) SetName(v string) { + o.Name = &v +} +// GetCreateDatacenter returns the CreateDatacenter field value if set, zero value otherwise. +func (o *GroupProperties) GetCreateDatacenter() bool { + if o == nil || IsNil(o.CreateDatacenter) { + var ret bool + return ret + } + return *o.CreateDatacenter } -// GetCreateDataCenterOk returns a tuple with the CreateDataCenter field value +// GetCreateDatacenterOk returns a tuple with the CreateDatacenter 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 *GroupProperties) GetCreateDataCenterOk() (*bool, bool) { - if o == nil { +func (o *GroupProperties) GetCreateDatacenterOk() (*bool, bool) { + if o == nil || IsNil(o.CreateDatacenter) { return nil, false } - - return o.CreateDataCenter, true + return o.CreateDatacenter, true } -// SetCreateDataCenter sets field value -func (o *GroupProperties) SetCreateDataCenter(v bool) { - - o.CreateDataCenter = &v - -} - -// HasCreateDataCenter returns a boolean if a field has been set. -func (o *GroupProperties) HasCreateDataCenter() bool { - if o != nil && o.CreateDataCenter != nil { +// HasCreateDatacenter returns a boolean if a field has been set. +func (o *GroupProperties) HasCreateDatacenter() bool { + if o != nil && !IsNil(o.CreateDatacenter) { return true } return false } -// GetCreateSnapshot returns the CreateSnapshot field value -// If the value is explicit nil, nil is returned -func (o *GroupProperties) GetCreateSnapshot() *bool { - if o == nil { - return nil - } - - return o.CreateSnapshot +// SetCreateDatacenter gets a reference to the given bool and assigns it to the CreateDatacenter field. +func (o *GroupProperties) SetCreateDatacenter(v bool) { + o.CreateDatacenter = &v +} +// GetCreateSnapshot returns the CreateSnapshot field value if set, zero value otherwise. +func (o *GroupProperties) GetCreateSnapshot() bool { + if o == nil || IsNil(o.CreateSnapshot) { + var ret bool + return ret + } + return *o.CreateSnapshot } -// GetCreateSnapshotOk returns a tuple with the CreateSnapshot field value +// GetCreateSnapshotOk returns a tuple with the CreateSnapshot 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 *GroupProperties) GetCreateSnapshotOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.CreateSnapshot) { return nil, false } - return o.CreateSnapshot, true } -// SetCreateSnapshot sets field value -func (o *GroupProperties) SetCreateSnapshot(v bool) { - - o.CreateSnapshot = &v - -} - // HasCreateSnapshot returns a boolean if a field has been set. func (o *GroupProperties) HasCreateSnapshot() bool { - if o != nil && o.CreateSnapshot != nil { + if o != nil && !IsNil(o.CreateSnapshot) { return true } return false } -// GetReserveIp returns the ReserveIp field value -// If the value is explicit nil, nil is returned -func (o *GroupProperties) GetReserveIp() *bool { - if o == nil { - return nil - } - - return o.ReserveIp +// SetCreateSnapshot gets a reference to the given bool and assigns it to the CreateSnapshot field. +func (o *GroupProperties) SetCreateSnapshot(v bool) { + o.CreateSnapshot = &v +} +// GetReserveIp returns the ReserveIp field value if set, zero value otherwise. +func (o *GroupProperties) GetReserveIp() bool { + if o == nil || IsNil(o.ReserveIp) { + var ret bool + return ret + } + return *o.ReserveIp } -// GetReserveIpOk returns a tuple with the ReserveIp field value +// GetReserveIpOk returns a tuple with the ReserveIp 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 *GroupProperties) GetReserveIpOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.ReserveIp) { return nil, false } - return o.ReserveIp, true } -// SetReserveIp sets field value -func (o *GroupProperties) SetReserveIp(v bool) { - - o.ReserveIp = &v - -} - // HasReserveIp returns a boolean if a field has been set. func (o *GroupProperties) HasReserveIp() bool { - if o != nil && o.ReserveIp != nil { + if o != nil && !IsNil(o.ReserveIp) { return true } return false } -// GetAccessActivityLog returns the AccessActivityLog field value -// If the value is explicit nil, nil is returned -func (o *GroupProperties) GetAccessActivityLog() *bool { - if o == nil { - return nil - } - - return o.AccessActivityLog +// SetReserveIp gets a reference to the given bool and assigns it to the ReserveIp field. +func (o *GroupProperties) SetReserveIp(v bool) { + o.ReserveIp = &v +} +// GetAccessActivityLog returns the AccessActivityLog field value if set, zero value otherwise. +func (o *GroupProperties) GetAccessActivityLog() bool { + if o == nil || IsNil(o.AccessActivityLog) { + var ret bool + return ret + } + return *o.AccessActivityLog } -// GetAccessActivityLogOk returns a tuple with the AccessActivityLog field value +// GetAccessActivityLogOk returns a tuple with the AccessActivityLog 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 *GroupProperties) GetAccessActivityLogOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.AccessActivityLog) { return nil, false } - return o.AccessActivityLog, true } -// SetAccessActivityLog sets field value -func (o *GroupProperties) SetAccessActivityLog(v bool) { - - o.AccessActivityLog = &v - -} - // HasAccessActivityLog returns a boolean if a field has been set. func (o *GroupProperties) HasAccessActivityLog() bool { - if o != nil && o.AccessActivityLog != nil { + if o != nil && !IsNil(o.AccessActivityLog) { return true } return false } -// GetCreatePcc returns the CreatePcc field value -// If the value is explicit nil, nil is returned -func (o *GroupProperties) GetCreatePcc() *bool { - if o == nil { - return nil - } - - return o.CreatePcc +// SetAccessActivityLog gets a reference to the given bool and assigns it to the AccessActivityLog field. +func (o *GroupProperties) SetAccessActivityLog(v bool) { + o.AccessActivityLog = &v +} +// GetCreatePcc returns the CreatePcc field value if set, zero value otherwise. +func (o *GroupProperties) GetCreatePcc() bool { + if o == nil || IsNil(o.CreatePcc) { + var ret bool + return ret + } + return *o.CreatePcc } -// GetCreatePccOk returns a tuple with the CreatePcc field value +// GetCreatePccOk returns a tuple with the CreatePcc 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 *GroupProperties) GetCreatePccOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.CreatePcc) { return nil, false } - return o.CreatePcc, true } -// SetCreatePcc sets field value -func (o *GroupProperties) SetCreatePcc(v bool) { - - o.CreatePcc = &v - -} - // HasCreatePcc returns a boolean if a field has been set. func (o *GroupProperties) HasCreatePcc() bool { - if o != nil && o.CreatePcc != nil { + if o != nil && !IsNil(o.CreatePcc) { return true } return false } -// GetS3Privilege returns the S3Privilege field value -// If the value is explicit nil, nil is returned -func (o *GroupProperties) GetS3Privilege() *bool { - if o == nil { - return nil - } - - return o.S3Privilege +// SetCreatePcc gets a reference to the given bool and assigns it to the CreatePcc field. +func (o *GroupProperties) SetCreatePcc(v bool) { + o.CreatePcc = &v +} +// GetS3Privilege returns the S3Privilege field value if set, zero value otherwise. +func (o *GroupProperties) GetS3Privilege() bool { + if o == nil || IsNil(o.S3Privilege) { + var ret bool + return ret + } + return *o.S3Privilege } -// GetS3PrivilegeOk returns a tuple with the S3Privilege field value +// GetS3PrivilegeOk returns a tuple with the S3Privilege 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 *GroupProperties) GetS3PrivilegeOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.S3Privilege) { return nil, false } - return o.S3Privilege, true } -// SetS3Privilege sets field value -func (o *GroupProperties) SetS3Privilege(v bool) { - - o.S3Privilege = &v - -} - // HasS3Privilege returns a boolean if a field has been set. func (o *GroupProperties) HasS3Privilege() bool { - if o != nil && o.S3Privilege != nil { + if o != nil && !IsNil(o.S3Privilege) { return true } return false } -// GetCreateBackupUnit returns the CreateBackupUnit field value -// If the value is explicit nil, nil is returned -func (o *GroupProperties) GetCreateBackupUnit() *bool { - if o == nil { - return nil - } - - return o.CreateBackupUnit +// SetS3Privilege gets a reference to the given bool and assigns it to the S3Privilege field. +func (o *GroupProperties) SetS3Privilege(v bool) { + o.S3Privilege = &v +} +// GetCreateBackupUnit returns the CreateBackupUnit field value if set, zero value otherwise. +func (o *GroupProperties) GetCreateBackupUnit() bool { + if o == nil || IsNil(o.CreateBackupUnit) { + var ret bool + return ret + } + return *o.CreateBackupUnit } -// GetCreateBackupUnitOk returns a tuple with the CreateBackupUnit field value +// GetCreateBackupUnitOk returns a tuple with the CreateBackupUnit 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 *GroupProperties) GetCreateBackupUnitOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.CreateBackupUnit) { return nil, false } - return o.CreateBackupUnit, true } -// SetCreateBackupUnit sets field value -func (o *GroupProperties) SetCreateBackupUnit(v bool) { - - o.CreateBackupUnit = &v - -} - // HasCreateBackupUnit returns a boolean if a field has been set. func (o *GroupProperties) HasCreateBackupUnit() bool { - if o != nil && o.CreateBackupUnit != nil { + if o != nil && !IsNil(o.CreateBackupUnit) { return true } return false } -// GetCreateInternetAccess returns the CreateInternetAccess field value -// If the value is explicit nil, nil is returned -func (o *GroupProperties) GetCreateInternetAccess() *bool { - if o == nil { - return nil - } - - return o.CreateInternetAccess +// SetCreateBackupUnit gets a reference to the given bool and assigns it to the CreateBackupUnit field. +func (o *GroupProperties) SetCreateBackupUnit(v bool) { + o.CreateBackupUnit = &v +} +// GetCreateInternetAccess returns the CreateInternetAccess field value if set, zero value otherwise. +func (o *GroupProperties) GetCreateInternetAccess() bool { + if o == nil || IsNil(o.CreateInternetAccess) { + var ret bool + return ret + } + return *o.CreateInternetAccess } -// GetCreateInternetAccessOk returns a tuple with the CreateInternetAccess field value +// GetCreateInternetAccessOk returns a tuple with the CreateInternetAccess 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 *GroupProperties) GetCreateInternetAccessOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.CreateInternetAccess) { return nil, false } - return o.CreateInternetAccess, true } -// SetCreateInternetAccess sets field value -func (o *GroupProperties) SetCreateInternetAccess(v bool) { - - o.CreateInternetAccess = &v - -} - // HasCreateInternetAccess returns a boolean if a field has been set. func (o *GroupProperties) HasCreateInternetAccess() bool { - if o != nil && o.CreateInternetAccess != nil { + if o != nil && !IsNil(o.CreateInternetAccess) { return true } return false } -// GetCreateK8sCluster returns the CreateK8sCluster field value -// If the value is explicit nil, nil is returned -func (o *GroupProperties) GetCreateK8sCluster() *bool { - if o == nil { - return nil - } - - return o.CreateK8sCluster +// SetCreateInternetAccess gets a reference to the given bool and assigns it to the CreateInternetAccess field. +func (o *GroupProperties) SetCreateInternetAccess(v bool) { + o.CreateInternetAccess = &v +} +// GetCreateK8sCluster returns the CreateK8sCluster field value if set, zero value otherwise. +func (o *GroupProperties) GetCreateK8sCluster() bool { + if o == nil || IsNil(o.CreateK8sCluster) { + var ret bool + return ret + } + return *o.CreateK8sCluster } -// GetCreateK8sClusterOk returns a tuple with the CreateK8sCluster field value +// GetCreateK8sClusterOk returns a tuple with the CreateK8sCluster 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 *GroupProperties) GetCreateK8sClusterOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.CreateK8sCluster) { return nil, false } - return o.CreateK8sCluster, true } -// SetCreateK8sCluster sets field value -func (o *GroupProperties) SetCreateK8sCluster(v bool) { - - o.CreateK8sCluster = &v - -} - // HasCreateK8sCluster returns a boolean if a field has been set. func (o *GroupProperties) HasCreateK8sCluster() bool { - if o != nil && o.CreateK8sCluster != nil { + if o != nil && !IsNil(o.CreateK8sCluster) { return true } return false } -// GetCreateFlowLog returns the CreateFlowLog field value -// If the value is explicit nil, nil is returned -func (o *GroupProperties) GetCreateFlowLog() *bool { - if o == nil { - return nil - } - - return o.CreateFlowLog +// SetCreateK8sCluster gets a reference to the given bool and assigns it to the CreateK8sCluster field. +func (o *GroupProperties) SetCreateK8sCluster(v bool) { + o.CreateK8sCluster = &v +} +// GetCreateFlowLog returns the CreateFlowLog field value if set, zero value otherwise. +func (o *GroupProperties) GetCreateFlowLog() bool { + if o == nil || IsNil(o.CreateFlowLog) { + var ret bool + return ret + } + return *o.CreateFlowLog } -// GetCreateFlowLogOk returns a tuple with the CreateFlowLog field value +// GetCreateFlowLogOk returns a tuple with the CreateFlowLog 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 *GroupProperties) GetCreateFlowLogOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.CreateFlowLog) { return nil, false } - return o.CreateFlowLog, true } -// SetCreateFlowLog sets field value -func (o *GroupProperties) SetCreateFlowLog(v bool) { - - o.CreateFlowLog = &v - -} - // HasCreateFlowLog returns a boolean if a field has been set. func (o *GroupProperties) HasCreateFlowLog() bool { - if o != nil && o.CreateFlowLog != nil { + if o != nil && !IsNil(o.CreateFlowLog) { return true } return false } -// GetAccessAndManageMonitoring returns the AccessAndManageMonitoring field value -// If the value is explicit nil, nil is returned -func (o *GroupProperties) GetAccessAndManageMonitoring() *bool { - if o == nil { - return nil - } - - return o.AccessAndManageMonitoring +// SetCreateFlowLog gets a reference to the given bool and assigns it to the CreateFlowLog field. +func (o *GroupProperties) SetCreateFlowLog(v bool) { + o.CreateFlowLog = &v +} +// GetAccessAndManageMonitoring returns the AccessAndManageMonitoring field value if set, zero value otherwise. +func (o *GroupProperties) GetAccessAndManageMonitoring() bool { + if o == nil || IsNil(o.AccessAndManageMonitoring) { + var ret bool + return ret + } + return *o.AccessAndManageMonitoring } -// GetAccessAndManageMonitoringOk returns a tuple with the AccessAndManageMonitoring field value +// GetAccessAndManageMonitoringOk returns a tuple with the AccessAndManageMonitoring 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 *GroupProperties) GetAccessAndManageMonitoringOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.AccessAndManageMonitoring) { return nil, false } - return o.AccessAndManageMonitoring, true } -// SetAccessAndManageMonitoring sets field value -func (o *GroupProperties) SetAccessAndManageMonitoring(v bool) { - - o.AccessAndManageMonitoring = &v - -} - // HasAccessAndManageMonitoring returns a boolean if a field has been set. func (o *GroupProperties) HasAccessAndManageMonitoring() bool { - if o != nil && o.AccessAndManageMonitoring != nil { + if o != nil && !IsNil(o.AccessAndManageMonitoring) { return true } return false } -// GetAccessAndManageCertificates returns the AccessAndManageCertificates field value -// If the value is explicit nil, nil is returned -func (o *GroupProperties) GetAccessAndManageCertificates() *bool { - if o == nil { - return nil - } - - return o.AccessAndManageCertificates +// SetAccessAndManageMonitoring gets a reference to the given bool and assigns it to the AccessAndManageMonitoring field. +func (o *GroupProperties) SetAccessAndManageMonitoring(v bool) { + o.AccessAndManageMonitoring = &v +} +// GetAccessAndManageCertificates returns the AccessAndManageCertificates field value if set, zero value otherwise. +func (o *GroupProperties) GetAccessAndManageCertificates() bool { + if o == nil || IsNil(o.AccessAndManageCertificates) { + var ret bool + return ret + } + return *o.AccessAndManageCertificates } -// GetAccessAndManageCertificatesOk returns a tuple with the AccessAndManageCertificates field value +// GetAccessAndManageCertificatesOk returns a tuple with the AccessAndManageCertificates 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 *GroupProperties) GetAccessAndManageCertificatesOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.AccessAndManageCertificates) { return nil, false } - return o.AccessAndManageCertificates, true } -// SetAccessAndManageCertificates sets field value -func (o *GroupProperties) SetAccessAndManageCertificates(v bool) { - - o.AccessAndManageCertificates = &v - -} - // HasAccessAndManageCertificates returns a boolean if a field has been set. func (o *GroupProperties) HasAccessAndManageCertificates() bool { - if o != nil && o.AccessAndManageCertificates != nil { + if o != nil && !IsNil(o.AccessAndManageCertificates) { return true } return false } -// GetManageDBaaS returns the ManageDBaaS field value -// If the value is explicit nil, nil is returned -func (o *GroupProperties) GetManageDBaaS() *bool { - if o == nil { - return nil - } - - return o.ManageDBaaS +// SetAccessAndManageCertificates gets a reference to the given bool and assigns it to the AccessAndManageCertificates field. +func (o *GroupProperties) SetAccessAndManageCertificates(v bool) { + o.AccessAndManageCertificates = &v +} +// GetManageDBaaS returns the ManageDBaaS field value if set, zero value otherwise. +func (o *GroupProperties) GetManageDBaaS() bool { + if o == nil || IsNil(o.ManageDBaaS) { + var ret bool + return ret + } + return *o.ManageDBaaS } -// GetManageDBaaSOk returns a tuple with the ManageDBaaS field value +// GetManageDBaaSOk returns a tuple with the ManageDBaaS 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 *GroupProperties) GetManageDBaaSOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.ManageDBaaS) { return nil, false } - return o.ManageDBaaS, true } -// SetManageDBaaS sets field value -func (o *GroupProperties) SetManageDBaaS(v bool) { - - o.ManageDBaaS = &v - -} - // HasManageDBaaS returns a boolean if a field has been set. func (o *GroupProperties) HasManageDBaaS() bool { - if o != nil && o.ManageDBaaS != nil { + if o != nil && !IsNil(o.ManageDBaaS) { return true } return false } -// GetAccessAndManageDns returns the AccessAndManageDns field value -// If the value is explicit nil, nil is returned -func (o *GroupProperties) GetAccessAndManageDns() *bool { - if o == nil { - return nil - } - - return o.AccessAndManageDns +// SetManageDBaaS gets a reference to the given bool and assigns it to the ManageDBaaS field. +func (o *GroupProperties) SetManageDBaaS(v bool) { + o.ManageDBaaS = &v +} +// GetAccessAndManageDns returns the AccessAndManageDns field value if set, zero value otherwise. +func (o *GroupProperties) GetAccessAndManageDns() bool { + if o == nil || IsNil(o.AccessAndManageDns) { + var ret bool + return ret + } + return *o.AccessAndManageDns } -// GetAccessAndManageDnsOk returns a tuple with the AccessAndManageDns field value +// GetAccessAndManageDnsOk returns a tuple with the AccessAndManageDns 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 *GroupProperties) GetAccessAndManageDnsOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.AccessAndManageDns) { return nil, false } - return o.AccessAndManageDns, true } -// SetAccessAndManageDns sets field value -func (o *GroupProperties) SetAccessAndManageDns(v bool) { - - o.AccessAndManageDns = &v - -} - // HasAccessAndManageDns returns a boolean if a field has been set. func (o *GroupProperties) HasAccessAndManageDns() bool { - if o != nil && o.AccessAndManageDns != nil { + if o != nil && !IsNil(o.AccessAndManageDns) { return true } return false } -// GetManageRegistry returns the ManageRegistry field value -// If the value is explicit nil, nil is returned -func (o *GroupProperties) GetManageRegistry() *bool { - if o == nil { - return nil - } - - return o.ManageRegistry +// SetAccessAndManageDns gets a reference to the given bool and assigns it to the AccessAndManageDns field. +func (o *GroupProperties) SetAccessAndManageDns(v bool) { + o.AccessAndManageDns = &v +} +// GetManageRegistry returns the ManageRegistry field value if set, zero value otherwise. +func (o *GroupProperties) GetManageRegistry() bool { + if o == nil || IsNil(o.ManageRegistry) { + var ret bool + return ret + } + return *o.ManageRegistry } -// GetManageRegistryOk returns a tuple with the ManageRegistry field value +// GetManageRegistryOk returns a tuple with the ManageRegistry 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 *GroupProperties) GetManageRegistryOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.ManageRegistry) { return nil, false } - return o.ManageRegistry, true } -// SetManageRegistry sets field value -func (o *GroupProperties) SetManageRegistry(v bool) { - - o.ManageRegistry = &v - -} - // HasManageRegistry returns a boolean if a field has been set. func (o *GroupProperties) HasManageRegistry() bool { - if o != nil && o.ManageRegistry != nil { + if o != nil && !IsNil(o.ManageRegistry) { return true } return false } -// GetManageDataplatform returns the ManageDataplatform field value -// If the value is explicit nil, nil is returned -func (o *GroupProperties) GetManageDataplatform() *bool { - if o == nil { - return nil - } - - return o.ManageDataplatform +// SetManageRegistry gets a reference to the given bool and assigns it to the ManageRegistry field. +func (o *GroupProperties) SetManageRegistry(v bool) { + o.ManageRegistry = &v +} +// GetManageDataplatform returns the ManageDataplatform field value if set, zero value otherwise. +func (o *GroupProperties) GetManageDataplatform() bool { + if o == nil || IsNil(o.ManageDataplatform) { + var ret bool + return ret + } + return *o.ManageDataplatform } -// GetManageDataplatformOk returns a tuple with the ManageDataplatform field value +// GetManageDataplatformOk returns a tuple with the ManageDataplatform 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 *GroupProperties) GetManageDataplatformOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.ManageDataplatform) { return nil, false } - return o.ManageDataplatform, true } -// SetManageDataplatform sets field value -func (o *GroupProperties) SetManageDataplatform(v bool) { - - o.ManageDataplatform = &v - -} - // HasManageDataplatform returns a boolean if a field has been set. func (o *GroupProperties) HasManageDataplatform() bool { - if o != nil && o.ManageDataplatform != nil { + if o != nil && !IsNil(o.ManageDataplatform) { return true } return false } -// GetAccessAndManageLogging returns the AccessAndManageLogging field value -// If the value is explicit nil, nil is returned -func (o *GroupProperties) GetAccessAndManageLogging() *bool { - if o == nil { - return nil - } - - return o.AccessAndManageLogging +// SetManageDataplatform gets a reference to the given bool and assigns it to the ManageDataplatform field. +func (o *GroupProperties) SetManageDataplatform(v bool) { + o.ManageDataplatform = &v +} +// GetAccessAndManageLogging returns the AccessAndManageLogging field value if set, zero value otherwise. +func (o *GroupProperties) GetAccessAndManageLogging() bool { + if o == nil || IsNil(o.AccessAndManageLogging) { + var ret bool + return ret + } + return *o.AccessAndManageLogging } -// GetAccessAndManageLoggingOk returns a tuple with the AccessAndManageLogging field value +// GetAccessAndManageLoggingOk returns a tuple with the AccessAndManageLogging 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 *GroupProperties) GetAccessAndManageLoggingOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.AccessAndManageLogging) { return nil, false } - return o.AccessAndManageLogging, true } -// SetAccessAndManageLogging sets field value -func (o *GroupProperties) SetAccessAndManageLogging(v bool) { - - o.AccessAndManageLogging = &v - -} - // HasAccessAndManageLogging returns a boolean if a field has been set. func (o *GroupProperties) HasAccessAndManageLogging() bool { - if o != nil && o.AccessAndManageLogging != nil { + if o != nil && !IsNil(o.AccessAndManageLogging) { return true } return false } -// GetAccessAndManageCdn returns the AccessAndManageCdn field value -// If the value is explicit nil, nil is returned -func (o *GroupProperties) GetAccessAndManageCdn() *bool { - if o == nil { - return nil - } - - return o.AccessAndManageCdn +// SetAccessAndManageLogging gets a reference to the given bool and assigns it to the AccessAndManageLogging field. +func (o *GroupProperties) SetAccessAndManageLogging(v bool) { + o.AccessAndManageLogging = &v +} +// GetAccessAndManageCdn returns the AccessAndManageCdn field value if set, zero value otherwise. +func (o *GroupProperties) GetAccessAndManageCdn() bool { + if o == nil || IsNil(o.AccessAndManageCdn) { + var ret bool + return ret + } + return *o.AccessAndManageCdn } -// GetAccessAndManageCdnOk returns a tuple with the AccessAndManageCdn field value +// GetAccessAndManageCdnOk returns a tuple with the AccessAndManageCdn 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 *GroupProperties) GetAccessAndManageCdnOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.AccessAndManageCdn) { return nil, false } - return o.AccessAndManageCdn, true } -// SetAccessAndManageCdn sets field value -func (o *GroupProperties) SetAccessAndManageCdn(v bool) { - - o.AccessAndManageCdn = &v - -} - // HasAccessAndManageCdn returns a boolean if a field has been set. func (o *GroupProperties) HasAccessAndManageCdn() bool { - if o != nil && o.AccessAndManageCdn != nil { + if o != nil && !IsNil(o.AccessAndManageCdn) { return true } return false } -// GetAccessAndManageVpn returns the AccessAndManageVpn field value -// If the value is explicit nil, nil is returned -func (o *GroupProperties) GetAccessAndManageVpn() *bool { - if o == nil { - return nil - } - - return o.AccessAndManageVpn +// SetAccessAndManageCdn gets a reference to the given bool and assigns it to the AccessAndManageCdn field. +func (o *GroupProperties) SetAccessAndManageCdn(v bool) { + o.AccessAndManageCdn = &v +} +// GetAccessAndManageVpn returns the AccessAndManageVpn field value if set, zero value otherwise. +func (o *GroupProperties) GetAccessAndManageVpn() bool { + if o == nil || IsNil(o.AccessAndManageVpn) { + var ret bool + return ret + } + return *o.AccessAndManageVpn } -// GetAccessAndManageVpnOk returns a tuple with the AccessAndManageVpn field value +// GetAccessAndManageVpnOk returns a tuple with the AccessAndManageVpn 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 *GroupProperties) GetAccessAndManageVpnOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.AccessAndManageVpn) { return nil, false } - return o.AccessAndManageVpn, true } -// SetAccessAndManageVpn sets field value -func (o *GroupProperties) SetAccessAndManageVpn(v bool) { - - o.AccessAndManageVpn = &v - -} - // HasAccessAndManageVpn returns a boolean if a field has been set. func (o *GroupProperties) HasAccessAndManageVpn() bool { - if o != nil && o.AccessAndManageVpn != nil { + if o != nil && !IsNil(o.AccessAndManageVpn) { return true } return false } -// GetAccessAndManageApiGateway returns the AccessAndManageApiGateway field value -// If the value is explicit nil, nil is returned -func (o *GroupProperties) GetAccessAndManageApiGateway() *bool { - if o == nil { - return nil - } - - return o.AccessAndManageApiGateway +// SetAccessAndManageVpn gets a reference to the given bool and assigns it to the AccessAndManageVpn field. +func (o *GroupProperties) SetAccessAndManageVpn(v bool) { + o.AccessAndManageVpn = &v +} +// GetAccessAndManageApiGateway returns the AccessAndManageApiGateway field value if set, zero value otherwise. +func (o *GroupProperties) GetAccessAndManageApiGateway() bool { + if o == nil || IsNil(o.AccessAndManageApiGateway) { + var ret bool + return ret + } + return *o.AccessAndManageApiGateway } -// GetAccessAndManageApiGatewayOk returns a tuple with the AccessAndManageApiGateway field value +// GetAccessAndManageApiGatewayOk returns a tuple with the AccessAndManageApiGateway 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 *GroupProperties) GetAccessAndManageApiGatewayOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.AccessAndManageApiGateway) { return nil, false } - return o.AccessAndManageApiGateway, true } -// SetAccessAndManageApiGateway sets field value -func (o *GroupProperties) SetAccessAndManageApiGateway(v bool) { - - o.AccessAndManageApiGateway = &v - -} - // HasAccessAndManageApiGateway returns a boolean if a field has been set. func (o *GroupProperties) HasAccessAndManageApiGateway() bool { - if o != nil && o.AccessAndManageApiGateway != nil { + if o != nil && !IsNil(o.AccessAndManageApiGateway) { return true } return false } -// GetAccessAndManageKaas returns the AccessAndManageKaas field value -// If the value is explicit nil, nil is returned -func (o *GroupProperties) GetAccessAndManageKaas() *bool { - if o == nil { - return nil - } - - return o.AccessAndManageKaas +// SetAccessAndManageApiGateway gets a reference to the given bool and assigns it to the AccessAndManageApiGateway field. +func (o *GroupProperties) SetAccessAndManageApiGateway(v bool) { + o.AccessAndManageApiGateway = &v +} +// GetAccessAndManageKaas returns the AccessAndManageKaas field value if set, zero value otherwise. +func (o *GroupProperties) GetAccessAndManageKaas() bool { + if o == nil || IsNil(o.AccessAndManageKaas) { + var ret bool + return ret + } + return *o.AccessAndManageKaas } -// GetAccessAndManageKaasOk returns a tuple with the AccessAndManageKaas field value +// GetAccessAndManageKaasOk returns a tuple with the AccessAndManageKaas 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 *GroupProperties) GetAccessAndManageKaasOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.AccessAndManageKaas) { return nil, false } - return o.AccessAndManageKaas, true } -// SetAccessAndManageKaas sets field value -func (o *GroupProperties) SetAccessAndManageKaas(v bool) { - - o.AccessAndManageKaas = &v - -} - // HasAccessAndManageKaas returns a boolean if a field has been set. func (o *GroupProperties) HasAccessAndManageKaas() bool { - if o != nil && o.AccessAndManageKaas != nil { + if o != nil && !IsNil(o.AccessAndManageKaas) { return true } return false } -// GetAccessAndManageNetworkFileStorage returns the AccessAndManageNetworkFileStorage field value -// If the value is explicit nil, nil is returned -func (o *GroupProperties) GetAccessAndManageNetworkFileStorage() *bool { - if o == nil { - return nil - } - - return o.AccessAndManageNetworkFileStorage +// SetAccessAndManageKaas gets a reference to the given bool and assigns it to the AccessAndManageKaas field. +func (o *GroupProperties) SetAccessAndManageKaas(v bool) { + o.AccessAndManageKaas = &v +} +// GetAccessAndManageNetworkFileStorage returns the AccessAndManageNetworkFileStorage field value if set, zero value otherwise. +func (o *GroupProperties) GetAccessAndManageNetworkFileStorage() bool { + if o == nil || IsNil(o.AccessAndManageNetworkFileStorage) { + var ret bool + return ret + } + return *o.AccessAndManageNetworkFileStorage } -// GetAccessAndManageNetworkFileStorageOk returns a tuple with the AccessAndManageNetworkFileStorage field value +// GetAccessAndManageNetworkFileStorageOk returns a tuple with the AccessAndManageNetworkFileStorage 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 *GroupProperties) GetAccessAndManageNetworkFileStorageOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.AccessAndManageNetworkFileStorage) { return nil, false } - return o.AccessAndManageNetworkFileStorage, true } -// SetAccessAndManageNetworkFileStorage sets field value -func (o *GroupProperties) SetAccessAndManageNetworkFileStorage(v bool) { - - o.AccessAndManageNetworkFileStorage = &v - -} - // HasAccessAndManageNetworkFileStorage returns a boolean if a field has been set. func (o *GroupProperties) HasAccessAndManageNetworkFileStorage() bool { - if o != nil && o.AccessAndManageNetworkFileStorage != nil { + if o != nil && !IsNil(o.AccessAndManageNetworkFileStorage) { return true } return false } -// GetAccessAndManageAiModelHub returns the AccessAndManageAiModelHub field value -// If the value is explicit nil, nil is returned -func (o *GroupProperties) GetAccessAndManageAiModelHub() *bool { - if o == nil { - return nil - } - - return o.AccessAndManageAiModelHub +// SetAccessAndManageNetworkFileStorage gets a reference to the given bool and assigns it to the AccessAndManageNetworkFileStorage field. +func (o *GroupProperties) SetAccessAndManageNetworkFileStorage(v bool) { + o.AccessAndManageNetworkFileStorage = &v +} +// GetAccessAndManageAiModelHub returns the AccessAndManageAiModelHub field value if set, zero value otherwise. +func (o *GroupProperties) GetAccessAndManageAiModelHub() bool { + if o == nil || IsNil(o.AccessAndManageAiModelHub) { + var ret bool + return ret + } + return *o.AccessAndManageAiModelHub } -// GetAccessAndManageAiModelHubOk returns a tuple with the AccessAndManageAiModelHub field value +// GetAccessAndManageAiModelHubOk returns a tuple with the AccessAndManageAiModelHub 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 *GroupProperties) GetAccessAndManageAiModelHubOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.AccessAndManageAiModelHub) { return nil, false } - return o.AccessAndManageAiModelHub, true } -// SetAccessAndManageAiModelHub sets field value -func (o *GroupProperties) SetAccessAndManageAiModelHub(v bool) { - - o.AccessAndManageAiModelHub = &v - -} - // HasAccessAndManageAiModelHub returns a boolean if a field has been set. func (o *GroupProperties) HasAccessAndManageAiModelHub() bool { - if o != nil && o.AccessAndManageAiModelHub != nil { + if o != nil && !IsNil(o.AccessAndManageAiModelHub) { return true } return false } -// GetAccessAndManageIamResources returns the AccessAndManageIamResources field value -// If the value is explicit nil, nil is returned -func (o *GroupProperties) GetAccessAndManageIamResources() *bool { - if o == nil { - return nil - } - - return o.AccessAndManageIamResources +// SetAccessAndManageAiModelHub gets a reference to the given bool and assigns it to the AccessAndManageAiModelHub field. +func (o *GroupProperties) SetAccessAndManageAiModelHub(v bool) { + o.AccessAndManageAiModelHub = &v +} +// GetAccessAndManageIamResources returns the AccessAndManageIamResources field value if set, zero value otherwise. +func (o *GroupProperties) GetAccessAndManageIamResources() bool { + if o == nil || IsNil(o.AccessAndManageIamResources) { + var ret bool + return ret + } + return *o.AccessAndManageIamResources } -// GetAccessAndManageIamResourcesOk returns a tuple with the AccessAndManageIamResources field value +// GetAccessAndManageIamResourcesOk returns a tuple with the AccessAndManageIamResources 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 *GroupProperties) GetAccessAndManageIamResourcesOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.AccessAndManageIamResources) { return nil, false } - return o.AccessAndManageIamResources, true } -// SetAccessAndManageIamResources sets field value -func (o *GroupProperties) SetAccessAndManageIamResources(v bool) { - - o.AccessAndManageIamResources = &v - -} - // HasAccessAndManageIamResources returns a boolean if a field has been set. func (o *GroupProperties) HasAccessAndManageIamResources() bool { - if o != nil && o.AccessAndManageIamResources != nil { + if o != nil && !IsNil(o.AccessAndManageIamResources) { return true } return false } -// GetCreateNetworkSecurityGroups returns the CreateNetworkSecurityGroups field value -// If the value is explicit nil, nil is returned -func (o *GroupProperties) GetCreateNetworkSecurityGroups() *bool { - if o == nil { - return nil - } - - return o.CreateNetworkSecurityGroups +// SetAccessAndManageIamResources gets a reference to the given bool and assigns it to the AccessAndManageIamResources field. +func (o *GroupProperties) SetAccessAndManageIamResources(v bool) { + o.AccessAndManageIamResources = &v +} +// GetCreateNetworkSecurityGroups returns the CreateNetworkSecurityGroups field value if set, zero value otherwise. +func (o *GroupProperties) GetCreateNetworkSecurityGroups() bool { + if o == nil || IsNil(o.CreateNetworkSecurityGroups) { + var ret bool + return ret + } + return *o.CreateNetworkSecurityGroups } -// GetCreateNetworkSecurityGroupsOk returns a tuple with the CreateNetworkSecurityGroups field value +// GetCreateNetworkSecurityGroupsOk returns a tuple with the CreateNetworkSecurityGroups 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 *GroupProperties) GetCreateNetworkSecurityGroupsOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.CreateNetworkSecurityGroups) { return nil, false } - return o.CreateNetworkSecurityGroups, true } -// SetCreateNetworkSecurityGroups sets field value -func (o *GroupProperties) SetCreateNetworkSecurityGroups(v bool) { - - o.CreateNetworkSecurityGroups = &v - -} - // HasCreateNetworkSecurityGroups returns a boolean if a field has been set. func (o *GroupProperties) HasCreateNetworkSecurityGroups() bool { - if o != nil && o.CreateNetworkSecurityGroups != nil { + if o != nil && !IsNil(o.CreateNetworkSecurityGroups) { return true } return false } +// SetCreateNetworkSecurityGroups gets a reference to the given bool and assigns it to the CreateNetworkSecurityGroups field. +func (o *GroupProperties) SetCreateNetworkSecurityGroups(v bool) { + o.CreateNetworkSecurityGroups = &v +} + func (o GroupProperties) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o GroupProperties) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Name != nil { + if !IsNil(o.Name) { toSerialize["name"] = o.Name } - - if o.CreateDataCenter != nil { - toSerialize["createDataCenter"] = o.CreateDataCenter + if !IsNil(o.CreateDatacenter) { + toSerialize["createDatacenter"] = o.CreateDatacenter } - - if o.CreateSnapshot != nil { + if !IsNil(o.CreateSnapshot) { toSerialize["createSnapshot"] = o.CreateSnapshot } - - if o.ReserveIp != nil { + if !IsNil(o.ReserveIp) { toSerialize["reserveIp"] = o.ReserveIp } - - if o.AccessActivityLog != nil { + if !IsNil(o.AccessActivityLog) { toSerialize["accessActivityLog"] = o.AccessActivityLog } - - if o.CreatePcc != nil { + if !IsNil(o.CreatePcc) { toSerialize["createPcc"] = o.CreatePcc } - - if o.S3Privilege != nil { + if !IsNil(o.S3Privilege) { toSerialize["s3Privilege"] = o.S3Privilege } - - if o.CreateBackupUnit != nil { + if !IsNil(o.CreateBackupUnit) { toSerialize["createBackupUnit"] = o.CreateBackupUnit } - - if o.CreateInternetAccess != nil { + if !IsNil(o.CreateInternetAccess) { toSerialize["createInternetAccess"] = o.CreateInternetAccess } - - if o.CreateK8sCluster != nil { + if !IsNil(o.CreateK8sCluster) { toSerialize["createK8sCluster"] = o.CreateK8sCluster } - - if o.CreateFlowLog != nil { + if !IsNil(o.CreateFlowLog) { toSerialize["createFlowLog"] = o.CreateFlowLog } - - if o.AccessAndManageMonitoring != nil { + if !IsNil(o.AccessAndManageMonitoring) { toSerialize["accessAndManageMonitoring"] = o.AccessAndManageMonitoring } - - if o.AccessAndManageCertificates != nil { + if !IsNil(o.AccessAndManageCertificates) { toSerialize["accessAndManageCertificates"] = o.AccessAndManageCertificates } - - if o.ManageDBaaS != nil { + if !IsNil(o.ManageDBaaS) { toSerialize["manageDBaaS"] = o.ManageDBaaS } - - if o.AccessAndManageDns != nil { + if !IsNil(o.AccessAndManageDns) { toSerialize["accessAndManageDns"] = o.AccessAndManageDns } - - if o.ManageRegistry != nil { + if !IsNil(o.ManageRegistry) { toSerialize["manageRegistry"] = o.ManageRegistry } - - if o.ManageDataplatform != nil { + if !IsNil(o.ManageDataplatform) { toSerialize["manageDataplatform"] = o.ManageDataplatform } - - if o.AccessAndManageLogging != nil { + if !IsNil(o.AccessAndManageLogging) { toSerialize["accessAndManageLogging"] = o.AccessAndManageLogging } - - if o.AccessAndManageCdn != nil { + if !IsNil(o.AccessAndManageCdn) { toSerialize["accessAndManageCdn"] = o.AccessAndManageCdn } - - if o.AccessAndManageVpn != nil { + if !IsNil(o.AccessAndManageVpn) { toSerialize["accessAndManageVpn"] = o.AccessAndManageVpn } - - if o.AccessAndManageApiGateway != nil { + if !IsNil(o.AccessAndManageApiGateway) { toSerialize["accessAndManageApiGateway"] = o.AccessAndManageApiGateway } - - if o.AccessAndManageKaas != nil { + if !IsNil(o.AccessAndManageKaas) { toSerialize["accessAndManageKaas"] = o.AccessAndManageKaas } - - if o.AccessAndManageNetworkFileStorage != nil { + if !IsNil(o.AccessAndManageNetworkFileStorage) { toSerialize["accessAndManageNetworkFileStorage"] = o.AccessAndManageNetworkFileStorage } - - if o.AccessAndManageAiModelHub != nil { + if !IsNil(o.AccessAndManageAiModelHub) { toSerialize["accessAndManageAiModelHub"] = o.AccessAndManageAiModelHub } - - if o.AccessAndManageIamResources != nil { + if !IsNil(o.AccessAndManageIamResources) { toSerialize["accessAndManageIamResources"] = o.AccessAndManageIamResources } - - if o.CreateNetworkSecurityGroups != nil { + if !IsNil(o.CreateNetworkSecurityGroups) { toSerialize["createNetworkSecurityGroups"] = o.CreateNetworkSecurityGroups } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableGroupProperties struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_group_share.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_group_share.go similarity index 67% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_group_share.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_group_share.go index e8a6124f5..f553daf99 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_group_share.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_group_share.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the GroupShare type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GroupShare{} + // GroupShare struct for GroupShare type GroupShare struct { // The resource's unique identifier. @@ -21,8 +24,8 @@ type GroupShare struct { // resource as generic type Type *Type `json:"type,omitempty"` // URL to the object representation (absolute path). - Href *string `json:"href,omitempty"` - Properties *GroupShareProperties `json:"properties"` + Href *string `json:"href,omitempty"` + Properties GroupShareProperties `json:"properties"` } // NewGroupShare instantiates a new GroupShare object @@ -32,7 +35,7 @@ type GroupShare struct { func NewGroupShare(properties GroupShareProperties) *GroupShare { this := GroupShare{} - this.Properties = &properties + this.Properties = properties return &this } @@ -45,177 +48,147 @@ func NewGroupShareWithDefaults() *GroupShare { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *GroupShare) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *GroupShare) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *GroupShare) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *GroupShare) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *GroupShare) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *GroupShare) GetType() *Type { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *GroupShare) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *GroupShare) GetType() Type { + if o == nil || IsNil(o.Type) { + var ret Type + return ret + } + return *o.Type } -// GetTypeOk returns a tuple with the Type field value +// GetTypeOk returns a tuple with the Type 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 *GroupShare) GetTypeOk() (*Type, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *GroupShare) SetType(v Type) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *GroupShare) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *GroupShare) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given Type and assigns it to the Type field. +func (o *GroupShare) SetType(v Type) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *GroupShare) 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 +// GetHrefOk returns a tuple with the Href 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 *GroupShare) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *GroupShare) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *GroupShare) HasHref() bool { - if o != nil && o.Href != nil { + 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 *GroupShare) SetHref(v string) { + o.Href = &v +} + // GetProperties returns the Properties field value -// If the value is explicit nil, nil is returned -func (o *GroupShare) GetProperties() *GroupShareProperties { +func (o *GroupShare) GetProperties() GroupShareProperties { if o == nil { - return nil + var ret GroupShareProperties + return ret } return o.Properties - } // GetPropertiesOk returns a tuple with the Properties field value // 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 *GroupShare) GetPropertiesOk() (*GroupShareProperties, bool) { if o == nil { return nil, false } - - return o.Properties, true + return &o.Properties, true } // SetProperties sets field value func (o *GroupShare) SetProperties(v GroupShareProperties) { - - o.Properties = &v - + o.Properties = v } -// HasProperties returns a boolean if a field has been set. -func (o *GroupShare) HasProperties() bool { - if o != nil && o.Properties != nil { - return true +func (o GroupShare) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } - - return false + return json.Marshal(toSerialize) } -func (o GroupShare) MarshalJSON() ([]byte, error) { +func (o GroupShare) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Properties != nil { - toSerialize["properties"] = o.Properties - } - - return json.Marshal(toSerialize) + toSerialize["properties"] = o.Properties + return toSerialize, nil } type NullableGroupShare struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_group_share_properties.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_group_share_properties.go similarity index 74% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_group_share_properties.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_group_share_properties.go index 2fa1e30d9..09b7fa7cb 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_group_share_properties.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_group_share_properties.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the GroupShareProperties type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GroupShareProperties{} + // GroupShareProperties struct for GroupShareProperties type GroupShareProperties struct { // edit privilege on a resource @@ -40,93 +43,87 @@ func NewGroupSharePropertiesWithDefaults() *GroupShareProperties { return &this } -// GetEditPrivilege returns the EditPrivilege field value -// If the value is explicit nil, nil is returned -func (o *GroupShareProperties) GetEditPrivilege() *bool { - if o == nil { - return nil +// GetEditPrivilege returns the EditPrivilege field value if set, zero value otherwise. +func (o *GroupShareProperties) GetEditPrivilege() bool { + if o == nil || IsNil(o.EditPrivilege) { + var ret bool + return ret } - - return o.EditPrivilege - + return *o.EditPrivilege } -// GetEditPrivilegeOk returns a tuple with the EditPrivilege field value +// GetEditPrivilegeOk returns a tuple with the EditPrivilege 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 *GroupShareProperties) GetEditPrivilegeOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.EditPrivilege) { return nil, false } - return o.EditPrivilege, true } -// SetEditPrivilege sets field value -func (o *GroupShareProperties) SetEditPrivilege(v bool) { - - o.EditPrivilege = &v - -} - // HasEditPrivilege returns a boolean if a field has been set. func (o *GroupShareProperties) HasEditPrivilege() bool { - if o != nil && o.EditPrivilege != nil { + if o != nil && !IsNil(o.EditPrivilege) { return true } return false } -// GetSharePrivilege returns the SharePrivilege field value -// If the value is explicit nil, nil is returned -func (o *GroupShareProperties) GetSharePrivilege() *bool { - if o == nil { - return nil - } - - return o.SharePrivilege +// SetEditPrivilege gets a reference to the given bool and assigns it to the EditPrivilege field. +func (o *GroupShareProperties) SetEditPrivilege(v bool) { + o.EditPrivilege = &v +} +// GetSharePrivilege returns the SharePrivilege field value if set, zero value otherwise. +func (o *GroupShareProperties) GetSharePrivilege() bool { + if o == nil || IsNil(o.SharePrivilege) { + var ret bool + return ret + } + return *o.SharePrivilege } -// GetSharePrivilegeOk returns a tuple with the SharePrivilege field value +// GetSharePrivilegeOk returns a tuple with the SharePrivilege 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 *GroupShareProperties) GetSharePrivilegeOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.SharePrivilege) { return nil, false } - return o.SharePrivilege, true } -// SetSharePrivilege sets field value -func (o *GroupShareProperties) SetSharePrivilege(v bool) { - - o.SharePrivilege = &v - -} - // HasSharePrivilege returns a boolean if a field has been set. func (o *GroupShareProperties) HasSharePrivilege() bool { - if o != nil && o.SharePrivilege != nil { + if o != nil && !IsNil(o.SharePrivilege) { return true } return false } +// SetSharePrivilege gets a reference to the given bool and assigns it to the SharePrivilege field. +func (o *GroupShareProperties) SetSharePrivilege(v bool) { + o.SharePrivilege = &v +} + func (o GroupShareProperties) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o GroupShareProperties) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.EditPrivilege != nil { + if !IsNil(o.EditPrivilege) { toSerialize["editPrivilege"] = o.EditPrivilege } - - if o.SharePrivilege != nil { + if !IsNil(o.SharePrivilege) { toSerialize["sharePrivilege"] = o.SharePrivilege } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableGroupShareProperties struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_group_shares.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_group_shares.go similarity index 64% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_group_shares.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_group_shares.go index 7283b6544..37b30943b 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_group_shares.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_group_shares.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the GroupShares type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GroupShares{} + // GroupShares struct for GroupShares type GroupShares struct { // The resource's unique identifier. @@ -23,7 +26,7 @@ type GroupShares struct { // URL to the object representation (absolute path). Href *string `json:"href,omitempty"` // Array of items in the collection. - Items *[]GroupShare `json:"items,omitempty"` + Items []GroupShare `json:"items,omitempty"` } // NewGroupShares instantiates a new GroupShares object @@ -44,177 +47,157 @@ func NewGroupSharesWithDefaults() *GroupShares { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *GroupShares) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *GroupShares) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *GroupShares) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *GroupShares) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *GroupShares) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *GroupShares) GetType() *Type { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *GroupShares) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *GroupShares) GetType() Type { + if o == nil || IsNil(o.Type) { + var ret Type + return ret + } + return *o.Type } -// GetTypeOk returns a tuple with the Type field value +// GetTypeOk returns a tuple with the Type 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 *GroupShares) GetTypeOk() (*Type, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *GroupShares) SetType(v Type) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *GroupShares) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *GroupShares) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given Type and assigns it to the Type field. +func (o *GroupShares) SetType(v Type) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *GroupShares) 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 +// GetHrefOk returns a tuple with the Href 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 *GroupShares) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *GroupShares) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *GroupShares) HasHref() bool { - if o != nil && o.Href != nil { + if o != nil && !IsNil(o.Href) { return true } return false } -// GetItems returns the Items field value -// If the value is explicit nil, nil is returned -func (o *GroupShares) GetItems() *[]GroupShare { - if o == nil { - return nil - } +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *GroupShares) SetHref(v string) { + o.Href = &v +} +// GetItems returns the Items field value if set, zero value otherwise. +func (o *GroupShares) GetItems() []GroupShare { + if o == nil || IsNil(o.Items) { + var ret []GroupShare + return ret + } return o.Items - } -// GetItemsOk returns a tuple with the Items field value +// GetItemsOk returns a tuple with the Items 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 *GroupShares) GetItemsOk() (*[]GroupShare, bool) { - if o == nil { +func (o *GroupShares) GetItemsOk() ([]GroupShare, bool) { + if o == nil || IsNil(o.Items) { return nil, false } - return o.Items, true } -// SetItems sets field value -func (o *GroupShares) SetItems(v []GroupShare) { - - o.Items = &v - -} - // HasItems returns a boolean if a field has been set. func (o *GroupShares) HasItems() bool { - if o != nil && o.Items != nil { + if o != nil && !IsNil(o.Items) { return true } return false } +// SetItems gets a reference to the given []GroupShare and assigns it to the Items field. +func (o *GroupShares) SetItems(v []GroupShare) { + o.Items = v +} + func (o GroupShares) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o GroupShares) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Items != nil { + if !IsNil(o.Items) { toSerialize["items"] = o.Items } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableGroupShares struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_group_users.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_group_users.go similarity index 65% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_group_users.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_group_users.go index c24938b56..c469a16b4 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_group_users.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_group_users.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the GroupUsers type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GroupUsers{} + // GroupUsers Collection of the groups the user is a member of. type GroupUsers struct { // The resource's unique identifier. @@ -23,7 +26,7 @@ type GroupUsers struct { // URL to the object representation (absolute path). Href *string `json:"href,omitempty"` // Array of items in the collection. - Items *[]Group `json:"items,omitempty"` + Items []Group `json:"items,omitempty"` } // NewGroupUsers instantiates a new GroupUsers object @@ -44,177 +47,157 @@ func NewGroupUsersWithDefaults() *GroupUsers { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *GroupUsers) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *GroupUsers) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *GroupUsers) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *GroupUsers) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *GroupUsers) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *GroupUsers) GetType() *Type { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *GroupUsers) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *GroupUsers) GetType() Type { + if o == nil || IsNil(o.Type) { + var ret Type + return ret + } + return *o.Type } -// GetTypeOk returns a tuple with the Type field value +// GetTypeOk returns a tuple with the Type 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 *GroupUsers) GetTypeOk() (*Type, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *GroupUsers) SetType(v Type) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *GroupUsers) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *GroupUsers) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given Type and assigns it to the Type field. +func (o *GroupUsers) SetType(v Type) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *GroupUsers) 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 +// GetHrefOk returns a tuple with the Href 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 *GroupUsers) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *GroupUsers) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *GroupUsers) HasHref() bool { - if o != nil && o.Href != nil { + if o != nil && !IsNil(o.Href) { return true } return false } -// GetItems returns the Items field value -// If the value is explicit nil, nil is returned -func (o *GroupUsers) GetItems() *[]Group { - if o == nil { - return nil - } +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *GroupUsers) SetHref(v string) { + o.Href = &v +} +// GetItems returns the Items field value if set, zero value otherwise. +func (o *GroupUsers) GetItems() []Group { + if o == nil || IsNil(o.Items) { + var ret []Group + return ret + } return o.Items - } -// GetItemsOk returns a tuple with the Items field value +// GetItemsOk returns a tuple with the Items 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 *GroupUsers) GetItemsOk() (*[]Group, bool) { - if o == nil { +func (o *GroupUsers) GetItemsOk() ([]Group, bool) { + if o == nil || IsNil(o.Items) { return nil, false } - return o.Items, true } -// SetItems sets field value -func (o *GroupUsers) SetItems(v []Group) { - - o.Items = &v - -} - // HasItems returns a boolean if a field has been set. func (o *GroupUsers) HasItems() bool { - if o != nil && o.Items != nil { + if o != nil && !IsNil(o.Items) { return true } return false } +// SetItems gets a reference to the given []Group and assigns it to the Items field. +func (o *GroupUsers) SetItems(v []Group) { + o.Items = v +} + func (o GroupUsers) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o GroupUsers) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Items != nil { + if !IsNil(o.Items) { toSerialize["items"] = o.Items } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableGroupUsers struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_groups.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_groups.go similarity index 64% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_groups.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_groups.go index dd50b9a52..faaf4e210 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_groups.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_groups.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the Groups type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Groups{} + // Groups struct for Groups type Groups struct { // The resource's unique identifier. @@ -23,7 +26,7 @@ type Groups struct { // URL to the object representation (absolute path). Href *string `json:"href,omitempty"` // Array of items in the collection. - Items *[]Group `json:"items,omitempty"` + Items []Group `json:"items,omitempty"` } // NewGroups instantiates a new Groups object @@ -44,177 +47,157 @@ func NewGroupsWithDefaults() *Groups { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *Groups) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *Groups) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *Groups) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *Groups) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *Groups) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *Groups) GetType() *Type { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Groups) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *Groups) GetType() Type { + if o == nil || IsNil(o.Type) { + var ret Type + return ret + } + return *o.Type } -// GetTypeOk returns a tuple with the Type field value +// GetTypeOk returns a tuple with the Type 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 *Groups) GetTypeOk() (*Type, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *Groups) SetType(v Type) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *Groups) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *Groups) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given Type and assigns it to the Type field. +func (o *Groups) SetType(v Type) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *Groups) 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 +// GetHrefOk returns a tuple with the Href 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 *Groups) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *Groups) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *Groups) HasHref() bool { - if o != nil && o.Href != nil { + if o != nil && !IsNil(o.Href) { return true } return false } -// GetItems returns the Items field value -// If the value is explicit nil, nil is returned -func (o *Groups) GetItems() *[]Group { - if o == nil { - return nil - } +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *Groups) SetHref(v string) { + o.Href = &v +} +// GetItems returns the Items field value if set, zero value otherwise. +func (o *Groups) GetItems() []Group { + if o == nil || IsNil(o.Items) { + var ret []Group + return ret + } return o.Items - } -// GetItemsOk returns a tuple with the Items field value +// GetItemsOk returns a tuple with the Items 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 *Groups) GetItemsOk() (*[]Group, bool) { - if o == nil { +func (o *Groups) GetItemsOk() ([]Group, bool) { + if o == nil || IsNil(o.Items) { return nil, false } - return o.Items, true } -// SetItems sets field value -func (o *Groups) SetItems(v []Group) { - - o.Items = &v - -} - // HasItems returns a boolean if a field has been set. func (o *Groups) HasItems() bool { - if o != nil && o.Items != nil { + if o != nil && !IsNil(o.Items) { return true } return false } +// SetItems gets a reference to the given []Group and assigns it to the Items field. +func (o *Groups) SetItems(v []Group) { + o.Items = v +} + func (o Groups) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Groups) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Items != nil { + if !IsNil(o.Items) { toSerialize["items"] = o.Items } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableGroups struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_image.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_image.go similarity index 64% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_image.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_image.go index 276dfffae..7b04dd718 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_image.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_image.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the Image type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Image{} + // Image struct for Image type Image struct { // The resource's unique identifier. @@ -23,7 +26,7 @@ type Image struct { // URL to the object representation (absolute path). Href *string `json:"href,omitempty"` Metadata *DatacenterElementMetadata `json:"metadata,omitempty"` - Properties *ImageProperties `json:"properties"` + Properties ImageProperties `json:"properties"` } // NewImage instantiates a new Image object @@ -33,7 +36,7 @@ type Image struct { func NewImage(properties ImageProperties) *Image { this := Image{} - this.Properties = &properties + this.Properties = properties return &this } @@ -46,219 +49,182 @@ func NewImageWithDefaults() *Image { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *Image) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *Image) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *Image) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *Image) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *Image) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *Image) GetType() *Type { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Image) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *Image) GetType() Type { + if o == nil || IsNil(o.Type) { + var ret Type + return ret + } + return *o.Type } -// GetTypeOk returns a tuple with the Type field value +// GetTypeOk returns a tuple with the Type 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 *Image) GetTypeOk() (*Type, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *Image) SetType(v Type) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *Image) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *Image) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given Type and assigns it to the Type field. +func (o *Image) SetType(v Type) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *Image) 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 +// GetHrefOk returns a tuple with the Href 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 *Image) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *Image) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *Image) HasHref() bool { - if o != nil && o.Href != nil { + if o != nil && !IsNil(o.Href) { return true } return false } -// GetMetadata returns the Metadata field value -// If the value is explicit nil, nil is returned -func (o *Image) GetMetadata() *DatacenterElementMetadata { - if o == nil { - return nil - } - - return o.Metadata +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *Image) SetHref(v string) { + o.Href = &v +} +// GetMetadata returns the Metadata field value if set, zero value otherwise. +func (o *Image) GetMetadata() DatacenterElementMetadata { + if o == nil || IsNil(o.Metadata) { + var ret DatacenterElementMetadata + return ret + } + return *o.Metadata } -// GetMetadataOk returns a tuple with the Metadata field value +// GetMetadataOk returns a tuple with the Metadata 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 *Image) GetMetadataOk() (*DatacenterElementMetadata, bool) { - if o == nil { + if o == nil || IsNil(o.Metadata) { return nil, false } - return o.Metadata, true } -// SetMetadata sets field value -func (o *Image) SetMetadata(v DatacenterElementMetadata) { - - o.Metadata = &v - -} - // HasMetadata returns a boolean if a field has been set. func (o *Image) HasMetadata() bool { - if o != nil && o.Metadata != nil { + if o != nil && !IsNil(o.Metadata) { return true } return false } +// SetMetadata gets a reference to the given DatacenterElementMetadata and assigns it to the Metadata field. +func (o *Image) SetMetadata(v DatacenterElementMetadata) { + o.Metadata = &v +} + // GetProperties returns the Properties field value -// If the value is explicit nil, nil is returned -func (o *Image) GetProperties() *ImageProperties { +func (o *Image) GetProperties() ImageProperties { if o == nil { - return nil + var ret ImageProperties + return ret } return o.Properties - } // GetPropertiesOk returns a tuple with the Properties field value // 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 *Image) GetPropertiesOk() (*ImageProperties, bool) { if o == nil { return nil, false } - - return o.Properties, true + return &o.Properties, true } // SetProperties sets field value func (o *Image) SetProperties(v ImageProperties) { - - o.Properties = &v - + o.Properties = v } -// HasProperties returns a boolean if a field has been set. -func (o *Image) HasProperties() bool { - if o != nil && o.Properties != nil { - return true +func (o Image) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } - - return false + return json.Marshal(toSerialize) } -func (o Image) MarshalJSON() ([]byte, error) { +func (o Image) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Metadata != nil { + if !IsNil(o.Metadata) { toSerialize["metadata"] = o.Metadata } - - if o.Properties != nil { - toSerialize["properties"] = o.Properties - } - - return json.Marshal(toSerialize) + toSerialize["properties"] = o.Properties + return toSerialize, nil } type NullableImage struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_image_properties.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_image_properties.go similarity index 60% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_image_properties.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_image_properties.go index f33c446b0..a81800f4f 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_image_properties.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_image_properties.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the ImageProperties type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ImageProperties{} + // ImageProperties struct for ImageProperties type ImageProperties struct { // The resource name. @@ -47,13 +50,13 @@ type ImageProperties struct { // If set to `true` will expose the serial id of the disk attached to the server. If set to `false` will not expose the serial id. Some operating systems or software solutions require the serial id to be exposed to work properly. Exposing the serial can influence licensed software (e.g. Windows) behavior ExposeSerial *bool `json:"exposeSerial,omitempty"` // The OS type of this image. - LicenceType *string `json:"licenceType"` + LicenceType string `json:"licenceType"` // The image type. ImageType *string `json:"imageType,omitempty"` // Indicates whether the image is part of a public repository. Public *bool `json:"public,omitempty"` // List of image aliases mapped for this image - ImageAliases *[]string `json:"imageAliases,omitempty"` + ImageAliases []string `json:"imageAliases,omitempty"` // Cloud init compatibility. CloudInit *string `json:"cloudInit,omitempty"` } @@ -67,7 +70,7 @@ func NewImageProperties(licenceType string) *ImageProperties { var exposeSerial bool = false this.ExposeSerial = &exposeSerial - this.LicenceType = &licenceType + this.LicenceType = licenceType return &this } @@ -82,849 +85,707 @@ func NewImagePropertiesWithDefaults() *ImageProperties { return &this } -// GetName returns the Name field value -// If the value is explicit nil, nil is returned -func (o *ImageProperties) GetName() *string { - if o == nil { - return nil +// GetName returns the Name field value if set, zero value otherwise. +func (o *ImageProperties) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret } - - return o.Name - + return *o.Name } -// GetNameOk returns a tuple with the Name field value +// GetNameOk returns a tuple with the Name 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 *ImageProperties) GetNameOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Name) { return nil, false } - return o.Name, true } -// SetName sets field value -func (o *ImageProperties) SetName(v string) { - - o.Name = &v - -} - // HasName returns a boolean if a field has been set. func (o *ImageProperties) HasName() bool { - if o != nil && o.Name != nil { + if o != nil && !IsNil(o.Name) { return true } return false } -// GetDescription returns the Description field value -// If the value is explicit nil, nil is returned -func (o *ImageProperties) GetDescription() *string { - if o == nil { - return nil - } - - return o.Description +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *ImageProperties) SetName(v string) { + o.Name = &v +} +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *ImageProperties) 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 +// GetDescriptionOk returns a tuple with the Description 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 *ImageProperties) GetDescriptionOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Description) { return nil, false } - return o.Description, true } -// SetDescription sets field value -func (o *ImageProperties) SetDescription(v string) { - - o.Description = &v - -} - // HasDescription returns a boolean if a field has been set. func (o *ImageProperties) HasDescription() bool { - if o != nil && o.Description != nil { + if o != nil && !IsNil(o.Description) { return true } return false } -// GetLocation returns the Location field value -// If the value is explicit nil, nil is returned -func (o *ImageProperties) GetLocation() *string { - if o == nil { - return nil - } - - return o.Location +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *ImageProperties) SetDescription(v string) { + o.Description = &v +} +// GetLocation returns the Location field value if set, zero value otherwise. +func (o *ImageProperties) GetLocation() string { + if o == nil || IsNil(o.Location) { + var ret string + return ret + } + return *o.Location } -// GetLocationOk returns a tuple with the Location field value +// GetLocationOk returns a tuple with the Location 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 *ImageProperties) GetLocationOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Location) { return nil, false } - return o.Location, true } -// SetLocation sets field value -func (o *ImageProperties) SetLocation(v string) { - - o.Location = &v - -} - // HasLocation returns a boolean if a field has been set. func (o *ImageProperties) HasLocation() bool { - if o != nil && o.Location != nil { + if o != nil && !IsNil(o.Location) { return true } return false } -// GetSize returns the Size field value -// If the value is explicit nil, nil is returned -func (o *ImageProperties) GetSize() *float32 { - if o == nil { - return nil - } - - return o.Size +// SetLocation gets a reference to the given string and assigns it to the Location field. +func (o *ImageProperties) SetLocation(v string) { + o.Location = &v +} +// GetSize returns the Size field value if set, zero value otherwise. +func (o *ImageProperties) 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 +// GetSizeOk returns a tuple with the Size 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 *ImageProperties) GetSizeOk() (*float32, bool) { - if o == nil { + if o == nil || IsNil(o.Size) { return nil, false } - return o.Size, true } -// SetSize sets field value -func (o *ImageProperties) SetSize(v float32) { - - o.Size = &v - -} - // HasSize returns a boolean if a field has been set. func (o *ImageProperties) HasSize() bool { - if o != nil && o.Size != nil { + if o != nil && !IsNil(o.Size) { return true } return false } -// GetCpuHotPlug returns the CpuHotPlug field value -// If the value is explicit nil, nil is returned -func (o *ImageProperties) GetCpuHotPlug() *bool { - if o == nil { - return nil - } - - return o.CpuHotPlug +// SetSize gets a reference to the given float32 and assigns it to the Size field. +func (o *ImageProperties) SetSize(v float32) { + o.Size = &v +} +// GetCpuHotPlug returns the CpuHotPlug field value if set, zero value otherwise. +func (o *ImageProperties) GetCpuHotPlug() bool { + if o == nil || IsNil(o.CpuHotPlug) { + var ret bool + return ret + } + return *o.CpuHotPlug } -// GetCpuHotPlugOk returns a tuple with the CpuHotPlug field value +// GetCpuHotPlugOk returns a tuple with the CpuHotPlug 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 *ImageProperties) GetCpuHotPlugOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.CpuHotPlug) { return nil, false } - return o.CpuHotPlug, true } -// SetCpuHotPlug sets field value -func (o *ImageProperties) SetCpuHotPlug(v bool) { - - o.CpuHotPlug = &v - -} - // HasCpuHotPlug returns a boolean if a field has been set. func (o *ImageProperties) HasCpuHotPlug() bool { - if o != nil && o.CpuHotPlug != nil { + if o != nil && !IsNil(o.CpuHotPlug) { return true } return false } -// GetCpuHotUnplug returns the CpuHotUnplug field value -// If the value is explicit nil, nil is returned -func (o *ImageProperties) GetCpuHotUnplug() *bool { - if o == nil { - return nil - } - - return o.CpuHotUnplug +// SetCpuHotPlug gets a reference to the given bool and assigns it to the CpuHotPlug field. +func (o *ImageProperties) SetCpuHotPlug(v bool) { + o.CpuHotPlug = &v +} +// GetCpuHotUnplug returns the CpuHotUnplug field value if set, zero value otherwise. +func (o *ImageProperties) GetCpuHotUnplug() bool { + if o == nil || IsNil(o.CpuHotUnplug) { + var ret bool + return ret + } + return *o.CpuHotUnplug } -// GetCpuHotUnplugOk returns a tuple with the CpuHotUnplug field value +// GetCpuHotUnplugOk returns a tuple with the CpuHotUnplug 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 *ImageProperties) GetCpuHotUnplugOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.CpuHotUnplug) { return nil, false } - return o.CpuHotUnplug, true } -// SetCpuHotUnplug sets field value -func (o *ImageProperties) SetCpuHotUnplug(v bool) { - - o.CpuHotUnplug = &v - -} - // HasCpuHotUnplug returns a boolean if a field has been set. func (o *ImageProperties) HasCpuHotUnplug() bool { - if o != nil && o.CpuHotUnplug != nil { + if o != nil && !IsNil(o.CpuHotUnplug) { return true } return false } -// GetRamHotPlug returns the RamHotPlug field value -// If the value is explicit nil, nil is returned -func (o *ImageProperties) GetRamHotPlug() *bool { - if o == nil { - return nil - } - - return o.RamHotPlug +// SetCpuHotUnplug gets a reference to the given bool and assigns it to the CpuHotUnplug field. +func (o *ImageProperties) SetCpuHotUnplug(v bool) { + o.CpuHotUnplug = &v +} +// GetRamHotPlug returns the RamHotPlug field value if set, zero value otherwise. +func (o *ImageProperties) GetRamHotPlug() bool { + if o == nil || IsNil(o.RamHotPlug) { + var ret bool + return ret + } + return *o.RamHotPlug } -// GetRamHotPlugOk returns a tuple with the RamHotPlug field value +// GetRamHotPlugOk returns a tuple with the RamHotPlug 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 *ImageProperties) GetRamHotPlugOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.RamHotPlug) { return nil, false } - return o.RamHotPlug, true } -// SetRamHotPlug sets field value -func (o *ImageProperties) SetRamHotPlug(v bool) { - - o.RamHotPlug = &v - -} - // HasRamHotPlug returns a boolean if a field has been set. func (o *ImageProperties) HasRamHotPlug() bool { - if o != nil && o.RamHotPlug != nil { + if o != nil && !IsNil(o.RamHotPlug) { return true } return false } -// GetRamHotUnplug returns the RamHotUnplug field value -// If the value is explicit nil, nil is returned -func (o *ImageProperties) GetRamHotUnplug() *bool { - if o == nil { - return nil - } - - return o.RamHotUnplug +// SetRamHotPlug gets a reference to the given bool and assigns it to the RamHotPlug field. +func (o *ImageProperties) SetRamHotPlug(v bool) { + o.RamHotPlug = &v +} +// GetRamHotUnplug returns the RamHotUnplug field value if set, zero value otherwise. +func (o *ImageProperties) GetRamHotUnplug() bool { + if o == nil || IsNil(o.RamHotUnplug) { + var ret bool + return ret + } + return *o.RamHotUnplug } -// GetRamHotUnplugOk returns a tuple with the RamHotUnplug field value +// GetRamHotUnplugOk returns a tuple with the RamHotUnplug 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 *ImageProperties) GetRamHotUnplugOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.RamHotUnplug) { return nil, false } - return o.RamHotUnplug, true } -// SetRamHotUnplug sets field value -func (o *ImageProperties) SetRamHotUnplug(v bool) { - - o.RamHotUnplug = &v - -} - // HasRamHotUnplug returns a boolean if a field has been set. func (o *ImageProperties) HasRamHotUnplug() bool { - if o != nil && o.RamHotUnplug != nil { + if o != nil && !IsNil(o.RamHotUnplug) { return true } return false } -// GetNicHotPlug returns the NicHotPlug field value -// If the value is explicit nil, nil is returned -func (o *ImageProperties) GetNicHotPlug() *bool { - if o == nil { - return nil - } - - return o.NicHotPlug +// SetRamHotUnplug gets a reference to the given bool and assigns it to the RamHotUnplug field. +func (o *ImageProperties) SetRamHotUnplug(v bool) { + o.RamHotUnplug = &v +} +// GetNicHotPlug returns the NicHotPlug field value if set, zero value otherwise. +func (o *ImageProperties) GetNicHotPlug() bool { + if o == nil || IsNil(o.NicHotPlug) { + var ret bool + return ret + } + return *o.NicHotPlug } -// GetNicHotPlugOk returns a tuple with the NicHotPlug field value +// GetNicHotPlugOk returns a tuple with the NicHotPlug 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 *ImageProperties) GetNicHotPlugOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.NicHotPlug) { return nil, false } - return o.NicHotPlug, true } -// SetNicHotPlug sets field value -func (o *ImageProperties) SetNicHotPlug(v bool) { - - o.NicHotPlug = &v - -} - // HasNicHotPlug returns a boolean if a field has been set. func (o *ImageProperties) HasNicHotPlug() bool { - if o != nil && o.NicHotPlug != nil { + if o != nil && !IsNil(o.NicHotPlug) { return true } return false } -// GetNicHotUnplug returns the NicHotUnplug field value -// If the value is explicit nil, nil is returned -func (o *ImageProperties) GetNicHotUnplug() *bool { - if o == nil { - return nil - } - - return o.NicHotUnplug +// SetNicHotPlug gets a reference to the given bool and assigns it to the NicHotPlug field. +func (o *ImageProperties) SetNicHotPlug(v bool) { + o.NicHotPlug = &v +} +// GetNicHotUnplug returns the NicHotUnplug field value if set, zero value otherwise. +func (o *ImageProperties) GetNicHotUnplug() bool { + if o == nil || IsNil(o.NicHotUnplug) { + var ret bool + return ret + } + return *o.NicHotUnplug } -// GetNicHotUnplugOk returns a tuple with the NicHotUnplug field value +// GetNicHotUnplugOk returns a tuple with the NicHotUnplug 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 *ImageProperties) GetNicHotUnplugOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.NicHotUnplug) { return nil, false } - return o.NicHotUnplug, true } -// SetNicHotUnplug sets field value -func (o *ImageProperties) SetNicHotUnplug(v bool) { - - o.NicHotUnplug = &v - -} - // HasNicHotUnplug returns a boolean if a field has been set. func (o *ImageProperties) HasNicHotUnplug() bool { - if o != nil && o.NicHotUnplug != nil { + if o != nil && !IsNil(o.NicHotUnplug) { return true } return false } -// GetDiscVirtioHotPlug returns the DiscVirtioHotPlug field value -// If the value is explicit nil, nil is returned -func (o *ImageProperties) GetDiscVirtioHotPlug() *bool { - if o == nil { - return nil - } - - return o.DiscVirtioHotPlug +// SetNicHotUnplug gets a reference to the given bool and assigns it to the NicHotUnplug field. +func (o *ImageProperties) SetNicHotUnplug(v bool) { + o.NicHotUnplug = &v +} +// GetDiscVirtioHotPlug returns the DiscVirtioHotPlug field value if set, zero value otherwise. +func (o *ImageProperties) GetDiscVirtioHotPlug() bool { + if o == nil || IsNil(o.DiscVirtioHotPlug) { + var ret bool + return ret + } + return *o.DiscVirtioHotPlug } -// GetDiscVirtioHotPlugOk returns a tuple with the DiscVirtioHotPlug field value +// GetDiscVirtioHotPlugOk returns a tuple with the DiscVirtioHotPlug 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 *ImageProperties) GetDiscVirtioHotPlugOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.DiscVirtioHotPlug) { return nil, false } - return o.DiscVirtioHotPlug, true } -// SetDiscVirtioHotPlug sets field value -func (o *ImageProperties) SetDiscVirtioHotPlug(v bool) { - - o.DiscVirtioHotPlug = &v - -} - // HasDiscVirtioHotPlug returns a boolean if a field has been set. func (o *ImageProperties) HasDiscVirtioHotPlug() bool { - if o != nil && o.DiscVirtioHotPlug != nil { + if o != nil && !IsNil(o.DiscVirtioHotPlug) { return true } return false } -// GetDiscVirtioHotUnplug returns the DiscVirtioHotUnplug field value -// If the value is explicit nil, nil is returned -func (o *ImageProperties) GetDiscVirtioHotUnplug() *bool { - if o == nil { - return nil - } - - return o.DiscVirtioHotUnplug +// SetDiscVirtioHotPlug gets a reference to the given bool and assigns it to the DiscVirtioHotPlug field. +func (o *ImageProperties) SetDiscVirtioHotPlug(v bool) { + o.DiscVirtioHotPlug = &v +} +// GetDiscVirtioHotUnplug returns the DiscVirtioHotUnplug field value if set, zero value otherwise. +func (o *ImageProperties) GetDiscVirtioHotUnplug() bool { + if o == nil || IsNil(o.DiscVirtioHotUnplug) { + var ret bool + return ret + } + return *o.DiscVirtioHotUnplug } -// GetDiscVirtioHotUnplugOk returns a tuple with the DiscVirtioHotUnplug field value +// GetDiscVirtioHotUnplugOk returns a tuple with the DiscVirtioHotUnplug 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 *ImageProperties) GetDiscVirtioHotUnplugOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.DiscVirtioHotUnplug) { return nil, false } - return o.DiscVirtioHotUnplug, true } -// SetDiscVirtioHotUnplug sets field value -func (o *ImageProperties) SetDiscVirtioHotUnplug(v bool) { - - o.DiscVirtioHotUnplug = &v - -} - // HasDiscVirtioHotUnplug returns a boolean if a field has been set. func (o *ImageProperties) HasDiscVirtioHotUnplug() bool { - if o != nil && o.DiscVirtioHotUnplug != nil { + if o != nil && !IsNil(o.DiscVirtioHotUnplug) { return true } return false } -// GetDiscScsiHotPlug returns the DiscScsiHotPlug field value -// If the value is explicit nil, nil is returned -func (o *ImageProperties) GetDiscScsiHotPlug() *bool { - if o == nil { - return nil - } - - return o.DiscScsiHotPlug +// SetDiscVirtioHotUnplug gets a reference to the given bool and assigns it to the DiscVirtioHotUnplug field. +func (o *ImageProperties) SetDiscVirtioHotUnplug(v bool) { + o.DiscVirtioHotUnplug = &v +} +// GetDiscScsiHotPlug returns the DiscScsiHotPlug field value if set, zero value otherwise. +func (o *ImageProperties) GetDiscScsiHotPlug() bool { + if o == nil || IsNil(o.DiscScsiHotPlug) { + var ret bool + return ret + } + return *o.DiscScsiHotPlug } -// GetDiscScsiHotPlugOk returns a tuple with the DiscScsiHotPlug field value +// GetDiscScsiHotPlugOk returns a tuple with the DiscScsiHotPlug 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 *ImageProperties) GetDiscScsiHotPlugOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.DiscScsiHotPlug) { return nil, false } - return o.DiscScsiHotPlug, true } -// SetDiscScsiHotPlug sets field value -func (o *ImageProperties) SetDiscScsiHotPlug(v bool) { - - o.DiscScsiHotPlug = &v - -} - // HasDiscScsiHotPlug returns a boolean if a field has been set. func (o *ImageProperties) HasDiscScsiHotPlug() bool { - if o != nil && o.DiscScsiHotPlug != nil { + if o != nil && !IsNil(o.DiscScsiHotPlug) { return true } return false } -// GetDiscScsiHotUnplug returns the DiscScsiHotUnplug field value -// If the value is explicit nil, nil is returned -func (o *ImageProperties) GetDiscScsiHotUnplug() *bool { - if o == nil { - return nil - } - - return o.DiscScsiHotUnplug +// SetDiscScsiHotPlug gets a reference to the given bool and assigns it to the DiscScsiHotPlug field. +func (o *ImageProperties) SetDiscScsiHotPlug(v bool) { + o.DiscScsiHotPlug = &v +} +// GetDiscScsiHotUnplug returns the DiscScsiHotUnplug field value if set, zero value otherwise. +func (o *ImageProperties) GetDiscScsiHotUnplug() bool { + if o == nil || IsNil(o.DiscScsiHotUnplug) { + var ret bool + return ret + } + return *o.DiscScsiHotUnplug } -// GetDiscScsiHotUnplugOk returns a tuple with the DiscScsiHotUnplug field value +// GetDiscScsiHotUnplugOk returns a tuple with the DiscScsiHotUnplug 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 *ImageProperties) GetDiscScsiHotUnplugOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.DiscScsiHotUnplug) { return nil, false } - return o.DiscScsiHotUnplug, true } -// SetDiscScsiHotUnplug sets field value -func (o *ImageProperties) SetDiscScsiHotUnplug(v bool) { - - o.DiscScsiHotUnplug = &v - -} - // HasDiscScsiHotUnplug returns a boolean if a field has been set. func (o *ImageProperties) HasDiscScsiHotUnplug() bool { - if o != nil && o.DiscScsiHotUnplug != nil { + if o != nil && !IsNil(o.DiscScsiHotUnplug) { return true } return false } -// GetExposeSerial returns the ExposeSerial field value -// If the value is explicit nil, nil is returned -func (o *ImageProperties) GetExposeSerial() *bool { - if o == nil { - return nil - } - - return o.ExposeSerial +// SetDiscScsiHotUnplug gets a reference to the given bool and assigns it to the DiscScsiHotUnplug field. +func (o *ImageProperties) SetDiscScsiHotUnplug(v bool) { + o.DiscScsiHotUnplug = &v +} +// GetExposeSerial returns the ExposeSerial field value if set, zero value otherwise. +func (o *ImageProperties) GetExposeSerial() bool { + if o == nil || IsNil(o.ExposeSerial) { + var ret bool + return ret + } + return *o.ExposeSerial } -// GetExposeSerialOk returns a tuple with the ExposeSerial field value +// GetExposeSerialOk returns a tuple with the ExposeSerial 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 *ImageProperties) GetExposeSerialOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.ExposeSerial) { return nil, false } - return o.ExposeSerial, true } -// SetExposeSerial sets field value -func (o *ImageProperties) SetExposeSerial(v bool) { - - o.ExposeSerial = &v - -} - // HasExposeSerial returns a boolean if a field has been set. func (o *ImageProperties) HasExposeSerial() bool { - if o != nil && o.ExposeSerial != nil { + if o != nil && !IsNil(o.ExposeSerial) { return true } return false } +// SetExposeSerial gets a reference to the given bool and assigns it to the ExposeSerial field. +func (o *ImageProperties) SetExposeSerial(v bool) { + o.ExposeSerial = &v +} + // GetLicenceType returns the LicenceType field value -// If the value is explicit nil, nil is returned -func (o *ImageProperties) GetLicenceType() *string { +func (o *ImageProperties) GetLicenceType() string { if o == nil { - return nil + var ret string + return ret } return o.LicenceType - } // GetLicenceTypeOk returns a tuple with the LicenceType field value // 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 *ImageProperties) GetLicenceTypeOk() (*string, bool) { if o == nil { return nil, false } - - return o.LicenceType, true + return &o.LicenceType, true } // SetLicenceType sets field value func (o *ImageProperties) SetLicenceType(v string) { - - o.LicenceType = &v - + o.LicenceType = v } -// HasLicenceType returns a boolean if a field has been set. -func (o *ImageProperties) HasLicenceType() bool { - if o != nil && o.LicenceType != nil { - return true - } - - return false -} - -// GetImageType returns the ImageType field value -// If the value is explicit nil, nil is returned -func (o *ImageProperties) GetImageType() *string { - if o == nil { - return nil +// GetImageType returns the ImageType field value if set, zero value otherwise. +func (o *ImageProperties) GetImageType() string { + if o == nil || IsNil(o.ImageType) { + var ret string + return ret } - - return o.ImageType - + return *o.ImageType } -// GetImageTypeOk returns a tuple with the ImageType field value +// GetImageTypeOk returns a tuple with the ImageType 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 *ImageProperties) GetImageTypeOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.ImageType) { return nil, false } - return o.ImageType, true } -// SetImageType sets field value -func (o *ImageProperties) SetImageType(v string) { - - o.ImageType = &v - -} - // HasImageType returns a boolean if a field has been set. func (o *ImageProperties) HasImageType() bool { - if o != nil && o.ImageType != nil { + if o != nil && !IsNil(o.ImageType) { return true } return false } -// GetPublic returns the Public field value -// If the value is explicit nil, nil is returned -func (o *ImageProperties) GetPublic() *bool { - if o == nil { - return nil - } - - return o.Public +// SetImageType gets a reference to the given string and assigns it to the ImageType field. +func (o *ImageProperties) SetImageType(v string) { + o.ImageType = &v +} +// GetPublic returns the Public field value if set, zero value otherwise. +func (o *ImageProperties) 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 +// GetPublicOk returns a tuple with the Public 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 *ImageProperties) GetPublicOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.Public) { return nil, false } - return o.Public, true } -// SetPublic sets field value -func (o *ImageProperties) SetPublic(v bool) { - - o.Public = &v - -} - // HasPublic returns a boolean if a field has been set. func (o *ImageProperties) HasPublic() bool { - if o != nil && o.Public != nil { + if o != nil && !IsNil(o.Public) { return true } return false } -// GetImageAliases returns the ImageAliases field value -// If the value is explicit nil, nil is returned -func (o *ImageProperties) GetImageAliases() *[]string { - if o == nil { - return nil - } +// SetPublic gets a reference to the given bool and assigns it to the Public field. +func (o *ImageProperties) SetPublic(v bool) { + o.Public = &v +} +// GetImageAliases returns the ImageAliases field value if set, zero value otherwise. +func (o *ImageProperties) GetImageAliases() []string { + if o == nil || IsNil(o.ImageAliases) { + var ret []string + return ret + } return o.ImageAliases - } -// GetImageAliasesOk returns a tuple with the ImageAliases field value +// GetImageAliasesOk returns a tuple with the ImageAliases 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 *ImageProperties) GetImageAliasesOk() (*[]string, bool) { - if o == nil { +func (o *ImageProperties) GetImageAliasesOk() ([]string, bool) { + if o == nil || IsNil(o.ImageAliases) { return nil, false } - return o.ImageAliases, true } -// SetImageAliases sets field value -func (o *ImageProperties) SetImageAliases(v []string) { - - o.ImageAliases = &v - -} - // HasImageAliases returns a boolean if a field has been set. func (o *ImageProperties) HasImageAliases() bool { - if o != nil && o.ImageAliases != nil { + if o != nil && !IsNil(o.ImageAliases) { return true } return false } -// GetCloudInit returns the CloudInit field value -// If the value is explicit nil, nil is returned -func (o *ImageProperties) GetCloudInit() *string { - if o == nil { - return nil - } - - return o.CloudInit +// SetImageAliases gets a reference to the given []string and assigns it to the ImageAliases field. +func (o *ImageProperties) SetImageAliases(v []string) { + o.ImageAliases = v +} +// GetCloudInit returns the CloudInit field value if set, zero value otherwise. +func (o *ImageProperties) GetCloudInit() string { + if o == nil || IsNil(o.CloudInit) { + var ret string + return ret + } + return *o.CloudInit } -// GetCloudInitOk returns a tuple with the CloudInit field value +// GetCloudInitOk returns a tuple with the CloudInit 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 *ImageProperties) GetCloudInitOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.CloudInit) { return nil, false } - return o.CloudInit, true } -// SetCloudInit sets field value -func (o *ImageProperties) SetCloudInit(v string) { - - o.CloudInit = &v - -} - // HasCloudInit returns a boolean if a field has been set. func (o *ImageProperties) HasCloudInit() bool { - if o != nil && o.CloudInit != nil { + if o != nil && !IsNil(o.CloudInit) { return true } return false } +// SetCloudInit gets a reference to the given string and assigns it to the CloudInit field. +func (o *ImageProperties) SetCloudInit(v string) { + o.CloudInit = &v +} + func (o ImageProperties) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ImageProperties) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Name != nil { + if !IsNil(o.Name) { toSerialize["name"] = o.Name } - - if o.Description != nil { + if !IsNil(o.Description) { toSerialize["description"] = o.Description } - - if o.Location != nil { + if !IsNil(o.Location) { toSerialize["location"] = o.Location } - - if o.Size != nil { + if !IsNil(o.Size) { toSerialize["size"] = o.Size } - - if o.CpuHotPlug != nil { + if !IsNil(o.CpuHotPlug) { toSerialize["cpuHotPlug"] = o.CpuHotPlug } - - if o.CpuHotUnplug != nil { + if !IsNil(o.CpuHotUnplug) { toSerialize["cpuHotUnplug"] = o.CpuHotUnplug } - - if o.RamHotPlug != nil { + if !IsNil(o.RamHotPlug) { toSerialize["ramHotPlug"] = o.RamHotPlug } - - if o.RamHotUnplug != nil { + if !IsNil(o.RamHotUnplug) { toSerialize["ramHotUnplug"] = o.RamHotUnplug } - - if o.NicHotPlug != nil { + if !IsNil(o.NicHotPlug) { toSerialize["nicHotPlug"] = o.NicHotPlug } - - if o.NicHotUnplug != nil { + if !IsNil(o.NicHotUnplug) { toSerialize["nicHotUnplug"] = o.NicHotUnplug } - - if o.DiscVirtioHotPlug != nil { + if !IsNil(o.DiscVirtioHotPlug) { toSerialize["discVirtioHotPlug"] = o.DiscVirtioHotPlug } - - if o.DiscVirtioHotUnplug != nil { + if !IsNil(o.DiscVirtioHotUnplug) { toSerialize["discVirtioHotUnplug"] = o.DiscVirtioHotUnplug } - - if o.DiscScsiHotPlug != nil { + if !IsNil(o.DiscScsiHotPlug) { toSerialize["discScsiHotPlug"] = o.DiscScsiHotPlug } - - if o.DiscScsiHotUnplug != nil { + if !IsNil(o.DiscScsiHotUnplug) { toSerialize["discScsiHotUnplug"] = o.DiscScsiHotUnplug } - - if o.ExposeSerial != nil { + if !IsNil(o.ExposeSerial) { toSerialize["exposeSerial"] = o.ExposeSerial } - - if o.LicenceType != nil { - toSerialize["licenceType"] = o.LicenceType - } - - if o.ImageType != nil { + toSerialize["licenceType"] = o.LicenceType + if !IsNil(o.ImageType) { toSerialize["imageType"] = o.ImageType } - - if o.Public != nil { + if !IsNil(o.Public) { toSerialize["public"] = o.Public } - - if o.ImageAliases != nil { + if !IsNil(o.ImageAliases) { toSerialize["imageAliases"] = o.ImageAliases } - - if o.CloudInit != nil { + if !IsNil(o.CloudInit) { toSerialize["cloudInit"] = o.CloudInit } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableImageProperties struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_images.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_images.go similarity index 64% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_images.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_images.go index 86a9e4f07..a52d2931f 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_images.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_images.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the Images type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Images{} + // Images struct for Images type Images struct { // The resource's unique identifier. @@ -23,7 +26,7 @@ type Images struct { // The URL to the object representation (absolute path). Href *string `json:"href,omitempty"` // Array of items in the collection. - Items *[]Image `json:"items,omitempty"` + Items []Image `json:"items,omitempty"` } // NewImages instantiates a new Images object @@ -44,177 +47,157 @@ func NewImagesWithDefaults() *Images { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *Images) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *Images) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *Images) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *Images) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *Images) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *Images) GetType() *Type { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Images) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *Images) GetType() Type { + if o == nil || IsNil(o.Type) { + var ret Type + return ret + } + return *o.Type } -// GetTypeOk returns a tuple with the Type field value +// GetTypeOk returns a tuple with the Type 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 *Images) GetTypeOk() (*Type, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *Images) SetType(v Type) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *Images) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *Images) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given Type and assigns it to the Type field. +func (o *Images) SetType(v Type) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *Images) 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 +// GetHrefOk returns a tuple with the Href 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 *Images) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *Images) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *Images) HasHref() bool { - if o != nil && o.Href != nil { + if o != nil && !IsNil(o.Href) { return true } return false } -// GetItems returns the Items field value -// If the value is explicit nil, nil is returned -func (o *Images) GetItems() *[]Image { - if o == nil { - return nil - } +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *Images) SetHref(v string) { + o.Href = &v +} +// GetItems returns the Items field value if set, zero value otherwise. +func (o *Images) GetItems() []Image { + if o == nil || IsNil(o.Items) { + var ret []Image + return ret + } return o.Items - } -// GetItemsOk returns a tuple with the Items field value +// GetItemsOk returns a tuple with the Items 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 *Images) GetItemsOk() (*[]Image, bool) { - if o == nil { +func (o *Images) GetItemsOk() ([]Image, bool) { + if o == nil || IsNil(o.Items) { return nil, false } - return o.Items, true } -// SetItems sets field value -func (o *Images) SetItems(v []Image) { - - o.Items = &v - -} - // HasItems returns a boolean if a field has been set. func (o *Images) HasItems() bool { - if o != nil && o.Items != nil { + if o != nil && !IsNil(o.Items) { return true } return false } +// SetItems gets a reference to the given []Image and assigns it to the Items field. +func (o *Images) SetItems(v []Image) { + o.Items = v +} + func (o Images) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Images) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Items != nil { + if !IsNil(o.Items) { toSerialize["items"] = o.Items } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableImages struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_info.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_info.go similarity index 67% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_info.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_info.go index 1b3ec09cf..6d1aef6c5 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_info.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_info.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the Info type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Info{} + // Info struct for Info type Info struct { // The API entry point. @@ -42,135 +45,122 @@ func NewInfoWithDefaults() *Info { return &this } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *Info) GetHref() *string { - if o == nil { - return nil +// GetHref returns the Href field value if set, zero value otherwise. +func (o *Info) GetHref() string { + if o == nil || IsNil(o.Href) { + var ret string + return ret } - - return o.Href - + return *o.Href } -// GetHrefOk returns a tuple with the Href field value +// GetHrefOk returns a tuple with the Href 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 *Info) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *Info) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *Info) HasHref() bool { - if o != nil && o.Href != nil { + if o != nil && !IsNil(o.Href) { return true } return false } -// GetName returns the Name field value -// If the value is explicit nil, nil is returned -func (o *Info) GetName() *string { - if o == nil { - return nil - } - - return o.Name +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *Info) SetHref(v string) { + o.Href = &v +} +// GetName returns the Name field value if set, zero value otherwise. +func (o *Info) 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 +// GetNameOk returns a tuple with the Name 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 *Info) GetNameOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Name) { return nil, false } - return o.Name, true } -// SetName sets field value -func (o *Info) SetName(v string) { - - o.Name = &v - -} - // HasName returns a boolean if a field has been set. func (o *Info) HasName() bool { - if o != nil && o.Name != nil { + if o != nil && !IsNil(o.Name) { return true } return false } -// GetVersion returns the Version field value -// If the value is explicit nil, nil is returned -func (o *Info) GetVersion() *string { - if o == nil { - return nil - } - - return o.Version +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *Info) SetName(v string) { + o.Name = &v +} +// GetVersion returns the Version field value if set, zero value otherwise. +func (o *Info) 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 +// GetVersionOk returns a tuple with the Version 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 *Info) GetVersionOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Version) { return nil, false } - return o.Version, true } -// SetVersion sets field value -func (o *Info) SetVersion(v string) { - - o.Version = &v - -} - // HasVersion returns a boolean if a field has been set. func (o *Info) HasVersion() bool { - if o != nil && o.Version != nil { + 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 *Info) SetVersion(v string) { + o.Version = &v +} + func (o Info) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Info) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Name != nil { + if !IsNil(o.Name) { toSerialize["name"] = o.Name } - - if o.Version != nil { + if !IsNil(o.Version) { toSerialize["version"] = o.Version } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableInfo struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_ip_block.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_ip_block.go similarity index 65% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_ip_block.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_ip_block.go index 8d08aac82..0bbbcd290 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_ip_block.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_ip_block.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the IpBlock type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &IpBlock{} + // IpBlock struct for IpBlock type IpBlock struct { // The resource's unique identifier. @@ -23,7 +26,7 @@ type IpBlock struct { // URL to the object representation (absolute path). Href *string `json:"href,omitempty"` Metadata *DatacenterElementMetadata `json:"metadata,omitempty"` - Properties *IpBlockProperties `json:"properties"` + Properties IpBlockProperties `json:"properties"` } // NewIpBlock instantiates a new IpBlock object @@ -33,7 +36,7 @@ type IpBlock struct { func NewIpBlock(properties IpBlockProperties) *IpBlock { this := IpBlock{} - this.Properties = &properties + this.Properties = properties return &this } @@ -46,219 +49,182 @@ func NewIpBlockWithDefaults() *IpBlock { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *IpBlock) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *IpBlock) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *IpBlock) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *IpBlock) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *IpBlock) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *IpBlock) GetType() *Type { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *IpBlock) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *IpBlock) GetType() Type { + if o == nil || IsNil(o.Type) { + var ret Type + return ret + } + return *o.Type } -// GetTypeOk returns a tuple with the Type field value +// GetTypeOk returns a tuple with the Type 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 *IpBlock) GetTypeOk() (*Type, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *IpBlock) SetType(v Type) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *IpBlock) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *IpBlock) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given Type and assigns it to the Type field. +func (o *IpBlock) SetType(v Type) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *IpBlock) 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 +// GetHrefOk returns a tuple with the Href 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 *IpBlock) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *IpBlock) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *IpBlock) HasHref() bool { - if o != nil && o.Href != nil { + if o != nil && !IsNil(o.Href) { return true } return false } -// GetMetadata returns the Metadata field value -// If the value is explicit nil, nil is returned -func (o *IpBlock) GetMetadata() *DatacenterElementMetadata { - if o == nil { - return nil - } - - return o.Metadata +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *IpBlock) SetHref(v string) { + o.Href = &v +} +// GetMetadata returns the Metadata field value if set, zero value otherwise. +func (o *IpBlock) GetMetadata() DatacenterElementMetadata { + if o == nil || IsNil(o.Metadata) { + var ret DatacenterElementMetadata + return ret + } + return *o.Metadata } -// GetMetadataOk returns a tuple with the Metadata field value +// GetMetadataOk returns a tuple with the Metadata 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 *IpBlock) GetMetadataOk() (*DatacenterElementMetadata, bool) { - if o == nil { + if o == nil || IsNil(o.Metadata) { return nil, false } - return o.Metadata, true } -// SetMetadata sets field value -func (o *IpBlock) SetMetadata(v DatacenterElementMetadata) { - - o.Metadata = &v - -} - // HasMetadata returns a boolean if a field has been set. func (o *IpBlock) HasMetadata() bool { - if o != nil && o.Metadata != nil { + if o != nil && !IsNil(o.Metadata) { return true } return false } +// SetMetadata gets a reference to the given DatacenterElementMetadata and assigns it to the Metadata field. +func (o *IpBlock) SetMetadata(v DatacenterElementMetadata) { + o.Metadata = &v +} + // GetProperties returns the Properties field value -// If the value is explicit nil, nil is returned -func (o *IpBlock) GetProperties() *IpBlockProperties { +func (o *IpBlock) GetProperties() IpBlockProperties { if o == nil { - return nil + var ret IpBlockProperties + return ret } return o.Properties - } // GetPropertiesOk returns a tuple with the Properties field value // 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 *IpBlock) GetPropertiesOk() (*IpBlockProperties, bool) { if o == nil { return nil, false } - - return o.Properties, true + return &o.Properties, true } // SetProperties sets field value func (o *IpBlock) SetProperties(v IpBlockProperties) { - - o.Properties = &v - + o.Properties = v } -// HasProperties returns a boolean if a field has been set. -func (o *IpBlock) HasProperties() bool { - if o != nil && o.Properties != nil { - return true +func (o IpBlock) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } - - return false + return json.Marshal(toSerialize) } -func (o IpBlock) MarshalJSON() ([]byte, error) { +func (o IpBlock) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Metadata != nil { + if !IsNil(o.Metadata) { toSerialize["metadata"] = o.Metadata } - - if o.Properties != nil { - toSerialize["properties"] = o.Properties - } - - return json.Marshal(toSerialize) + toSerialize["properties"] = o.Properties + return toSerialize, nil } type NullableIpBlock struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_ip_block_properties.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_ip_block_properties.go similarity index 65% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_ip_block_properties.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_ip_block_properties.go index 7bf5a9866..bfbebcaa5 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_ip_block_properties.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_ip_block_properties.go @@ -14,18 +14,21 @@ import ( "encoding/json" ) +// checks if the IpBlockProperties type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &IpBlockProperties{} + // IpBlockProperties struct for IpBlockProperties type IpBlockProperties struct { // Collection of IPs, associated with the IP Block. - Ips *[]string `json:"ips,omitempty"` + Ips []string `json:"ips,omitempty"` // Location of that IP block. Property cannot be modified after it is created (disallowed in update requests). - Location *string `json:"location"` + Location string `json:"location"` // The size of the IP block. - Size *int32 `json:"size"` + Size int32 `json:"size"` // The name of the resource. Name *string `json:"name,omitempty"` // Read-Only attribute. Lists consumption detail for an individual IP - IpConsumers *[]IpConsumer `json:"ipConsumers,omitempty"` + IpConsumers []IpConsumer `json:"ipConsumers,omitempty"` } // NewIpBlockProperties instantiates a new IpBlockProperties object @@ -35,8 +38,8 @@ type IpBlockProperties struct { func NewIpBlockProperties(location string, size int32) *IpBlockProperties { this := IpBlockProperties{} - this.Location = &location - this.Size = &size + this.Location = location + this.Size = size return &this } @@ -49,219 +52,172 @@ func NewIpBlockPropertiesWithDefaults() *IpBlockProperties { return &this } -// GetIps returns the Ips field value -// If the value is explicit nil, nil is returned -func (o *IpBlockProperties) GetIps() *[]string { - if o == nil { - return nil +// GetIps returns the Ips field value if set, zero value otherwise. +func (o *IpBlockProperties) GetIps() []string { + if o == nil || IsNil(o.Ips) { + var ret []string + return ret } - return o.Ips - } -// GetIpsOk returns a tuple with the Ips field value +// GetIpsOk returns a tuple with the Ips 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 *IpBlockProperties) GetIpsOk() (*[]string, bool) { - if o == nil { +func (o *IpBlockProperties) GetIpsOk() ([]string, bool) { + if o == nil || IsNil(o.Ips) { return nil, false } - return o.Ips, true } -// SetIps sets field value -func (o *IpBlockProperties) SetIps(v []string) { - - o.Ips = &v - -} - // HasIps returns a boolean if a field has been set. func (o *IpBlockProperties) HasIps() bool { - if o != nil && o.Ips != nil { + if o != nil && !IsNil(o.Ips) { return true } return false } +// SetIps gets a reference to the given []string and assigns it to the Ips field. +func (o *IpBlockProperties) SetIps(v []string) { + o.Ips = v +} + // GetLocation returns the Location field value -// If the value is explicit nil, nil is returned -func (o *IpBlockProperties) GetLocation() *string { +func (o *IpBlockProperties) GetLocation() string { if o == nil { - return nil + var ret string + return ret } return o.Location - } // GetLocationOk returns a tuple with the Location field value // 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 *IpBlockProperties) GetLocationOk() (*string, bool) { if o == nil { return nil, false } - - return o.Location, true + return &o.Location, true } // SetLocation sets field value func (o *IpBlockProperties) SetLocation(v string) { - - o.Location = &v - -} - -// HasLocation returns a boolean if a field has been set. -func (o *IpBlockProperties) HasLocation() bool { - if o != nil && o.Location != nil { - return true - } - - return false + o.Location = v } // GetSize returns the Size field value -// If the value is explicit nil, nil is returned -func (o *IpBlockProperties) GetSize() *int32 { +func (o *IpBlockProperties) GetSize() int32 { if o == nil { - return nil + var ret int32 + return ret } return o.Size - } // GetSizeOk returns a tuple with the Size field value // 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 *IpBlockProperties) GetSizeOk() (*int32, bool) { if o == nil { return nil, false } - - return o.Size, true + return &o.Size, true } // SetSize sets field value func (o *IpBlockProperties) SetSize(v int32) { - - o.Size = &v - + o.Size = v } -// HasSize returns a boolean if a field has been set. -func (o *IpBlockProperties) HasSize() bool { - if o != nil && o.Size != nil { - return true +// GetName returns the Name field value if set, zero value otherwise. +func (o *IpBlockProperties) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret } - - return false -} - -// GetName returns the Name field value -// If the value is explicit nil, nil is returned -func (o *IpBlockProperties) GetName() *string { - if o == nil { - return nil - } - - return o.Name - + return *o.Name } -// GetNameOk returns a tuple with the Name field value +// GetNameOk returns a tuple with the Name 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 *IpBlockProperties) GetNameOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Name) { return nil, false } - return o.Name, true } -// SetName sets field value -func (o *IpBlockProperties) SetName(v string) { - - o.Name = &v - -} - // HasName returns a boolean if a field has been set. func (o *IpBlockProperties) HasName() bool { - if o != nil && o.Name != nil { + if o != nil && !IsNil(o.Name) { return true } return false } -// GetIpConsumers returns the IpConsumers field value -// If the value is explicit nil, nil is returned -func (o *IpBlockProperties) GetIpConsumers() *[]IpConsumer { - if o == nil { - return nil - } +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *IpBlockProperties) SetName(v string) { + o.Name = &v +} +// GetIpConsumers returns the IpConsumers field value if set, zero value otherwise. +func (o *IpBlockProperties) GetIpConsumers() []IpConsumer { + if o == nil || IsNil(o.IpConsumers) { + var ret []IpConsumer + return ret + } return o.IpConsumers - } -// GetIpConsumersOk returns a tuple with the IpConsumers field value +// GetIpConsumersOk returns a tuple with the IpConsumers 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 *IpBlockProperties) GetIpConsumersOk() (*[]IpConsumer, bool) { - if o == nil { +func (o *IpBlockProperties) GetIpConsumersOk() ([]IpConsumer, bool) { + if o == nil || IsNil(o.IpConsumers) { return nil, false } - return o.IpConsumers, true } -// SetIpConsumers sets field value -func (o *IpBlockProperties) SetIpConsumers(v []IpConsumer) { - - o.IpConsumers = &v - -} - // HasIpConsumers returns a boolean if a field has been set. func (o *IpBlockProperties) HasIpConsumers() bool { - if o != nil && o.IpConsumers != nil { + if o != nil && !IsNil(o.IpConsumers) { return true } return false } -func (o IpBlockProperties) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.Ips != nil { - toSerialize["ips"] = o.Ips - } +// SetIpConsumers gets a reference to the given []IpConsumer and assigns it to the IpConsumers field. +func (o *IpBlockProperties) SetIpConsumers(v []IpConsumer) { + o.IpConsumers = v +} - if o.Location != nil { - toSerialize["location"] = o.Location +func (o IpBlockProperties) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } + return json.Marshal(toSerialize) +} - if o.Size != nil { - toSerialize["size"] = o.Size +func (o IpBlockProperties) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Ips) { + toSerialize["ips"] = o.Ips } - - if o.Name != nil { + toSerialize["location"] = o.Location + toSerialize["size"] = o.Size + if !IsNil(o.Name) { toSerialize["name"] = o.Name } - - if o.IpConsumers != nil { + if !IsNil(o.IpConsumers) { toSerialize["ipConsumers"] = o.IpConsumers } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableIpBlockProperties struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_ip_blocks.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_ip_blocks.go similarity index 60% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_ip_blocks.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_ip_blocks.go index 0d122328a..2ca16e545 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_ip_blocks.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_ip_blocks.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the IpBlocks type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &IpBlocks{} + // IpBlocks struct for IpBlocks type IpBlocks struct { // The resource's unique identifier. @@ -23,7 +26,7 @@ type IpBlocks struct { // URL to the object representation (absolute path). Href *string `json:"href,omitempty"` // Array of items in the collection. - Items *[]IpBlock `json:"items,omitempty"` + Items []IpBlock `json:"items,omitempty"` // The offset, specified in the request (if not is specified, 0 is used by default). Offset *float32 `json:"offset,omitempty"` // The limit, specified in the request (if not specified, the endpoint's default pagination limit is used). @@ -49,303 +52,262 @@ func NewIpBlocksWithDefaults() *IpBlocks { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *IpBlocks) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *IpBlocks) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *IpBlocks) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *IpBlocks) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *IpBlocks) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *IpBlocks) GetType() *Type { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *IpBlocks) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *IpBlocks) GetType() Type { + if o == nil || IsNil(o.Type) { + var ret Type + return ret + } + return *o.Type } -// GetTypeOk returns a tuple with the Type field value +// GetTypeOk returns a tuple with the Type 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 *IpBlocks) GetTypeOk() (*Type, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *IpBlocks) SetType(v Type) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *IpBlocks) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *IpBlocks) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given Type and assigns it to the Type field. +func (o *IpBlocks) SetType(v Type) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *IpBlocks) 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 +// GetHrefOk returns a tuple with the Href 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 *IpBlocks) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *IpBlocks) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *IpBlocks) HasHref() bool { - if o != nil && o.Href != nil { + if o != nil && !IsNil(o.Href) { return true } return false } -// GetItems returns the Items field value -// If the value is explicit nil, nil is returned -func (o *IpBlocks) GetItems() *[]IpBlock { - if o == nil { - return nil - } +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *IpBlocks) SetHref(v string) { + o.Href = &v +} +// GetItems returns the Items field value if set, zero value otherwise. +func (o *IpBlocks) GetItems() []IpBlock { + if o == nil || IsNil(o.Items) { + var ret []IpBlock + return ret + } return o.Items - } -// GetItemsOk returns a tuple with the Items field value +// GetItemsOk returns a tuple with the Items 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 *IpBlocks) GetItemsOk() (*[]IpBlock, bool) { - if o == nil { +func (o *IpBlocks) GetItemsOk() ([]IpBlock, bool) { + if o == nil || IsNil(o.Items) { return nil, false } - return o.Items, true } -// SetItems sets field value -func (o *IpBlocks) SetItems(v []IpBlock) { - - o.Items = &v - -} - // HasItems returns a boolean if a field has been set. func (o *IpBlocks) HasItems() bool { - if o != nil && o.Items != nil { + if o != nil && !IsNil(o.Items) { return true } return false } -// GetOffset returns the Offset field value -// If the value is explicit nil, nil is returned -func (o *IpBlocks) GetOffset() *float32 { - if o == nil { - return nil - } - - return o.Offset +// SetItems gets a reference to the given []IpBlock and assigns it to the Items field. +func (o *IpBlocks) SetItems(v []IpBlock) { + o.Items = v +} +// GetOffset returns the Offset field value if set, zero value otherwise. +func (o *IpBlocks) GetOffset() float32 { + if o == nil || IsNil(o.Offset) { + var ret float32 + return ret + } + return *o.Offset } -// GetOffsetOk returns a tuple with the Offset field value +// GetOffsetOk returns a tuple with the Offset 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 *IpBlocks) GetOffsetOk() (*float32, bool) { - if o == nil { + if o == nil || IsNil(o.Offset) { return nil, false } - return o.Offset, true } -// SetOffset sets field value -func (o *IpBlocks) SetOffset(v float32) { - - o.Offset = &v - -} - // HasOffset returns a boolean if a field has been set. func (o *IpBlocks) HasOffset() bool { - if o != nil && o.Offset != nil { + if o != nil && !IsNil(o.Offset) { return true } return false } -// GetLimit returns the Limit field value -// If the value is explicit nil, nil is returned -func (o *IpBlocks) GetLimit() *float32 { - if o == nil { - return nil - } - - return o.Limit +// SetOffset gets a reference to the given float32 and assigns it to the Offset field. +func (o *IpBlocks) SetOffset(v float32) { + o.Offset = &v +} +// GetLimit returns the Limit field value if set, zero value otherwise. +func (o *IpBlocks) GetLimit() float32 { + if o == nil || IsNil(o.Limit) { + var ret float32 + return ret + } + return *o.Limit } -// GetLimitOk returns a tuple with the Limit field value +// GetLimitOk returns a tuple with the Limit 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 *IpBlocks) GetLimitOk() (*float32, bool) { - if o == nil { + if o == nil || IsNil(o.Limit) { return nil, false } - return o.Limit, true } -// SetLimit sets field value -func (o *IpBlocks) SetLimit(v float32) { - - o.Limit = &v - -} - // HasLimit returns a boolean if a field has been set. func (o *IpBlocks) HasLimit() bool { - if o != nil && o.Limit != nil { + if o != nil && !IsNil(o.Limit) { return true } return false } -// GetLinks returns the Links field value -// If the value is explicit nil, nil is returned -func (o *IpBlocks) GetLinks() *PaginationLinks { - if o == nil { - return nil - } - - return o.Links +// SetLimit gets a reference to the given float32 and assigns it to the Limit field. +func (o *IpBlocks) SetLimit(v float32) { + o.Limit = &v +} +// GetLinks returns the Links field value if set, zero value otherwise. +func (o *IpBlocks) GetLinks() PaginationLinks { + if o == nil || IsNil(o.Links) { + var ret PaginationLinks + return ret + } + return *o.Links } -// GetLinksOk returns a tuple with the Links field value +// GetLinksOk returns a tuple with the Links 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 *IpBlocks) GetLinksOk() (*PaginationLinks, bool) { - if o == nil { + if o == nil || IsNil(o.Links) { return nil, false } - return o.Links, true } -// SetLinks sets field value -func (o *IpBlocks) SetLinks(v PaginationLinks) { - - o.Links = &v - -} - // HasLinks returns a boolean if a field has been set. func (o *IpBlocks) HasLinks() bool { - if o != nil && o.Links != nil { + if o != nil && !IsNil(o.Links) { return true } return false } +// SetLinks gets a reference to the given PaginationLinks and assigns it to the Links field. +func (o *IpBlocks) SetLinks(v PaginationLinks) { + o.Links = &v +} + func (o IpBlocks) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o IpBlocks) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Items != nil { + if !IsNil(o.Items) { toSerialize["items"] = o.Items } - - if o.Offset != nil { + if !IsNil(o.Offset) { toSerialize["offset"] = o.Offset } - - if o.Limit != nil { + if !IsNil(o.Limit) { toSerialize["limit"] = o.Limit } - - if o.Links != nil { + if !IsNil(o.Links) { toSerialize["_links"] = o.Links } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableIpBlocks struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_ip_consumer.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_ip_consumer.go similarity index 60% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_ip_consumer.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_ip_consumer.go index 66e544c2d..e30d7ae1c 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_ip_consumer.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_ip_consumer.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the IpConsumer type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &IpConsumer{} + // IpConsumer struct for IpConsumer type IpConsumer struct { Ip *string `json:"ip,omitempty"` @@ -45,387 +48,332 @@ func NewIpConsumerWithDefaults() *IpConsumer { return &this } -// GetIp returns the Ip field value -// If the value is explicit nil, nil is returned -func (o *IpConsumer) GetIp() *string { - if o == nil { - return nil +// GetIp returns the Ip field value if set, zero value otherwise. +func (o *IpConsumer) GetIp() string { + if o == nil || IsNil(o.Ip) { + var ret string + return ret } - - return o.Ip - + return *o.Ip } -// GetIpOk returns a tuple with the Ip field value +// GetIpOk returns a tuple with the Ip 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 *IpConsumer) GetIpOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Ip) { return nil, false } - return o.Ip, true } -// SetIp sets field value -func (o *IpConsumer) SetIp(v string) { - - o.Ip = &v - -} - // HasIp returns a boolean if a field has been set. func (o *IpConsumer) HasIp() bool { - if o != nil && o.Ip != nil { + if o != nil && !IsNil(o.Ip) { return true } return false } -// GetMac returns the Mac field value -// If the value is explicit nil, nil is returned -func (o *IpConsumer) GetMac() *string { - if o == nil { - return nil - } - - return o.Mac +// SetIp gets a reference to the given string and assigns it to the Ip field. +func (o *IpConsumer) SetIp(v string) { + o.Ip = &v +} +// GetMac returns the Mac field value if set, zero value otherwise. +func (o *IpConsumer) 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 +// GetMacOk returns a tuple with the Mac 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 *IpConsumer) GetMacOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Mac) { return nil, false } - return o.Mac, true } -// SetMac sets field value -func (o *IpConsumer) SetMac(v string) { - - o.Mac = &v - -} - // HasMac returns a boolean if a field has been set. func (o *IpConsumer) HasMac() bool { - if o != nil && o.Mac != nil { + if o != nil && !IsNil(o.Mac) { return true } return false } -// GetNicId returns the NicId field value -// If the value is explicit nil, nil is returned -func (o *IpConsumer) GetNicId() *string { - if o == nil { - return nil - } - - return o.NicId +// SetMac gets a reference to the given string and assigns it to the Mac field. +func (o *IpConsumer) SetMac(v string) { + o.Mac = &v +} +// GetNicId returns the NicId field value if set, zero value otherwise. +func (o *IpConsumer) GetNicId() string { + if o == nil || IsNil(o.NicId) { + var ret string + return ret + } + return *o.NicId } -// GetNicIdOk returns a tuple with the NicId field value +// GetNicIdOk returns a tuple with the NicId 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 *IpConsumer) GetNicIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.NicId) { return nil, false } - return o.NicId, true } -// SetNicId sets field value -func (o *IpConsumer) SetNicId(v string) { - - o.NicId = &v - -} - // HasNicId returns a boolean if a field has been set. func (o *IpConsumer) HasNicId() bool { - if o != nil && o.NicId != nil { + if o != nil && !IsNil(o.NicId) { return true } return false } -// GetServerId returns the ServerId field value -// If the value is explicit nil, nil is returned -func (o *IpConsumer) GetServerId() *string { - if o == nil { - return nil - } - - return o.ServerId +// SetNicId gets a reference to the given string and assigns it to the NicId field. +func (o *IpConsumer) SetNicId(v string) { + o.NicId = &v +} +// GetServerId returns the ServerId field value if set, zero value otherwise. +func (o *IpConsumer) GetServerId() string { + if o == nil || IsNil(o.ServerId) { + var ret string + return ret + } + return *o.ServerId } -// GetServerIdOk returns a tuple with the ServerId field value +// GetServerIdOk returns a tuple with the ServerId 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 *IpConsumer) GetServerIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.ServerId) { return nil, false } - return o.ServerId, true } -// SetServerId sets field value -func (o *IpConsumer) SetServerId(v string) { - - o.ServerId = &v - -} - // HasServerId returns a boolean if a field has been set. func (o *IpConsumer) HasServerId() bool { - if o != nil && o.ServerId != nil { + if o != nil && !IsNil(o.ServerId) { return true } return false } -// GetServerName returns the ServerName field value -// If the value is explicit nil, nil is returned -func (o *IpConsumer) GetServerName() *string { - if o == nil { - return nil - } - - return o.ServerName +// SetServerId gets a reference to the given string and assigns it to the ServerId field. +func (o *IpConsumer) SetServerId(v string) { + o.ServerId = &v +} +// GetServerName returns the ServerName field value if set, zero value otherwise. +func (o *IpConsumer) GetServerName() string { + if o == nil || IsNil(o.ServerName) { + var ret string + return ret + } + return *o.ServerName } -// GetServerNameOk returns a tuple with the ServerName field value +// GetServerNameOk returns a tuple with the ServerName 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 *IpConsumer) GetServerNameOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.ServerName) { return nil, false } - return o.ServerName, true } -// SetServerName sets field value -func (o *IpConsumer) SetServerName(v string) { - - o.ServerName = &v - -} - // HasServerName returns a boolean if a field has been set. func (o *IpConsumer) HasServerName() bool { - if o != nil && o.ServerName != nil { + if o != nil && !IsNil(o.ServerName) { return true } return false } -// GetDatacenterId returns the DatacenterId field value -// If the value is explicit nil, nil is returned -func (o *IpConsumer) GetDatacenterId() *string { - if o == nil { - return nil - } - - return o.DatacenterId +// SetServerName gets a reference to the given string and assigns it to the ServerName field. +func (o *IpConsumer) SetServerName(v string) { + o.ServerName = &v +} +// GetDatacenterId returns the DatacenterId field value if set, zero value otherwise. +func (o *IpConsumer) GetDatacenterId() string { + if o == nil || IsNil(o.DatacenterId) { + var ret string + return ret + } + return *o.DatacenterId } -// GetDatacenterIdOk returns a tuple with the DatacenterId field value +// GetDatacenterIdOk returns a tuple with the DatacenterId 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 *IpConsumer) GetDatacenterIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.DatacenterId) { return nil, false } - return o.DatacenterId, true } -// SetDatacenterId sets field value -func (o *IpConsumer) SetDatacenterId(v string) { - - o.DatacenterId = &v - -} - // HasDatacenterId returns a boolean if a field has been set. func (o *IpConsumer) HasDatacenterId() bool { - if o != nil && o.DatacenterId != nil { + if o != nil && !IsNil(o.DatacenterId) { return true } return false } -// GetDatacenterName returns the DatacenterName field value -// If the value is explicit nil, nil is returned -func (o *IpConsumer) GetDatacenterName() *string { - if o == nil { - return nil - } - - return o.DatacenterName +// SetDatacenterId gets a reference to the given string and assigns it to the DatacenterId field. +func (o *IpConsumer) SetDatacenterId(v string) { + o.DatacenterId = &v +} +// GetDatacenterName returns the DatacenterName field value if set, zero value otherwise. +func (o *IpConsumer) GetDatacenterName() string { + if o == nil || IsNil(o.DatacenterName) { + var ret string + return ret + } + return *o.DatacenterName } -// GetDatacenterNameOk returns a tuple with the DatacenterName field value +// GetDatacenterNameOk returns a tuple with the DatacenterName 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 *IpConsumer) GetDatacenterNameOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.DatacenterName) { return nil, false } - return o.DatacenterName, true } -// SetDatacenterName sets field value -func (o *IpConsumer) SetDatacenterName(v string) { - - o.DatacenterName = &v - -} - // HasDatacenterName returns a boolean if a field has been set. func (o *IpConsumer) HasDatacenterName() bool { - if o != nil && o.DatacenterName != nil { + if o != nil && !IsNil(o.DatacenterName) { return true } return false } -// GetK8sNodePoolUuid returns the K8sNodePoolUuid field value -// If the value is explicit nil, nil is returned -func (o *IpConsumer) GetK8sNodePoolUuid() *string { - if o == nil { - return nil - } - - return o.K8sNodePoolUuid +// SetDatacenterName gets a reference to the given string and assigns it to the DatacenterName field. +func (o *IpConsumer) SetDatacenterName(v string) { + o.DatacenterName = &v +} +// GetK8sNodePoolUuid returns the K8sNodePoolUuid field value if set, zero value otherwise. +func (o *IpConsumer) GetK8sNodePoolUuid() string { + if o == nil || IsNil(o.K8sNodePoolUuid) { + var ret string + return ret + } + return *o.K8sNodePoolUuid } -// GetK8sNodePoolUuidOk returns a tuple with the K8sNodePoolUuid field value +// GetK8sNodePoolUuidOk returns a tuple with the K8sNodePoolUuid 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 *IpConsumer) GetK8sNodePoolUuidOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.K8sNodePoolUuid) { return nil, false } - return o.K8sNodePoolUuid, true } -// SetK8sNodePoolUuid sets field value -func (o *IpConsumer) SetK8sNodePoolUuid(v string) { - - o.K8sNodePoolUuid = &v - -} - // HasK8sNodePoolUuid returns a boolean if a field has been set. func (o *IpConsumer) HasK8sNodePoolUuid() bool { - if o != nil && o.K8sNodePoolUuid != nil { + if o != nil && !IsNil(o.K8sNodePoolUuid) { return true } return false } -// GetK8sClusterUuid returns the K8sClusterUuid field value -// If the value is explicit nil, nil is returned -func (o *IpConsumer) GetK8sClusterUuid() *string { - if o == nil { - return nil - } - - return o.K8sClusterUuid +// SetK8sNodePoolUuid gets a reference to the given string and assigns it to the K8sNodePoolUuid field. +func (o *IpConsumer) SetK8sNodePoolUuid(v string) { + o.K8sNodePoolUuid = &v +} +// GetK8sClusterUuid returns the K8sClusterUuid field value if set, zero value otherwise. +func (o *IpConsumer) GetK8sClusterUuid() string { + if o == nil || IsNil(o.K8sClusterUuid) { + var ret string + return ret + } + return *o.K8sClusterUuid } -// GetK8sClusterUuidOk returns a tuple with the K8sClusterUuid field value +// GetK8sClusterUuidOk returns a tuple with the K8sClusterUuid 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 *IpConsumer) GetK8sClusterUuidOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.K8sClusterUuid) { return nil, false } - return o.K8sClusterUuid, true } -// SetK8sClusterUuid sets field value -func (o *IpConsumer) SetK8sClusterUuid(v string) { - - o.K8sClusterUuid = &v - -} - // HasK8sClusterUuid returns a boolean if a field has been set. func (o *IpConsumer) HasK8sClusterUuid() bool { - if o != nil && o.K8sClusterUuid != nil { + if o != nil && !IsNil(o.K8sClusterUuid) { return true } return false } +// SetK8sClusterUuid gets a reference to the given string and assigns it to the K8sClusterUuid field. +func (o *IpConsumer) SetK8sClusterUuid(v string) { + o.K8sClusterUuid = &v +} + func (o IpConsumer) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o IpConsumer) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Ip != nil { + if !IsNil(o.Ip) { toSerialize["ip"] = o.Ip } - - if o.Mac != nil { + if !IsNil(o.Mac) { toSerialize["mac"] = o.Mac } - - if o.NicId != nil { + if !IsNil(o.NicId) { toSerialize["nicId"] = o.NicId } - - if o.ServerId != nil { + if !IsNil(o.ServerId) { toSerialize["serverId"] = o.ServerId } - - if o.ServerName != nil { + if !IsNil(o.ServerName) { toSerialize["serverName"] = o.ServerName } - - if o.DatacenterId != nil { + if !IsNil(o.DatacenterId) { toSerialize["datacenterId"] = o.DatacenterId } - - if o.DatacenterName != nil { + if !IsNil(o.DatacenterName) { toSerialize["datacenterName"] = o.DatacenterName } - - if o.K8sNodePoolUuid != nil { + if !IsNil(o.K8sNodePoolUuid) { toSerialize["k8sNodePoolUuid"] = o.K8sNodePoolUuid } - - if o.K8sClusterUuid != nil { + if !IsNil(o.K8sClusterUuid) { toSerialize["k8sClusterUuid"] = o.K8sClusterUuid } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableIpConsumer struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_ip_failover.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_ip_failover.go similarity index 71% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_ip_failover.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_ip_failover.go index 04300fe6a..501fca400 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_ip_failover.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_ip_failover.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the IPFailover type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &IPFailover{} + // IPFailover struct for IPFailover type IPFailover struct { Ip *string `json:"ip,omitempty"` @@ -38,93 +41,87 @@ func NewIPFailoverWithDefaults() *IPFailover { return &this } -// GetIp returns the Ip field value -// If the value is explicit nil, nil is returned -func (o *IPFailover) GetIp() *string { - if o == nil { - return nil +// GetIp returns the Ip field value if set, zero value otherwise. +func (o *IPFailover) GetIp() string { + if o == nil || IsNil(o.Ip) { + var ret string + return ret } - - return o.Ip - + return *o.Ip } -// GetIpOk returns a tuple with the Ip field value +// GetIpOk returns a tuple with the Ip 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 *IPFailover) GetIpOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Ip) { return nil, false } - return o.Ip, true } -// SetIp sets field value -func (o *IPFailover) SetIp(v string) { - - o.Ip = &v - -} - // HasIp returns a boolean if a field has been set. func (o *IPFailover) HasIp() bool { - if o != nil && o.Ip != nil { + if o != nil && !IsNil(o.Ip) { return true } return false } -// GetNicUuid returns the NicUuid field value -// If the value is explicit nil, nil is returned -func (o *IPFailover) GetNicUuid() *string { - if o == nil { - return nil - } - - return o.NicUuid +// SetIp gets a reference to the given string and assigns it to the Ip field. +func (o *IPFailover) SetIp(v string) { + o.Ip = &v +} +// GetNicUuid returns the NicUuid field value if set, zero value otherwise. +func (o *IPFailover) GetNicUuid() string { + if o == nil || IsNil(o.NicUuid) { + var ret string + return ret + } + return *o.NicUuid } -// GetNicUuidOk returns a tuple with the NicUuid field value +// GetNicUuidOk returns a tuple with the NicUuid 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 *IPFailover) GetNicUuidOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.NicUuid) { return nil, false } - return o.NicUuid, true } -// SetNicUuid sets field value -func (o *IPFailover) SetNicUuid(v string) { - - o.NicUuid = &v - -} - // HasNicUuid returns a boolean if a field has been set. func (o *IPFailover) HasNicUuid() bool { - if o != nil && o.NicUuid != nil { + if o != nil && !IsNil(o.NicUuid) { return true } return false } +// SetNicUuid gets a reference to the given string and assigns it to the NicUuid field. +func (o *IPFailover) SetNicUuid(v string) { + o.NicUuid = &v +} + func (o IPFailover) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o IPFailover) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Ip != nil { + if !IsNil(o.Ip) { toSerialize["ip"] = o.Ip } - - if o.NicUuid != nil { + if !IsNil(o.NicUuid) { toSerialize["nicUuid"] = o.NicUuid } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableIPFailover struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_kubernetes_auto_scaling.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_kubernetes_auto_scaling.go similarity index 75% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_kubernetes_auto_scaling.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_kubernetes_auto_scaling.go index f03cbc584..a56115b8a 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_kubernetes_auto_scaling.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_kubernetes_auto_scaling.go @@ -14,12 +14,15 @@ import ( "encoding/json" ) +// checks if the KubernetesAutoScaling type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &KubernetesAutoScaling{} + // KubernetesAutoScaling struct for KubernetesAutoScaling type KubernetesAutoScaling struct { // The minimum number of working nodes that the managed node pool can scale must be >= 1 and >= nodeCount. Required if autoScaling is specified. - MinNodeCount *int32 `json:"minNodeCount"` + MinNodeCount int32 `json:"minNodeCount"` // The maximum number of worker nodes that the managed node pool can scale in. Must be >= minNodeCount and must be >= nodeCount. Required if autoScaling is specified. - MaxNodeCount *int32 `json:"maxNodeCount"` + MaxNodeCount int32 `json:"maxNodeCount"` } // NewKubernetesAutoScaling instantiates a new KubernetesAutoScaling object @@ -29,8 +32,8 @@ type KubernetesAutoScaling struct { func NewKubernetesAutoScaling(minNodeCount int32, maxNodeCount int32) *KubernetesAutoScaling { this := KubernetesAutoScaling{} - this.MinNodeCount = &minNodeCount - this.MaxNodeCount = &maxNodeCount + this.MinNodeCount = minNodeCount + this.MaxNodeCount = maxNodeCount return &this } @@ -44,92 +47,66 @@ func NewKubernetesAutoScalingWithDefaults() *KubernetesAutoScaling { } // GetMinNodeCount returns the MinNodeCount field value -// If the value is explicit nil, nil is returned -func (o *KubernetesAutoScaling) GetMinNodeCount() *int32 { +func (o *KubernetesAutoScaling) GetMinNodeCount() int32 { if o == nil { - return nil + var ret int32 + return ret } return o.MinNodeCount - } // GetMinNodeCountOk returns a tuple with the MinNodeCount field value // 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 *KubernetesAutoScaling) GetMinNodeCountOk() (*int32, bool) { if o == nil { return nil, false } - - return o.MinNodeCount, true + return &o.MinNodeCount, true } // SetMinNodeCount sets field value func (o *KubernetesAutoScaling) SetMinNodeCount(v int32) { - - o.MinNodeCount = &v - -} - -// HasMinNodeCount returns a boolean if a field has been set. -func (o *KubernetesAutoScaling) HasMinNodeCount() bool { - if o != nil && o.MinNodeCount != nil { - return true - } - - return false + o.MinNodeCount = v } // GetMaxNodeCount returns the MaxNodeCount field value -// If the value is explicit nil, nil is returned -func (o *KubernetesAutoScaling) GetMaxNodeCount() *int32 { +func (o *KubernetesAutoScaling) GetMaxNodeCount() int32 { if o == nil { - return nil + var ret int32 + return ret } return o.MaxNodeCount - } // GetMaxNodeCountOk returns a tuple with the MaxNodeCount field value // 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 *KubernetesAutoScaling) GetMaxNodeCountOk() (*int32, bool) { if o == nil { return nil, false } - - return o.MaxNodeCount, true + return &o.MaxNodeCount, true } // SetMaxNodeCount sets field value func (o *KubernetesAutoScaling) SetMaxNodeCount(v int32) { - - o.MaxNodeCount = &v - + o.MaxNodeCount = v } -// HasMaxNodeCount returns a boolean if a field has been set. -func (o *KubernetesAutoScaling) HasMaxNodeCount() bool { - if o != nil && o.MaxNodeCount != nil { - return true +func (o KubernetesAutoScaling) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } - - return false + return json.Marshal(toSerialize) } -func (o KubernetesAutoScaling) MarshalJSON() ([]byte, error) { +func (o KubernetesAutoScaling) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.MinNodeCount != nil { - toSerialize["minNodeCount"] = o.MinNodeCount - } - - if o.MaxNodeCount != nil { - toSerialize["maxNodeCount"] = o.MaxNodeCount - } - - return json.Marshal(toSerialize) + toSerialize["minNodeCount"] = o.MinNodeCount + toSerialize["maxNodeCount"] = o.MaxNodeCount + return toSerialize, nil } type NullableKubernetesAutoScaling struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_kubernetes_cluster.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_kubernetes_cluster.go similarity index 61% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_kubernetes_cluster.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_kubernetes_cluster.go index 6325c1dc3..71ffdfe6e 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_kubernetes_cluster.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_kubernetes_cluster.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the KubernetesCluster type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &KubernetesCluster{} + // KubernetesCluster struct for KubernetesCluster type KubernetesCluster struct { // The resource unique identifier. @@ -21,10 +24,10 @@ type KubernetesCluster struct { // The object type. Type *string `json:"type,omitempty"` // The URL to the object representation (absolute path). - Href *string `json:"href,omitempty"` - Metadata *DatacenterElementMetadata `json:"metadata,omitempty"` - Properties *KubernetesClusterProperties `json:"properties"` - Entities *KubernetesClusterEntities `json:"entities,omitempty"` + Href *string `json:"href,omitempty"` + Metadata *DatacenterElementMetadata `json:"metadata,omitempty"` + Properties KubernetesClusterProperties `json:"properties"` + Entities *KubernetesClusterEntities `json:"entities,omitempty"` } // NewKubernetesCluster instantiates a new KubernetesCluster object @@ -34,7 +37,7 @@ type KubernetesCluster struct { func NewKubernetesCluster(properties KubernetesClusterProperties) *KubernetesCluster { this := KubernetesCluster{} - this.Properties = &properties + this.Properties = properties return &this } @@ -47,261 +50,217 @@ func NewKubernetesClusterWithDefaults() *KubernetesCluster { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *KubernetesCluster) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *KubernetesCluster) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *KubernetesCluster) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *KubernetesCluster) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *KubernetesCluster) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *KubernetesCluster) GetType() *string { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *KubernetesCluster) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *KubernetesCluster) 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 +// GetTypeOk returns a tuple with the Type 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 *KubernetesCluster) GetTypeOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *KubernetesCluster) SetType(v string) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *KubernetesCluster) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *KubernetesCluster) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *KubernetesCluster) SetType(v string) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *KubernetesCluster) 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 +// GetHrefOk returns a tuple with the Href 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 *KubernetesCluster) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *KubernetesCluster) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *KubernetesCluster) HasHref() bool { - if o != nil && o.Href != nil { + if o != nil && !IsNil(o.Href) { return true } return false } -// GetMetadata returns the Metadata field value -// If the value is explicit nil, nil is returned -func (o *KubernetesCluster) GetMetadata() *DatacenterElementMetadata { - if o == nil { - return nil - } - - return o.Metadata +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *KubernetesCluster) SetHref(v string) { + o.Href = &v +} +// GetMetadata returns the Metadata field value if set, zero value otherwise. +func (o *KubernetesCluster) GetMetadata() DatacenterElementMetadata { + if o == nil || IsNil(o.Metadata) { + var ret DatacenterElementMetadata + return ret + } + return *o.Metadata } -// GetMetadataOk returns a tuple with the Metadata field value +// GetMetadataOk returns a tuple with the Metadata 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 *KubernetesCluster) GetMetadataOk() (*DatacenterElementMetadata, bool) { - if o == nil { + if o == nil || IsNil(o.Metadata) { return nil, false } - return o.Metadata, true } -// SetMetadata sets field value -func (o *KubernetesCluster) SetMetadata(v DatacenterElementMetadata) { - - o.Metadata = &v - -} - // HasMetadata returns a boolean if a field has been set. func (o *KubernetesCluster) HasMetadata() bool { - if o != nil && o.Metadata != nil { + if o != nil && !IsNil(o.Metadata) { return true } return false } +// SetMetadata gets a reference to the given DatacenterElementMetadata and assigns it to the Metadata field. +func (o *KubernetesCluster) SetMetadata(v DatacenterElementMetadata) { + o.Metadata = &v +} + // GetProperties returns the Properties field value -// If the value is explicit nil, nil is returned -func (o *KubernetesCluster) GetProperties() *KubernetesClusterProperties { +func (o *KubernetesCluster) GetProperties() KubernetesClusterProperties { if o == nil { - return nil + var ret KubernetesClusterProperties + return ret } return o.Properties - } // GetPropertiesOk returns a tuple with the Properties field value // 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 *KubernetesCluster) GetPropertiesOk() (*KubernetesClusterProperties, bool) { if o == nil { return nil, false } - - return o.Properties, true + return &o.Properties, true } // SetProperties sets field value func (o *KubernetesCluster) SetProperties(v KubernetesClusterProperties) { - - o.Properties = &v - -} - -// HasProperties returns a boolean if a field has been set. -func (o *KubernetesCluster) HasProperties() bool { - if o != nil && o.Properties != nil { - return true - } - - return false + o.Properties = v } -// GetEntities returns the Entities field value -// If the value is explicit nil, nil is returned -func (o *KubernetesCluster) GetEntities() *KubernetesClusterEntities { - if o == nil { - return nil +// GetEntities returns the Entities field value if set, zero value otherwise. +func (o *KubernetesCluster) GetEntities() KubernetesClusterEntities { + if o == nil || IsNil(o.Entities) { + var ret KubernetesClusterEntities + return ret } - - return o.Entities - + return *o.Entities } -// GetEntitiesOk returns a tuple with the Entities field value +// GetEntitiesOk returns a tuple with the Entities 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 *KubernetesCluster) GetEntitiesOk() (*KubernetesClusterEntities, bool) { - if o == nil { + if o == nil || IsNil(o.Entities) { return nil, false } - return o.Entities, true } -// SetEntities sets field value -func (o *KubernetesCluster) SetEntities(v KubernetesClusterEntities) { - - o.Entities = &v - -} - // HasEntities returns a boolean if a field has been set. func (o *KubernetesCluster) HasEntities() bool { - if o != nil && o.Entities != nil { + if o != nil && !IsNil(o.Entities) { return true } return false } +// SetEntities gets a reference to the given KubernetesClusterEntities and assigns it to the Entities field. +func (o *KubernetesCluster) SetEntities(v KubernetesClusterEntities) { + o.Entities = &v +} + func (o KubernetesCluster) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o KubernetesCluster) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Metadata != nil { + if !IsNil(o.Metadata) { toSerialize["metadata"] = o.Metadata } - - if o.Properties != nil { - toSerialize["properties"] = o.Properties - } - - if o.Entities != nil { + toSerialize["properties"] = o.Properties + if !IsNil(o.Entities) { toSerialize["entities"] = o.Entities } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableKubernetesCluster struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_kubernetes_cluster_entities.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_kubernetes_cluster_entities.go similarity index 79% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_kubernetes_cluster_entities.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_kubernetes_cluster_entities.go index 37a7e6853..ac9d7c53f 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_kubernetes_cluster_entities.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_kubernetes_cluster_entities.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the KubernetesClusterEntities type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &KubernetesClusterEntities{} + // KubernetesClusterEntities struct for KubernetesClusterEntities type KubernetesClusterEntities struct { Nodepools *KubernetesNodePools `json:"nodepools,omitempty"` @@ -37,51 +40,52 @@ func NewKubernetesClusterEntitiesWithDefaults() *KubernetesClusterEntities { return &this } -// GetNodepools returns the Nodepools field value -// If the value is explicit nil, nil is returned -func (o *KubernetesClusterEntities) GetNodepools() *KubernetesNodePools { - if o == nil { - return nil +// GetNodepools returns the Nodepools field value if set, zero value otherwise. +func (o *KubernetesClusterEntities) GetNodepools() KubernetesNodePools { + if o == nil || IsNil(o.Nodepools) { + var ret KubernetesNodePools + return ret } - - return o.Nodepools - + return *o.Nodepools } -// GetNodepoolsOk returns a tuple with the Nodepools field value +// GetNodepoolsOk returns a tuple with the Nodepools 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 *KubernetesClusterEntities) GetNodepoolsOk() (*KubernetesNodePools, bool) { - if o == nil { + if o == nil || IsNil(o.Nodepools) { return nil, false } - return o.Nodepools, true } -// SetNodepools sets field value -func (o *KubernetesClusterEntities) SetNodepools(v KubernetesNodePools) { - - o.Nodepools = &v - -} - // HasNodepools returns a boolean if a field has been set. func (o *KubernetesClusterEntities) HasNodepools() bool { - if o != nil && o.Nodepools != nil { + if o != nil && !IsNil(o.Nodepools) { return true } return false } +// SetNodepools gets a reference to the given KubernetesNodePools and assigns it to the Nodepools field. +func (o *KubernetesClusterEntities) SetNodepools(v KubernetesNodePools) { + o.Nodepools = &v +} + func (o KubernetesClusterEntities) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o KubernetesClusterEntities) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Nodepools != nil { + if !IsNil(o.Nodepools) { toSerialize["nodepools"] = o.Nodepools } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableKubernetesClusterEntities struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_kubernetes_cluster_for_post.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_kubernetes_cluster_for_post.go similarity index 62% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_kubernetes_cluster_for_post.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_kubernetes_cluster_for_post.go index a66edea32..fccac1df1 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_kubernetes_cluster_for_post.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_kubernetes_cluster_for_post.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the KubernetesClusterForPost type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &KubernetesClusterForPost{} + // KubernetesClusterForPost struct for KubernetesClusterForPost type KubernetesClusterForPost struct { // The resource unique identifier. @@ -21,10 +24,10 @@ type KubernetesClusterForPost struct { // The object type. Type *string `json:"type,omitempty"` // The URL to the object representation (absolute path). - Href *string `json:"href,omitempty"` - Metadata *DatacenterElementMetadata `json:"metadata,omitempty"` - Properties *KubernetesClusterPropertiesForPost `json:"properties"` - Entities *KubernetesClusterEntities `json:"entities,omitempty"` + Href *string `json:"href,omitempty"` + Metadata *DatacenterElementMetadata `json:"metadata,omitempty"` + Properties KubernetesClusterPropertiesForPost `json:"properties"` + Entities *KubernetesClusterEntities `json:"entities,omitempty"` } // NewKubernetesClusterForPost instantiates a new KubernetesClusterForPost object @@ -34,7 +37,7 @@ type KubernetesClusterForPost struct { func NewKubernetesClusterForPost(properties KubernetesClusterPropertiesForPost) *KubernetesClusterForPost { this := KubernetesClusterForPost{} - this.Properties = &properties + this.Properties = properties return &this } @@ -47,261 +50,217 @@ func NewKubernetesClusterForPostWithDefaults() *KubernetesClusterForPost { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *KubernetesClusterForPost) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *KubernetesClusterForPost) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *KubernetesClusterForPost) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *KubernetesClusterForPost) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *KubernetesClusterForPost) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *KubernetesClusterForPost) GetType() *string { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *KubernetesClusterForPost) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *KubernetesClusterForPost) 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 +// GetTypeOk returns a tuple with the Type 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 *KubernetesClusterForPost) GetTypeOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *KubernetesClusterForPost) SetType(v string) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *KubernetesClusterForPost) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *KubernetesClusterForPost) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *KubernetesClusterForPost) SetType(v string) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *KubernetesClusterForPost) 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 +// GetHrefOk returns a tuple with the Href 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 *KubernetesClusterForPost) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *KubernetesClusterForPost) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *KubernetesClusterForPost) HasHref() bool { - if o != nil && o.Href != nil { + if o != nil && !IsNil(o.Href) { return true } return false } -// GetMetadata returns the Metadata field value -// If the value is explicit nil, nil is returned -func (o *KubernetesClusterForPost) GetMetadata() *DatacenterElementMetadata { - if o == nil { - return nil - } - - return o.Metadata +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *KubernetesClusterForPost) SetHref(v string) { + o.Href = &v +} +// GetMetadata returns the Metadata field value if set, zero value otherwise. +func (o *KubernetesClusterForPost) GetMetadata() DatacenterElementMetadata { + if o == nil || IsNil(o.Metadata) { + var ret DatacenterElementMetadata + return ret + } + return *o.Metadata } -// GetMetadataOk returns a tuple with the Metadata field value +// GetMetadataOk returns a tuple with the Metadata 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 *KubernetesClusterForPost) GetMetadataOk() (*DatacenterElementMetadata, bool) { - if o == nil { + if o == nil || IsNil(o.Metadata) { return nil, false } - return o.Metadata, true } -// SetMetadata sets field value -func (o *KubernetesClusterForPost) SetMetadata(v DatacenterElementMetadata) { - - o.Metadata = &v - -} - // HasMetadata returns a boolean if a field has been set. func (o *KubernetesClusterForPost) HasMetadata() bool { - if o != nil && o.Metadata != nil { + if o != nil && !IsNil(o.Metadata) { return true } return false } +// SetMetadata gets a reference to the given DatacenterElementMetadata and assigns it to the Metadata field. +func (o *KubernetesClusterForPost) SetMetadata(v DatacenterElementMetadata) { + o.Metadata = &v +} + // GetProperties returns the Properties field value -// If the value is explicit nil, nil is returned -func (o *KubernetesClusterForPost) GetProperties() *KubernetesClusterPropertiesForPost { +func (o *KubernetesClusterForPost) GetProperties() KubernetesClusterPropertiesForPost { if o == nil { - return nil + var ret KubernetesClusterPropertiesForPost + return ret } return o.Properties - } // GetPropertiesOk returns a tuple with the Properties field value // 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 *KubernetesClusterForPost) GetPropertiesOk() (*KubernetesClusterPropertiesForPost, bool) { if o == nil { return nil, false } - - return o.Properties, true + return &o.Properties, true } // SetProperties sets field value func (o *KubernetesClusterForPost) SetProperties(v KubernetesClusterPropertiesForPost) { - - o.Properties = &v - -} - -// HasProperties returns a boolean if a field has been set. -func (o *KubernetesClusterForPost) HasProperties() bool { - if o != nil && o.Properties != nil { - return true - } - - return false + o.Properties = v } -// GetEntities returns the Entities field value -// If the value is explicit nil, nil is returned -func (o *KubernetesClusterForPost) GetEntities() *KubernetesClusterEntities { - if o == nil { - return nil +// GetEntities returns the Entities field value if set, zero value otherwise. +func (o *KubernetesClusterForPost) GetEntities() KubernetesClusterEntities { + if o == nil || IsNil(o.Entities) { + var ret KubernetesClusterEntities + return ret } - - return o.Entities - + return *o.Entities } -// GetEntitiesOk returns a tuple with the Entities field value +// GetEntitiesOk returns a tuple with the Entities 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 *KubernetesClusterForPost) GetEntitiesOk() (*KubernetesClusterEntities, bool) { - if o == nil { + if o == nil || IsNil(o.Entities) { return nil, false } - return o.Entities, true } -// SetEntities sets field value -func (o *KubernetesClusterForPost) SetEntities(v KubernetesClusterEntities) { - - o.Entities = &v - -} - // HasEntities returns a boolean if a field has been set. func (o *KubernetesClusterForPost) HasEntities() bool { - if o != nil && o.Entities != nil { + if o != nil && !IsNil(o.Entities) { return true } return false } +// SetEntities gets a reference to the given KubernetesClusterEntities and assigns it to the Entities field. +func (o *KubernetesClusterForPost) SetEntities(v KubernetesClusterEntities) { + o.Entities = &v +} + func (o KubernetesClusterForPost) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o KubernetesClusterForPost) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Metadata != nil { + if !IsNil(o.Metadata) { toSerialize["metadata"] = o.Metadata } - - if o.Properties != nil { - toSerialize["properties"] = o.Properties - } - - if o.Entities != nil { + toSerialize["properties"] = o.Properties + if !IsNil(o.Entities) { toSerialize["entities"] = o.Entities } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableKubernetesClusterForPost struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_kubernetes_cluster_for_put.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_kubernetes_cluster_for_put.go similarity index 62% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_kubernetes_cluster_for_put.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_kubernetes_cluster_for_put.go index 29da1afbb..54c2774e1 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_kubernetes_cluster_for_put.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_kubernetes_cluster_for_put.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the KubernetesClusterForPut type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &KubernetesClusterForPut{} + // KubernetesClusterForPut struct for KubernetesClusterForPut type KubernetesClusterForPut struct { // The resource's unique identifier. @@ -21,10 +24,10 @@ type KubernetesClusterForPut struct { // The type of object. Type *string `json:"type,omitempty"` // URL to the object representation (absolute path). - Href *string `json:"href,omitempty"` - Metadata *DatacenterElementMetadata `json:"metadata,omitempty"` - Properties *KubernetesClusterPropertiesForPut `json:"properties"` - Entities *KubernetesClusterEntities `json:"entities,omitempty"` + Href *string `json:"href,omitempty"` + Metadata *DatacenterElementMetadata `json:"metadata,omitempty"` + Properties KubernetesClusterPropertiesForPut `json:"properties"` + Entities *KubernetesClusterEntities `json:"entities,omitempty"` } // NewKubernetesClusterForPut instantiates a new KubernetesClusterForPut object @@ -34,7 +37,7 @@ type KubernetesClusterForPut struct { func NewKubernetesClusterForPut(properties KubernetesClusterPropertiesForPut) *KubernetesClusterForPut { this := KubernetesClusterForPut{} - this.Properties = &properties + this.Properties = properties return &this } @@ -47,261 +50,217 @@ func NewKubernetesClusterForPutWithDefaults() *KubernetesClusterForPut { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *KubernetesClusterForPut) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *KubernetesClusterForPut) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *KubernetesClusterForPut) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *KubernetesClusterForPut) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *KubernetesClusterForPut) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *KubernetesClusterForPut) GetType() *string { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *KubernetesClusterForPut) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *KubernetesClusterForPut) 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 +// GetTypeOk returns a tuple with the Type 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 *KubernetesClusterForPut) GetTypeOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *KubernetesClusterForPut) SetType(v string) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *KubernetesClusterForPut) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *KubernetesClusterForPut) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *KubernetesClusterForPut) SetType(v string) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *KubernetesClusterForPut) 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 +// GetHrefOk returns a tuple with the Href 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 *KubernetesClusterForPut) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *KubernetesClusterForPut) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *KubernetesClusterForPut) HasHref() bool { - if o != nil && o.Href != nil { + if o != nil && !IsNil(o.Href) { return true } return false } -// GetMetadata returns the Metadata field value -// If the value is explicit nil, nil is returned -func (o *KubernetesClusterForPut) GetMetadata() *DatacenterElementMetadata { - if o == nil { - return nil - } - - return o.Metadata +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *KubernetesClusterForPut) SetHref(v string) { + o.Href = &v +} +// GetMetadata returns the Metadata field value if set, zero value otherwise. +func (o *KubernetesClusterForPut) GetMetadata() DatacenterElementMetadata { + if o == nil || IsNil(o.Metadata) { + var ret DatacenterElementMetadata + return ret + } + return *o.Metadata } -// GetMetadataOk returns a tuple with the Metadata field value +// GetMetadataOk returns a tuple with the Metadata 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 *KubernetesClusterForPut) GetMetadataOk() (*DatacenterElementMetadata, bool) { - if o == nil { + if o == nil || IsNil(o.Metadata) { return nil, false } - return o.Metadata, true } -// SetMetadata sets field value -func (o *KubernetesClusterForPut) SetMetadata(v DatacenterElementMetadata) { - - o.Metadata = &v - -} - // HasMetadata returns a boolean if a field has been set. func (o *KubernetesClusterForPut) HasMetadata() bool { - if o != nil && o.Metadata != nil { + if o != nil && !IsNil(o.Metadata) { return true } return false } +// SetMetadata gets a reference to the given DatacenterElementMetadata and assigns it to the Metadata field. +func (o *KubernetesClusterForPut) SetMetadata(v DatacenterElementMetadata) { + o.Metadata = &v +} + // GetProperties returns the Properties field value -// If the value is explicit nil, nil is returned -func (o *KubernetesClusterForPut) GetProperties() *KubernetesClusterPropertiesForPut { +func (o *KubernetesClusterForPut) GetProperties() KubernetesClusterPropertiesForPut { if o == nil { - return nil + var ret KubernetesClusterPropertiesForPut + return ret } return o.Properties - } // GetPropertiesOk returns a tuple with the Properties field value // 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 *KubernetesClusterForPut) GetPropertiesOk() (*KubernetesClusterPropertiesForPut, bool) { if o == nil { return nil, false } - - return o.Properties, true + return &o.Properties, true } // SetProperties sets field value func (o *KubernetesClusterForPut) SetProperties(v KubernetesClusterPropertiesForPut) { - - o.Properties = &v - -} - -// HasProperties returns a boolean if a field has been set. -func (o *KubernetesClusterForPut) HasProperties() bool { - if o != nil && o.Properties != nil { - return true - } - - return false + o.Properties = v } -// GetEntities returns the Entities field value -// If the value is explicit nil, nil is returned -func (o *KubernetesClusterForPut) GetEntities() *KubernetesClusterEntities { - if o == nil { - return nil +// GetEntities returns the Entities field value if set, zero value otherwise. +func (o *KubernetesClusterForPut) GetEntities() KubernetesClusterEntities { + if o == nil || IsNil(o.Entities) { + var ret KubernetesClusterEntities + return ret } - - return o.Entities - + return *o.Entities } -// GetEntitiesOk returns a tuple with the Entities field value +// GetEntitiesOk returns a tuple with the Entities 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 *KubernetesClusterForPut) GetEntitiesOk() (*KubernetesClusterEntities, bool) { - if o == nil { + if o == nil || IsNil(o.Entities) { return nil, false } - return o.Entities, true } -// SetEntities sets field value -func (o *KubernetesClusterForPut) SetEntities(v KubernetesClusterEntities) { - - o.Entities = &v - -} - // HasEntities returns a boolean if a field has been set. func (o *KubernetesClusterForPut) HasEntities() bool { - if o != nil && o.Entities != nil { + if o != nil && !IsNil(o.Entities) { return true } return false } +// SetEntities gets a reference to the given KubernetesClusterEntities and assigns it to the Entities field. +func (o *KubernetesClusterForPut) SetEntities(v KubernetesClusterEntities) { + o.Entities = &v +} + func (o KubernetesClusterForPut) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o KubernetesClusterForPut) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Metadata != nil { + if !IsNil(o.Metadata) { toSerialize["metadata"] = o.Metadata } - - if o.Properties != nil { - toSerialize["properties"] = o.Properties - } - - if o.Entities != nil { + toSerialize["properties"] = o.Properties + if !IsNil(o.Entities) { toSerialize["entities"] = o.Entities } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableKubernetesClusterForPut struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_kubernetes_cluster_properties.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_kubernetes_cluster_properties.go similarity index 65% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_kubernetes_cluster_properties.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_kubernetes_cluster_properties.go index 5144f3a73..cac1f75f1 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_kubernetes_cluster_properties.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_kubernetes_cluster_properties.go @@ -14,17 +14,20 @@ import ( "encoding/json" ) +// checks if the KubernetesClusterProperties type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &KubernetesClusterProperties{} + // KubernetesClusterProperties struct for KubernetesClusterProperties type KubernetesClusterProperties struct { // A Kubernetes cluster name. Valid Kubernetes cluster name must be 63 characters or less and must be empty or begin and end with an alphanumeric character ([a-z0-9A-Z]) with dashes (-), underscores (_), dots (.), and alphanumerics between. - Name *string `json:"name"` + Name string `json:"name"` // The Kubernetes version the cluster is running. This imposes restrictions on what Kubernetes versions can be run in a cluster's nodepools. Additionally, not all Kubernetes versions are viable upgrade targets for all prior versions. K8sVersion *string `json:"k8sVersion,omitempty"` MaintenanceWindow *KubernetesMaintenanceWindow `json:"maintenanceWindow,omitempty"` // List of available versions for upgrading the cluster - AvailableUpgradeVersions *[]string `json:"availableUpgradeVersions,omitempty"` + AvailableUpgradeVersions []string `json:"availableUpgradeVersions,omitempty"` // List of versions that may be used for node pools under this cluster - ViableNodePoolVersions *[]string `json:"viableNodePoolVersions,omitempty"` + ViableNodePoolVersions []string `json:"viableNodePoolVersions,omitempty"` // The indicator if the cluster is public or private. Be aware that setting it to false is currently in beta phase. Public *bool `json:"public,omitempty"` // The location of the cluster if the cluster is private. This property is immutable. The location must be enabled for your contract or you must have a Datacenter within that location. This attribute is mandatory if the cluster is private. @@ -34,9 +37,9 @@ type KubernetesClusterProperties struct { // The node subnet of the cluster, if the cluster is private. This property is optional and immutable. Must be a valid CIDR notation for an IPv4 network prefix of 16 bits length. NodeSubnet *string `json:"nodeSubnet,omitempty"` // Access to the K8s API server is restricted to these CIDRs. Traffic, internal to the cluster, is not affected by this restriction. If no allowlist is specified, access is not restricted. If an IP without subnet mask is provided, the default value is used: 32 for IPv4 and 128 for IPv6. - ApiSubnetAllowList *[]string `json:"apiSubnetAllowList,omitempty"` + ApiSubnetAllowList []string `json:"apiSubnetAllowList,omitempty"` // List of Object storage buckets configured for K8s usage. For now it contains only one bucket used to store K8s API audit logs - S3Buckets *[]S3Bucket `json:"s3Buckets,omitempty"` + S3Buckets []S3Bucket `json:"s3Buckets,omitempty"` } // NewKubernetesClusterProperties instantiates a new KubernetesClusterProperties object @@ -46,9 +49,7 @@ type KubernetesClusterProperties struct { func NewKubernetesClusterProperties(name string) *KubernetesClusterProperties { this := KubernetesClusterProperties{} - this.Name = &name - var public bool = true - this.Public = &public + this.Name = name return &this } @@ -58,476 +59,395 @@ func NewKubernetesClusterProperties(name string) *KubernetesClusterProperties { // but it doesn't guarantee that properties required by API are set func NewKubernetesClusterPropertiesWithDefaults() *KubernetesClusterProperties { this := KubernetesClusterProperties{} - var public bool = true - this.Public = &public return &this } // GetName returns the Name field value -// If the value is explicit nil, nil is returned -func (o *KubernetesClusterProperties) GetName() *string { +func (o *KubernetesClusterProperties) GetName() string { if o == nil { - return 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. -// NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *KubernetesClusterProperties) GetNameOk() (*string, bool) { if o == nil { return nil, false } - - return o.Name, true + return &o.Name, true } // SetName sets field value func (o *KubernetesClusterProperties) SetName(v string) { - - o.Name = &v - + o.Name = v } -// HasName returns a boolean if a field has been set. -func (o *KubernetesClusterProperties) HasName() bool { - if o != nil && o.Name != nil { - return true +// GetK8sVersion returns the K8sVersion field value if set, zero value otherwise. +func (o *KubernetesClusterProperties) GetK8sVersion() string { + if o == nil || IsNil(o.K8sVersion) { + var ret string + return ret } - - return false + return *o.K8sVersion } -// GetK8sVersion returns the K8sVersion field value -// If the value is explicit nil, nil is returned -func (o *KubernetesClusterProperties) GetK8sVersion() *string { - if o == nil { - return nil - } - - return o.K8sVersion - -} - -// GetK8sVersionOk returns a tuple with the K8sVersion field value +// GetK8sVersionOk returns a tuple with the K8sVersion 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 *KubernetesClusterProperties) GetK8sVersionOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.K8sVersion) { return nil, false } - return o.K8sVersion, true } -// SetK8sVersion sets field value -func (o *KubernetesClusterProperties) SetK8sVersion(v string) { - - o.K8sVersion = &v - -} - // HasK8sVersion returns a boolean if a field has been set. func (o *KubernetesClusterProperties) HasK8sVersion() bool { - if o != nil && o.K8sVersion != nil { + if o != nil && !IsNil(o.K8sVersion) { return true } return false } -// GetMaintenanceWindow returns the MaintenanceWindow field value -// If the value is explicit nil, nil is returned -func (o *KubernetesClusterProperties) GetMaintenanceWindow() *KubernetesMaintenanceWindow { - if o == nil { - return nil - } - - return o.MaintenanceWindow +// SetK8sVersion gets a reference to the given string and assigns it to the K8sVersion field. +func (o *KubernetesClusterProperties) SetK8sVersion(v string) { + o.K8sVersion = &v +} +// GetMaintenanceWindow returns the MaintenanceWindow field value if set, zero value otherwise. +func (o *KubernetesClusterProperties) GetMaintenanceWindow() KubernetesMaintenanceWindow { + if o == nil || IsNil(o.MaintenanceWindow) { + var ret KubernetesMaintenanceWindow + return ret + } + return *o.MaintenanceWindow } -// GetMaintenanceWindowOk returns a tuple with the MaintenanceWindow field value +// GetMaintenanceWindowOk returns a tuple with the MaintenanceWindow 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 *KubernetesClusterProperties) GetMaintenanceWindowOk() (*KubernetesMaintenanceWindow, bool) { - if o == nil { + if o == nil || IsNil(o.MaintenanceWindow) { return nil, false } - return o.MaintenanceWindow, true } -// SetMaintenanceWindow sets field value -func (o *KubernetesClusterProperties) SetMaintenanceWindow(v KubernetesMaintenanceWindow) { - - o.MaintenanceWindow = &v - -} - // HasMaintenanceWindow returns a boolean if a field has been set. func (o *KubernetesClusterProperties) HasMaintenanceWindow() bool { - if o != nil && o.MaintenanceWindow != nil { + if o != nil && !IsNil(o.MaintenanceWindow) { return true } return false } -// GetAvailableUpgradeVersions returns the AvailableUpgradeVersions field value -// If the value is explicit nil, nil is returned -func (o *KubernetesClusterProperties) GetAvailableUpgradeVersions() *[]string { - if o == nil { - return nil - } +// SetMaintenanceWindow gets a reference to the given KubernetesMaintenanceWindow and assigns it to the MaintenanceWindow field. +func (o *KubernetesClusterProperties) SetMaintenanceWindow(v KubernetesMaintenanceWindow) { + o.MaintenanceWindow = &v +} +// GetAvailableUpgradeVersions returns the AvailableUpgradeVersions field value if set, zero value otherwise. +func (o *KubernetesClusterProperties) GetAvailableUpgradeVersions() []string { + if o == nil || IsNil(o.AvailableUpgradeVersions) { + var ret []string + return ret + } return o.AvailableUpgradeVersions - } -// GetAvailableUpgradeVersionsOk returns a tuple with the AvailableUpgradeVersions field value +// GetAvailableUpgradeVersionsOk returns a tuple with the AvailableUpgradeVersions 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 *KubernetesClusterProperties) GetAvailableUpgradeVersionsOk() (*[]string, bool) { - if o == nil { +func (o *KubernetesClusterProperties) GetAvailableUpgradeVersionsOk() ([]string, bool) { + if o == nil || IsNil(o.AvailableUpgradeVersions) { return nil, false } - return o.AvailableUpgradeVersions, true } -// SetAvailableUpgradeVersions sets field value -func (o *KubernetesClusterProperties) SetAvailableUpgradeVersions(v []string) { - - o.AvailableUpgradeVersions = &v - -} - // HasAvailableUpgradeVersions returns a boolean if a field has been set. func (o *KubernetesClusterProperties) HasAvailableUpgradeVersions() bool { - if o != nil && o.AvailableUpgradeVersions != nil { + if o != nil && !IsNil(o.AvailableUpgradeVersions) { return true } return false } -// GetViableNodePoolVersions returns the ViableNodePoolVersions field value -// If the value is explicit nil, nil is returned -func (o *KubernetesClusterProperties) GetViableNodePoolVersions() *[]string { - if o == nil { - return nil - } +// SetAvailableUpgradeVersions gets a reference to the given []string and assigns it to the AvailableUpgradeVersions field. +func (o *KubernetesClusterProperties) SetAvailableUpgradeVersions(v []string) { + o.AvailableUpgradeVersions = v +} +// GetViableNodePoolVersions returns the ViableNodePoolVersions field value if set, zero value otherwise. +func (o *KubernetesClusterProperties) GetViableNodePoolVersions() []string { + if o == nil || IsNil(o.ViableNodePoolVersions) { + var ret []string + return ret + } return o.ViableNodePoolVersions - } -// GetViableNodePoolVersionsOk returns a tuple with the ViableNodePoolVersions field value +// GetViableNodePoolVersionsOk returns a tuple with the ViableNodePoolVersions 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 *KubernetesClusterProperties) GetViableNodePoolVersionsOk() (*[]string, bool) { - if o == nil { +func (o *KubernetesClusterProperties) GetViableNodePoolVersionsOk() ([]string, bool) { + if o == nil || IsNil(o.ViableNodePoolVersions) { return nil, false } - return o.ViableNodePoolVersions, true } -// SetViableNodePoolVersions sets field value -func (o *KubernetesClusterProperties) SetViableNodePoolVersions(v []string) { - - o.ViableNodePoolVersions = &v - -} - // HasViableNodePoolVersions returns a boolean if a field has been set. func (o *KubernetesClusterProperties) HasViableNodePoolVersions() bool { - if o != nil && o.ViableNodePoolVersions != nil { + if o != nil && !IsNil(o.ViableNodePoolVersions) { return true } return false } -// GetPublic returns the Public field value -// If the value is explicit nil, nil is returned -func (o *KubernetesClusterProperties) GetPublic() *bool { - if o == nil { - return nil - } - - return o.Public +// SetViableNodePoolVersions gets a reference to the given []string and assigns it to the ViableNodePoolVersions field. +func (o *KubernetesClusterProperties) SetViableNodePoolVersions(v []string) { + o.ViableNodePoolVersions = v +} +// GetPublic returns the Public field value if set, zero value otherwise. +func (o *KubernetesClusterProperties) 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 +// GetPublicOk returns a tuple with the Public 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 *KubernetesClusterProperties) GetPublicOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.Public) { return nil, false } - return o.Public, true } -// SetPublic sets field value -func (o *KubernetesClusterProperties) SetPublic(v bool) { - - o.Public = &v - -} - // HasPublic returns a boolean if a field has been set. func (o *KubernetesClusterProperties) HasPublic() bool { - if o != nil && o.Public != nil { + if o != nil && !IsNil(o.Public) { return true } return false } -// GetLocation returns the Location field value -// If the value is explicit nil, nil is returned -func (o *KubernetesClusterProperties) GetLocation() *string { - if o == nil { - return nil - } - - return o.Location +// SetPublic gets a reference to the given bool and assigns it to the Public field. +func (o *KubernetesClusterProperties) SetPublic(v bool) { + o.Public = &v +} +// GetLocation returns the Location field value if set, zero value otherwise. +func (o *KubernetesClusterProperties) GetLocation() string { + if o == nil || IsNil(o.Location) { + var ret string + return ret + } + return *o.Location } -// GetLocationOk returns a tuple with the Location field value +// GetLocationOk returns a tuple with the Location 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 *KubernetesClusterProperties) GetLocationOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Location) { return nil, false } - return o.Location, true } -// SetLocation sets field value -func (o *KubernetesClusterProperties) SetLocation(v string) { - - o.Location = &v - -} - // HasLocation returns a boolean if a field has been set. func (o *KubernetesClusterProperties) HasLocation() bool { - if o != nil && o.Location != nil { + if o != nil && !IsNil(o.Location) { return true } return false } -// GetNatGatewayIp returns the NatGatewayIp field value -// If the value is explicit nil, nil is returned -func (o *KubernetesClusterProperties) GetNatGatewayIp() *string { - if o == nil { - return nil - } - - return o.NatGatewayIp +// SetLocation gets a reference to the given string and assigns it to the Location field. +func (o *KubernetesClusterProperties) SetLocation(v string) { + o.Location = &v +} +// GetNatGatewayIp returns the NatGatewayIp field value if set, zero value otherwise. +func (o *KubernetesClusterProperties) GetNatGatewayIp() string { + if o == nil || IsNil(o.NatGatewayIp) { + var ret string + return ret + } + return *o.NatGatewayIp } -// GetNatGatewayIpOk returns a tuple with the NatGatewayIp field value +// GetNatGatewayIpOk returns a tuple with the NatGatewayIp 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 *KubernetesClusterProperties) GetNatGatewayIpOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.NatGatewayIp) { return nil, false } - return o.NatGatewayIp, true } -// SetNatGatewayIp sets field value -func (o *KubernetesClusterProperties) SetNatGatewayIp(v string) { - - o.NatGatewayIp = &v - -} - // HasNatGatewayIp returns a boolean if a field has been set. func (o *KubernetesClusterProperties) HasNatGatewayIp() bool { - if o != nil && o.NatGatewayIp != nil { + if o != nil && !IsNil(o.NatGatewayIp) { return true } return false } -// GetNodeSubnet returns the NodeSubnet field value -// If the value is explicit nil, nil is returned -func (o *KubernetesClusterProperties) GetNodeSubnet() *string { - if o == nil { - return nil - } - - return o.NodeSubnet +// SetNatGatewayIp gets a reference to the given string and assigns it to the NatGatewayIp field. +func (o *KubernetesClusterProperties) SetNatGatewayIp(v string) { + o.NatGatewayIp = &v +} +// GetNodeSubnet returns the NodeSubnet field value if set, zero value otherwise. +func (o *KubernetesClusterProperties) GetNodeSubnet() string { + if o == nil || IsNil(o.NodeSubnet) { + var ret string + return ret + } + return *o.NodeSubnet } -// GetNodeSubnetOk returns a tuple with the NodeSubnet field value +// GetNodeSubnetOk returns a tuple with the NodeSubnet 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 *KubernetesClusterProperties) GetNodeSubnetOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.NodeSubnet) { return nil, false } - return o.NodeSubnet, true } -// SetNodeSubnet sets field value -func (o *KubernetesClusterProperties) SetNodeSubnet(v string) { - - o.NodeSubnet = &v - -} - // HasNodeSubnet returns a boolean if a field has been set. func (o *KubernetesClusterProperties) HasNodeSubnet() bool { - if o != nil && o.NodeSubnet != nil { + if o != nil && !IsNil(o.NodeSubnet) { return true } return false } -// GetApiSubnetAllowList returns the ApiSubnetAllowList field value -// If the value is explicit nil, nil is returned -func (o *KubernetesClusterProperties) GetApiSubnetAllowList() *[]string { - if o == nil { - return nil - } +// SetNodeSubnet gets a reference to the given string and assigns it to the NodeSubnet field. +func (o *KubernetesClusterProperties) SetNodeSubnet(v string) { + o.NodeSubnet = &v +} +// GetApiSubnetAllowList returns the ApiSubnetAllowList field value if set, zero value otherwise. +func (o *KubernetesClusterProperties) GetApiSubnetAllowList() []string { + if o == nil || IsNil(o.ApiSubnetAllowList) { + var ret []string + return ret + } return o.ApiSubnetAllowList - } -// GetApiSubnetAllowListOk returns a tuple with the ApiSubnetAllowList field value +// GetApiSubnetAllowListOk returns a tuple with the ApiSubnetAllowList 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 *KubernetesClusterProperties) GetApiSubnetAllowListOk() (*[]string, bool) { - if o == nil { +func (o *KubernetesClusterProperties) GetApiSubnetAllowListOk() ([]string, bool) { + if o == nil || IsNil(o.ApiSubnetAllowList) { return nil, false } - return o.ApiSubnetAllowList, true } -// SetApiSubnetAllowList sets field value -func (o *KubernetesClusterProperties) SetApiSubnetAllowList(v []string) { - - o.ApiSubnetAllowList = &v - -} - // HasApiSubnetAllowList returns a boolean if a field has been set. func (o *KubernetesClusterProperties) HasApiSubnetAllowList() bool { - if o != nil && o.ApiSubnetAllowList != nil { + if o != nil && !IsNil(o.ApiSubnetAllowList) { return true } return false } -// GetS3Buckets returns the S3Buckets field value -// If the value is explicit nil, nil is returned -func (o *KubernetesClusterProperties) GetS3Buckets() *[]S3Bucket { - if o == nil { - return nil - } +// SetApiSubnetAllowList gets a reference to the given []string and assigns it to the ApiSubnetAllowList field. +func (o *KubernetesClusterProperties) SetApiSubnetAllowList(v []string) { + o.ApiSubnetAllowList = v +} +// GetS3Buckets returns the S3Buckets field value if set, zero value otherwise. +func (o *KubernetesClusterProperties) GetS3Buckets() []S3Bucket { + if o == nil || IsNil(o.S3Buckets) { + var ret []S3Bucket + return ret + } return o.S3Buckets - } -// GetS3BucketsOk returns a tuple with the S3Buckets field value +// GetS3BucketsOk returns a tuple with the S3Buckets 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 *KubernetesClusterProperties) GetS3BucketsOk() (*[]S3Bucket, bool) { - if o == nil { +func (o *KubernetesClusterProperties) GetS3BucketsOk() ([]S3Bucket, bool) { + if o == nil || IsNil(o.S3Buckets) { return nil, false } - return o.S3Buckets, true } -// SetS3Buckets sets field value -func (o *KubernetesClusterProperties) SetS3Buckets(v []S3Bucket) { - - o.S3Buckets = &v - -} - // HasS3Buckets returns a boolean if a field has been set. func (o *KubernetesClusterProperties) HasS3Buckets() bool { - if o != nil && o.S3Buckets != nil { + if o != nil && !IsNil(o.S3Buckets) { return true } return false } +// SetS3Buckets gets a reference to the given []S3Bucket and assigns it to the S3Buckets field. +func (o *KubernetesClusterProperties) SetS3Buckets(v []S3Bucket) { + o.S3Buckets = v +} + func (o KubernetesClusterProperties) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.Name != nil { - toSerialize["name"] = o.Name + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } + return json.Marshal(toSerialize) +} - if o.K8sVersion != nil { +func (o KubernetesClusterProperties) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["name"] = o.Name + if !IsNil(o.K8sVersion) { toSerialize["k8sVersion"] = o.K8sVersion } - - if o.MaintenanceWindow != nil { + if !IsNil(o.MaintenanceWindow) { toSerialize["maintenanceWindow"] = o.MaintenanceWindow } - - if o.AvailableUpgradeVersions != nil { + if !IsNil(o.AvailableUpgradeVersions) { toSerialize["availableUpgradeVersions"] = o.AvailableUpgradeVersions } - - if o.ViableNodePoolVersions != nil { + if !IsNil(o.ViableNodePoolVersions) { toSerialize["viableNodePoolVersions"] = o.ViableNodePoolVersions } - - if o.Public != nil { + if !IsNil(o.Public) { toSerialize["public"] = o.Public } - - if o.Location != nil { + if !IsNil(o.Location) { toSerialize["location"] = o.Location } - - if o.NatGatewayIp != nil { + if !IsNil(o.NatGatewayIp) { toSerialize["natGatewayIp"] = o.NatGatewayIp } - - if o.NodeSubnet != nil { + if !IsNil(o.NodeSubnet) { toSerialize["nodeSubnet"] = o.NodeSubnet } - - if o.ApiSubnetAllowList != nil { + if !IsNil(o.ApiSubnetAllowList) { toSerialize["apiSubnetAllowList"] = o.ApiSubnetAllowList } - - if o.S3Buckets != nil { + if !IsNil(o.S3Buckets) { toSerialize["s3Buckets"] = o.S3Buckets } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableKubernetesClusterProperties struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_kubernetes_cluster_properties_for_post.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_kubernetes_cluster_properties_for_post.go similarity index 68% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_kubernetes_cluster_properties_for_post.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_kubernetes_cluster_properties_for_post.go index 5c5cd7862..ab7e55283 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_kubernetes_cluster_properties_for_post.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_kubernetes_cluster_properties_for_post.go @@ -14,10 +14,13 @@ import ( "encoding/json" ) +// checks if the KubernetesClusterPropertiesForPost type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &KubernetesClusterPropertiesForPost{} + // KubernetesClusterPropertiesForPost struct for KubernetesClusterPropertiesForPost type KubernetesClusterPropertiesForPost struct { // A Kubernetes cluster name. Valid Kubernetes cluster name must be 63 characters or less and must be empty or begin and end with an alphanumeric character ([a-z0-9A-Z]) with dashes (-), underscores (_), dots (.), and alphanumerics between. - Name *string `json:"name"` + Name string `json:"name"` // The Kubernetes version that the cluster is running. This limits which Kubernetes versions can run in a cluster's node pools. Also, not all Kubernetes versions are suitable upgrade targets for all earlier versions. K8sVersion *string `json:"k8sVersion,omitempty"` MaintenanceWindow *KubernetesMaintenanceWindow `json:"maintenanceWindow,omitempty"` @@ -30,9 +33,9 @@ type KubernetesClusterPropertiesForPost struct { // The node subnet of the cluster, if the cluster is private. This property is optional and immutable. Must be a valid CIDR notation for an IPv4 network prefix of 16 bits length. NodeSubnet *string `json:"nodeSubnet,omitempty"` // Access to the K8s API server is restricted to these CIDRs. Intra-cluster traffic is not affected by this restriction. If no AllowList is specified, access is not limited. If an IP is specified without a subnet mask, the default value is 32 for IPv4 and 128 for IPv6. - ApiSubnetAllowList *[]string `json:"apiSubnetAllowList,omitempty"` + ApiSubnetAllowList []string `json:"apiSubnetAllowList,omitempty"` // List of Object storage buckets configured for K8s usage. At the moment, it contains only one bucket that is used to store K8s API audit logs. - S3Buckets *[]S3Bucket `json:"s3Buckets,omitempty"` + S3Buckets []S3Bucket `json:"s3Buckets,omitempty"` } // NewKubernetesClusterPropertiesForPost instantiates a new KubernetesClusterPropertiesForPost object @@ -42,9 +45,7 @@ type KubernetesClusterPropertiesForPost struct { func NewKubernetesClusterPropertiesForPost(name string) *KubernetesClusterPropertiesForPost { this := KubernetesClusterPropertiesForPost{} - this.Name = &name - var public bool = true - this.Public = &public + this.Name = name return &this } @@ -54,392 +55,325 @@ func NewKubernetesClusterPropertiesForPost(name string) *KubernetesClusterProper // but it doesn't guarantee that properties required by API are set func NewKubernetesClusterPropertiesForPostWithDefaults() *KubernetesClusterPropertiesForPost { this := KubernetesClusterPropertiesForPost{} - var public bool = true - this.Public = &public return &this } // GetName returns the Name field value -// If the value is explicit nil, nil is returned -func (o *KubernetesClusterPropertiesForPost) GetName() *string { +func (o *KubernetesClusterPropertiesForPost) GetName() string { if o == nil { - return 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. -// NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *KubernetesClusterPropertiesForPost) GetNameOk() (*string, bool) { if o == nil { return nil, false } - - return o.Name, true + return &o.Name, true } // SetName sets field value func (o *KubernetesClusterPropertiesForPost) SetName(v string) { - - o.Name = &v - -} - -// HasName returns a boolean if a field has been set. -func (o *KubernetesClusterPropertiesForPost) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false + o.Name = v } -// GetK8sVersion returns the K8sVersion field value -// If the value is explicit nil, nil is returned -func (o *KubernetesClusterPropertiesForPost) GetK8sVersion() *string { - if o == nil { - return nil +// GetK8sVersion returns the K8sVersion field value if set, zero value otherwise. +func (o *KubernetesClusterPropertiesForPost) GetK8sVersion() string { + if o == nil || IsNil(o.K8sVersion) { + var ret string + return ret } - - return o.K8sVersion - + return *o.K8sVersion } -// GetK8sVersionOk returns a tuple with the K8sVersion field value +// GetK8sVersionOk returns a tuple with the K8sVersion 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 *KubernetesClusterPropertiesForPost) GetK8sVersionOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.K8sVersion) { return nil, false } - return o.K8sVersion, true } -// SetK8sVersion sets field value -func (o *KubernetesClusterPropertiesForPost) SetK8sVersion(v string) { - - o.K8sVersion = &v - -} - // HasK8sVersion returns a boolean if a field has been set. func (o *KubernetesClusterPropertiesForPost) HasK8sVersion() bool { - if o != nil && o.K8sVersion != nil { + if o != nil && !IsNil(o.K8sVersion) { return true } return false } -// GetMaintenanceWindow returns the MaintenanceWindow field value -// If the value is explicit nil, nil is returned -func (o *KubernetesClusterPropertiesForPost) GetMaintenanceWindow() *KubernetesMaintenanceWindow { - if o == nil { - return nil - } - - return o.MaintenanceWindow +// SetK8sVersion gets a reference to the given string and assigns it to the K8sVersion field. +func (o *KubernetesClusterPropertiesForPost) SetK8sVersion(v string) { + o.K8sVersion = &v +} +// GetMaintenanceWindow returns the MaintenanceWindow field value if set, zero value otherwise. +func (o *KubernetesClusterPropertiesForPost) GetMaintenanceWindow() KubernetesMaintenanceWindow { + if o == nil || IsNil(o.MaintenanceWindow) { + var ret KubernetesMaintenanceWindow + return ret + } + return *o.MaintenanceWindow } -// GetMaintenanceWindowOk returns a tuple with the MaintenanceWindow field value +// GetMaintenanceWindowOk returns a tuple with the MaintenanceWindow 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 *KubernetesClusterPropertiesForPost) GetMaintenanceWindowOk() (*KubernetesMaintenanceWindow, bool) { - if o == nil { + if o == nil || IsNil(o.MaintenanceWindow) { return nil, false } - return o.MaintenanceWindow, true } -// SetMaintenanceWindow sets field value -func (o *KubernetesClusterPropertiesForPost) SetMaintenanceWindow(v KubernetesMaintenanceWindow) { - - o.MaintenanceWindow = &v - -} - // HasMaintenanceWindow returns a boolean if a field has been set. func (o *KubernetesClusterPropertiesForPost) HasMaintenanceWindow() bool { - if o != nil && o.MaintenanceWindow != nil { + if o != nil && !IsNil(o.MaintenanceWindow) { return true } return false } -// GetPublic returns the Public field value -// If the value is explicit nil, nil is returned -func (o *KubernetesClusterPropertiesForPost) GetPublic() *bool { - if o == nil { - return nil - } - - return o.Public +// SetMaintenanceWindow gets a reference to the given KubernetesMaintenanceWindow and assigns it to the MaintenanceWindow field. +func (o *KubernetesClusterPropertiesForPost) SetMaintenanceWindow(v KubernetesMaintenanceWindow) { + o.MaintenanceWindow = &v +} +// GetPublic returns the Public field value if set, zero value otherwise. +func (o *KubernetesClusterPropertiesForPost) 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 +// GetPublicOk returns a tuple with the Public 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 *KubernetesClusterPropertiesForPost) GetPublicOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.Public) { return nil, false } - return o.Public, true } -// SetPublic sets field value -func (o *KubernetesClusterPropertiesForPost) SetPublic(v bool) { - - o.Public = &v - -} - // HasPublic returns a boolean if a field has been set. func (o *KubernetesClusterPropertiesForPost) HasPublic() bool { - if o != nil && o.Public != nil { + if o != nil && !IsNil(o.Public) { return true } return false } -// GetLocation returns the Location field value -// If the value is explicit nil, nil is returned -func (o *KubernetesClusterPropertiesForPost) GetLocation() *string { - if o == nil { - return nil - } - - return o.Location +// SetPublic gets a reference to the given bool and assigns it to the Public field. +func (o *KubernetesClusterPropertiesForPost) SetPublic(v bool) { + o.Public = &v +} +// GetLocation returns the Location field value if set, zero value otherwise. +func (o *KubernetesClusterPropertiesForPost) GetLocation() string { + if o == nil || IsNil(o.Location) { + var ret string + return ret + } + return *o.Location } -// GetLocationOk returns a tuple with the Location field value +// GetLocationOk returns a tuple with the Location 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 *KubernetesClusterPropertiesForPost) GetLocationOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Location) { return nil, false } - return o.Location, true } -// SetLocation sets field value -func (o *KubernetesClusterPropertiesForPost) SetLocation(v string) { - - o.Location = &v - -} - // HasLocation returns a boolean if a field has been set. func (o *KubernetesClusterPropertiesForPost) HasLocation() bool { - if o != nil && o.Location != nil { + if o != nil && !IsNil(o.Location) { return true } return false } -// GetNatGatewayIp returns the NatGatewayIp field value -// If the value is explicit nil, nil is returned -func (o *KubernetesClusterPropertiesForPost) GetNatGatewayIp() *string { - if o == nil { - return nil - } - - return o.NatGatewayIp +// SetLocation gets a reference to the given string and assigns it to the Location field. +func (o *KubernetesClusterPropertiesForPost) SetLocation(v string) { + o.Location = &v +} +// GetNatGatewayIp returns the NatGatewayIp field value if set, zero value otherwise. +func (o *KubernetesClusterPropertiesForPost) GetNatGatewayIp() string { + if o == nil || IsNil(o.NatGatewayIp) { + var ret string + return ret + } + return *o.NatGatewayIp } -// GetNatGatewayIpOk returns a tuple with the NatGatewayIp field value +// GetNatGatewayIpOk returns a tuple with the NatGatewayIp 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 *KubernetesClusterPropertiesForPost) GetNatGatewayIpOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.NatGatewayIp) { return nil, false } - return o.NatGatewayIp, true } -// SetNatGatewayIp sets field value -func (o *KubernetesClusterPropertiesForPost) SetNatGatewayIp(v string) { - - o.NatGatewayIp = &v - -} - // HasNatGatewayIp returns a boolean if a field has been set. func (o *KubernetesClusterPropertiesForPost) HasNatGatewayIp() bool { - if o != nil && o.NatGatewayIp != nil { + if o != nil && !IsNil(o.NatGatewayIp) { return true } return false } -// GetNodeSubnet returns the NodeSubnet field value -// If the value is explicit nil, nil is returned -func (o *KubernetesClusterPropertiesForPost) GetNodeSubnet() *string { - if o == nil { - return nil - } - - return o.NodeSubnet +// SetNatGatewayIp gets a reference to the given string and assigns it to the NatGatewayIp field. +func (o *KubernetesClusterPropertiesForPost) SetNatGatewayIp(v string) { + o.NatGatewayIp = &v +} +// GetNodeSubnet returns the NodeSubnet field value if set, zero value otherwise. +func (o *KubernetesClusterPropertiesForPost) GetNodeSubnet() string { + if o == nil || IsNil(o.NodeSubnet) { + var ret string + return ret + } + return *o.NodeSubnet } -// GetNodeSubnetOk returns a tuple with the NodeSubnet field value +// GetNodeSubnetOk returns a tuple with the NodeSubnet 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 *KubernetesClusterPropertiesForPost) GetNodeSubnetOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.NodeSubnet) { return nil, false } - return o.NodeSubnet, true } -// SetNodeSubnet sets field value -func (o *KubernetesClusterPropertiesForPost) SetNodeSubnet(v string) { - - o.NodeSubnet = &v - -} - // HasNodeSubnet returns a boolean if a field has been set. func (o *KubernetesClusterPropertiesForPost) HasNodeSubnet() bool { - if o != nil && o.NodeSubnet != nil { + if o != nil && !IsNil(o.NodeSubnet) { return true } return false } -// GetApiSubnetAllowList returns the ApiSubnetAllowList field value -// If the value is explicit nil, nil is returned -func (o *KubernetesClusterPropertiesForPost) GetApiSubnetAllowList() *[]string { - if o == nil { - return nil - } +// SetNodeSubnet gets a reference to the given string and assigns it to the NodeSubnet field. +func (o *KubernetesClusterPropertiesForPost) SetNodeSubnet(v string) { + o.NodeSubnet = &v +} +// GetApiSubnetAllowList returns the ApiSubnetAllowList field value if set, zero value otherwise. +func (o *KubernetesClusterPropertiesForPost) GetApiSubnetAllowList() []string { + if o == nil || IsNil(o.ApiSubnetAllowList) { + var ret []string + return ret + } return o.ApiSubnetAllowList - } -// GetApiSubnetAllowListOk returns a tuple with the ApiSubnetAllowList field value +// GetApiSubnetAllowListOk returns a tuple with the ApiSubnetAllowList 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 *KubernetesClusterPropertiesForPost) GetApiSubnetAllowListOk() (*[]string, bool) { - if o == nil { +func (o *KubernetesClusterPropertiesForPost) GetApiSubnetAllowListOk() ([]string, bool) { + if o == nil || IsNil(o.ApiSubnetAllowList) { return nil, false } - return o.ApiSubnetAllowList, true } -// SetApiSubnetAllowList sets field value -func (o *KubernetesClusterPropertiesForPost) SetApiSubnetAllowList(v []string) { - - o.ApiSubnetAllowList = &v - -} - // HasApiSubnetAllowList returns a boolean if a field has been set. func (o *KubernetesClusterPropertiesForPost) HasApiSubnetAllowList() bool { - if o != nil && o.ApiSubnetAllowList != nil { + if o != nil && !IsNil(o.ApiSubnetAllowList) { return true } return false } -// GetS3Buckets returns the S3Buckets field value -// If the value is explicit nil, nil is returned -func (o *KubernetesClusterPropertiesForPost) GetS3Buckets() *[]S3Bucket { - if o == nil { - return nil - } +// SetApiSubnetAllowList gets a reference to the given []string and assigns it to the ApiSubnetAllowList field. +func (o *KubernetesClusterPropertiesForPost) SetApiSubnetAllowList(v []string) { + o.ApiSubnetAllowList = v +} +// GetS3Buckets returns the S3Buckets field value if set, zero value otherwise. +func (o *KubernetesClusterPropertiesForPost) GetS3Buckets() []S3Bucket { + if o == nil || IsNil(o.S3Buckets) { + var ret []S3Bucket + return ret + } return o.S3Buckets - } -// GetS3BucketsOk returns a tuple with the S3Buckets field value +// GetS3BucketsOk returns a tuple with the S3Buckets 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 *KubernetesClusterPropertiesForPost) GetS3BucketsOk() (*[]S3Bucket, bool) { - if o == nil { +func (o *KubernetesClusterPropertiesForPost) GetS3BucketsOk() ([]S3Bucket, bool) { + if o == nil || IsNil(o.S3Buckets) { return nil, false } - return o.S3Buckets, true } -// SetS3Buckets sets field value -func (o *KubernetesClusterPropertiesForPost) SetS3Buckets(v []S3Bucket) { - - o.S3Buckets = &v - -} - // HasS3Buckets returns a boolean if a field has been set. func (o *KubernetesClusterPropertiesForPost) HasS3Buckets() bool { - if o != nil && o.S3Buckets != nil { + if o != nil && !IsNil(o.S3Buckets) { return true } return false } +// SetS3Buckets gets a reference to the given []S3Bucket and assigns it to the S3Buckets field. +func (o *KubernetesClusterPropertiesForPost) SetS3Buckets(v []S3Bucket) { + o.S3Buckets = v +} + func (o KubernetesClusterPropertiesForPost) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.Name != nil { - toSerialize["name"] = o.Name + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } + return json.Marshal(toSerialize) +} - if o.K8sVersion != nil { +func (o KubernetesClusterPropertiesForPost) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["name"] = o.Name + if !IsNil(o.K8sVersion) { toSerialize["k8sVersion"] = o.K8sVersion } - - if o.MaintenanceWindow != nil { + if !IsNil(o.MaintenanceWindow) { toSerialize["maintenanceWindow"] = o.MaintenanceWindow } - - if o.Public != nil { + if !IsNil(o.Public) { toSerialize["public"] = o.Public } - - if o.Location != nil { + if !IsNil(o.Location) { toSerialize["location"] = o.Location } - - if o.NatGatewayIp != nil { + if !IsNil(o.NatGatewayIp) { toSerialize["natGatewayIp"] = o.NatGatewayIp } - - if o.NodeSubnet != nil { + if !IsNil(o.NodeSubnet) { toSerialize["nodeSubnet"] = o.NodeSubnet } - - if o.ApiSubnetAllowList != nil { + if !IsNil(o.ApiSubnetAllowList) { toSerialize["apiSubnetAllowList"] = o.ApiSubnetAllowList } - - if o.S3Buckets != nil { + if !IsNil(o.S3Buckets) { toSerialize["s3Buckets"] = o.S3Buckets } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableKubernetesClusterPropertiesForPost struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_kubernetes_cluster_properties_for_put.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_kubernetes_cluster_properties_for_put.go similarity index 72% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_kubernetes_cluster_properties_for_put.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_kubernetes_cluster_properties_for_put.go index 597abcfa5..1db3e3838 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_kubernetes_cluster_properties_for_put.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_kubernetes_cluster_properties_for_put.go @@ -14,17 +14,20 @@ import ( "encoding/json" ) +// checks if the KubernetesClusterPropertiesForPut type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &KubernetesClusterPropertiesForPut{} + // KubernetesClusterPropertiesForPut struct for KubernetesClusterPropertiesForPut type KubernetesClusterPropertiesForPut struct { // A Kubernetes cluster name. Valid Kubernetes cluster name must be 63 characters or less and must be empty or begin and end with an alphanumeric character ([a-z0-9A-Z]) with dashes (-), underscores (_), dots (.), and alphanumerics between. - Name *string `json:"name"` + Name string `json:"name"` // The Kubernetes version that the cluster is running. This limits which Kubernetes versions can run in a cluster's node pools. Also, not all Kubernetes versions are suitable upgrade targets for all earlier versions. K8sVersion *string `json:"k8sVersion,omitempty"` MaintenanceWindow *KubernetesMaintenanceWindow `json:"maintenanceWindow,omitempty"` // Access to the K8s API server is restricted to these CIDRs. Intra-cluster traffic is not affected by this restriction. If no AllowList is specified, access is not limited. If an IP is specified without a subnet mask, the default value is 32 for IPv4 and 128 for IPv6. - ApiSubnetAllowList *[]string `json:"apiSubnetAllowList,omitempty"` + ApiSubnetAllowList []string `json:"apiSubnetAllowList,omitempty"` // List of Object storage buckets configured for K8s usage. At the moment, it contains only one bucket that is used to store K8s API audit logs. - S3Buckets *[]S3Bucket `json:"s3Buckets,omitempty"` + S3Buckets []S3Bucket `json:"s3Buckets,omitempty"` } // NewKubernetesClusterPropertiesForPut instantiates a new KubernetesClusterPropertiesForPut object @@ -34,7 +37,7 @@ type KubernetesClusterPropertiesForPut struct { func NewKubernetesClusterPropertiesForPut(name string) *KubernetesClusterPropertiesForPut { this := KubernetesClusterPropertiesForPut{} - this.Name = &name + this.Name = name return &this } @@ -48,218 +51,181 @@ func NewKubernetesClusterPropertiesForPutWithDefaults() *KubernetesClusterProper } // GetName returns the Name field value -// If the value is explicit nil, nil is returned -func (o *KubernetesClusterPropertiesForPut) GetName() *string { +func (o *KubernetesClusterPropertiesForPut) GetName() string { if o == nil { - return 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. -// NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *KubernetesClusterPropertiesForPut) GetNameOk() (*string, bool) { if o == nil { return nil, false } - - return o.Name, true + return &o.Name, true } // SetName sets field value func (o *KubernetesClusterPropertiesForPut) SetName(v string) { - - o.Name = &v - + o.Name = v } -// HasName returns a boolean if a field has been set. -func (o *KubernetesClusterPropertiesForPut) HasName() bool { - if o != nil && o.Name != nil { - return true +// GetK8sVersion returns the K8sVersion field value if set, zero value otherwise. +func (o *KubernetesClusterPropertiesForPut) GetK8sVersion() string { + if o == nil || IsNil(o.K8sVersion) { + var ret string + return ret } - - return false + return *o.K8sVersion } -// GetK8sVersion returns the K8sVersion field value -// If the value is explicit nil, nil is returned -func (o *KubernetesClusterPropertiesForPut) GetK8sVersion() *string { - if o == nil { - return nil - } - - return o.K8sVersion - -} - -// GetK8sVersionOk returns a tuple with the K8sVersion field value +// GetK8sVersionOk returns a tuple with the K8sVersion 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 *KubernetesClusterPropertiesForPut) GetK8sVersionOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.K8sVersion) { return nil, false } - return o.K8sVersion, true } -// SetK8sVersion sets field value -func (o *KubernetesClusterPropertiesForPut) SetK8sVersion(v string) { - - o.K8sVersion = &v - -} - // HasK8sVersion returns a boolean if a field has been set. func (o *KubernetesClusterPropertiesForPut) HasK8sVersion() bool { - if o != nil && o.K8sVersion != nil { + if o != nil && !IsNil(o.K8sVersion) { return true } return false } -// GetMaintenanceWindow returns the MaintenanceWindow field value -// If the value is explicit nil, nil is returned -func (o *KubernetesClusterPropertiesForPut) GetMaintenanceWindow() *KubernetesMaintenanceWindow { - if o == nil { - return nil - } - - return o.MaintenanceWindow +// SetK8sVersion gets a reference to the given string and assigns it to the K8sVersion field. +func (o *KubernetesClusterPropertiesForPut) SetK8sVersion(v string) { + o.K8sVersion = &v +} +// GetMaintenanceWindow returns the MaintenanceWindow field value if set, zero value otherwise. +func (o *KubernetesClusterPropertiesForPut) GetMaintenanceWindow() KubernetesMaintenanceWindow { + if o == nil || IsNil(o.MaintenanceWindow) { + var ret KubernetesMaintenanceWindow + return ret + } + return *o.MaintenanceWindow } -// GetMaintenanceWindowOk returns a tuple with the MaintenanceWindow field value +// GetMaintenanceWindowOk returns a tuple with the MaintenanceWindow 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 *KubernetesClusterPropertiesForPut) GetMaintenanceWindowOk() (*KubernetesMaintenanceWindow, bool) { - if o == nil { + if o == nil || IsNil(o.MaintenanceWindow) { return nil, false } - return o.MaintenanceWindow, true } -// SetMaintenanceWindow sets field value -func (o *KubernetesClusterPropertiesForPut) SetMaintenanceWindow(v KubernetesMaintenanceWindow) { - - o.MaintenanceWindow = &v - -} - // HasMaintenanceWindow returns a boolean if a field has been set. func (o *KubernetesClusterPropertiesForPut) HasMaintenanceWindow() bool { - if o != nil && o.MaintenanceWindow != nil { + if o != nil && !IsNil(o.MaintenanceWindow) { return true } return false } -// GetApiSubnetAllowList returns the ApiSubnetAllowList field value -// If the value is explicit nil, nil is returned -func (o *KubernetesClusterPropertiesForPut) GetApiSubnetAllowList() *[]string { - if o == nil { - return nil - } +// SetMaintenanceWindow gets a reference to the given KubernetesMaintenanceWindow and assigns it to the MaintenanceWindow field. +func (o *KubernetesClusterPropertiesForPut) SetMaintenanceWindow(v KubernetesMaintenanceWindow) { + o.MaintenanceWindow = &v +} +// GetApiSubnetAllowList returns the ApiSubnetAllowList field value if set, zero value otherwise. +func (o *KubernetesClusterPropertiesForPut) GetApiSubnetAllowList() []string { + if o == nil || IsNil(o.ApiSubnetAllowList) { + var ret []string + return ret + } return o.ApiSubnetAllowList - } -// GetApiSubnetAllowListOk returns a tuple with the ApiSubnetAllowList field value +// GetApiSubnetAllowListOk returns a tuple with the ApiSubnetAllowList 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 *KubernetesClusterPropertiesForPut) GetApiSubnetAllowListOk() (*[]string, bool) { - if o == nil { +func (o *KubernetesClusterPropertiesForPut) GetApiSubnetAllowListOk() ([]string, bool) { + if o == nil || IsNil(o.ApiSubnetAllowList) { return nil, false } - return o.ApiSubnetAllowList, true } -// SetApiSubnetAllowList sets field value -func (o *KubernetesClusterPropertiesForPut) SetApiSubnetAllowList(v []string) { - - o.ApiSubnetAllowList = &v - -} - // HasApiSubnetAllowList returns a boolean if a field has been set. func (o *KubernetesClusterPropertiesForPut) HasApiSubnetAllowList() bool { - if o != nil && o.ApiSubnetAllowList != nil { + if o != nil && !IsNil(o.ApiSubnetAllowList) { return true } return false } -// GetS3Buckets returns the S3Buckets field value -// If the value is explicit nil, nil is returned -func (o *KubernetesClusterPropertiesForPut) GetS3Buckets() *[]S3Bucket { - if o == nil { - return nil - } +// SetApiSubnetAllowList gets a reference to the given []string and assigns it to the ApiSubnetAllowList field. +func (o *KubernetesClusterPropertiesForPut) SetApiSubnetAllowList(v []string) { + o.ApiSubnetAllowList = v +} +// GetS3Buckets returns the S3Buckets field value if set, zero value otherwise. +func (o *KubernetesClusterPropertiesForPut) GetS3Buckets() []S3Bucket { + if o == nil || IsNil(o.S3Buckets) { + var ret []S3Bucket + return ret + } return o.S3Buckets - } -// GetS3BucketsOk returns a tuple with the S3Buckets field value +// GetS3BucketsOk returns a tuple with the S3Buckets 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 *KubernetesClusterPropertiesForPut) GetS3BucketsOk() (*[]S3Bucket, bool) { - if o == nil { +func (o *KubernetesClusterPropertiesForPut) GetS3BucketsOk() ([]S3Bucket, bool) { + if o == nil || IsNil(o.S3Buckets) { return nil, false } - return o.S3Buckets, true } -// SetS3Buckets sets field value -func (o *KubernetesClusterPropertiesForPut) SetS3Buckets(v []S3Bucket) { - - o.S3Buckets = &v - -} - // HasS3Buckets returns a boolean if a field has been set. func (o *KubernetesClusterPropertiesForPut) HasS3Buckets() bool { - if o != nil && o.S3Buckets != nil { + if o != nil && !IsNil(o.S3Buckets) { return true } return false } +// SetS3Buckets gets a reference to the given []S3Bucket and assigns it to the S3Buckets field. +func (o *KubernetesClusterPropertiesForPut) SetS3Buckets(v []S3Bucket) { + o.S3Buckets = v +} + func (o KubernetesClusterPropertiesForPut) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.Name != nil { - toSerialize["name"] = o.Name + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } + return json.Marshal(toSerialize) +} - if o.K8sVersion != nil { +func (o KubernetesClusterPropertiesForPut) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["name"] = o.Name + if !IsNil(o.K8sVersion) { toSerialize["k8sVersion"] = o.K8sVersion } - - if o.MaintenanceWindow != nil { + if !IsNil(o.MaintenanceWindow) { toSerialize["maintenanceWindow"] = o.MaintenanceWindow } - - if o.ApiSubnetAllowList != nil { + if !IsNil(o.ApiSubnetAllowList) { toSerialize["apiSubnetAllowList"] = o.ApiSubnetAllowList } - - if o.S3Buckets != nil { + if !IsNil(o.S3Buckets) { toSerialize["s3Buckets"] = o.S3Buckets } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableKubernetesClusterPropertiesForPut struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_kubernetes_clusters.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_kubernetes_clusters.go similarity index 65% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_kubernetes_clusters.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_kubernetes_clusters.go index 9d3b6bea9..e58e3e9b5 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_kubernetes_clusters.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_kubernetes_clusters.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the KubernetesClusters type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &KubernetesClusters{} + // KubernetesClusters struct for KubernetesClusters type KubernetesClusters struct { // The unique representation of the K8s cluster as a resource collection. @@ -23,7 +26,7 @@ type KubernetesClusters struct { // The URL to the collection representation (absolute path). Href *string `json:"href,omitempty"` // Array of K8s clusters in the collection. - Items *[]KubernetesCluster `json:"items,omitempty"` + Items []KubernetesCluster `json:"items,omitempty"` } // NewKubernetesClusters instantiates a new KubernetesClusters object @@ -44,177 +47,157 @@ func NewKubernetesClustersWithDefaults() *KubernetesClusters { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *KubernetesClusters) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *KubernetesClusters) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *KubernetesClusters) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *KubernetesClusters) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *KubernetesClusters) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *KubernetesClusters) GetType() *string { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *KubernetesClusters) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *KubernetesClusters) 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 +// GetTypeOk returns a tuple with the Type 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 *KubernetesClusters) GetTypeOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *KubernetesClusters) SetType(v string) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *KubernetesClusters) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *KubernetesClusters) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *KubernetesClusters) SetType(v string) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *KubernetesClusters) 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 +// GetHrefOk returns a tuple with the Href 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 *KubernetesClusters) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *KubernetesClusters) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *KubernetesClusters) HasHref() bool { - if o != nil && o.Href != nil { + if o != nil && !IsNil(o.Href) { return true } return false } -// GetItems returns the Items field value -// If the value is explicit nil, nil is returned -func (o *KubernetesClusters) GetItems() *[]KubernetesCluster { - if o == nil { - return nil - } +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *KubernetesClusters) SetHref(v string) { + o.Href = &v +} +// GetItems returns the Items field value if set, zero value otherwise. +func (o *KubernetesClusters) GetItems() []KubernetesCluster { + if o == nil || IsNil(o.Items) { + var ret []KubernetesCluster + return ret + } return o.Items - } -// GetItemsOk returns a tuple with the Items field value +// GetItemsOk returns a tuple with the Items 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 *KubernetesClusters) GetItemsOk() (*[]KubernetesCluster, bool) { - if o == nil { +func (o *KubernetesClusters) GetItemsOk() ([]KubernetesCluster, bool) { + if o == nil || IsNil(o.Items) { return nil, false } - return o.Items, true } -// SetItems sets field value -func (o *KubernetesClusters) SetItems(v []KubernetesCluster) { - - o.Items = &v - -} - // HasItems returns a boolean if a field has been set. func (o *KubernetesClusters) HasItems() bool { - if o != nil && o.Items != nil { + if o != nil && !IsNil(o.Items) { return true } return false } +// SetItems gets a reference to the given []KubernetesCluster and assigns it to the Items field. +func (o *KubernetesClusters) SetItems(v []KubernetesCluster) { + o.Items = v +} + func (o KubernetesClusters) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o KubernetesClusters) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Items != nil { + if !IsNil(o.Items) { toSerialize["items"] = o.Items } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableKubernetesClusters struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_kubernetes_maintenance_window.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_kubernetes_maintenance_window.go similarity index 76% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_kubernetes_maintenance_window.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_kubernetes_maintenance_window.go index 86994eabd..91fbd67cb 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_kubernetes_maintenance_window.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_kubernetes_maintenance_window.go @@ -14,12 +14,15 @@ import ( "encoding/json" ) +// checks if the KubernetesMaintenanceWindow type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &KubernetesMaintenanceWindow{} + // KubernetesMaintenanceWindow struct for KubernetesMaintenanceWindow type KubernetesMaintenanceWindow struct { // The weekday for a maintenance window. - DayOfTheWeek *string `json:"dayOfTheWeek"` + DayOfTheWeek string `json:"dayOfTheWeek"` // The time to use for a maintenance window. Accepted formats are: HH:mm:ss; HH:mm:ss\"Z\"; HH:mm:ssZ. This time may vary by 15 minutes. - Time *string `json:"time"` + Time string `json:"time"` } // NewKubernetesMaintenanceWindow instantiates a new KubernetesMaintenanceWindow object @@ -29,8 +32,8 @@ type KubernetesMaintenanceWindow struct { func NewKubernetesMaintenanceWindow(dayOfTheWeek string, time string) *KubernetesMaintenanceWindow { this := KubernetesMaintenanceWindow{} - this.DayOfTheWeek = &dayOfTheWeek - this.Time = &time + this.DayOfTheWeek = dayOfTheWeek + this.Time = time return &this } @@ -44,92 +47,66 @@ func NewKubernetesMaintenanceWindowWithDefaults() *KubernetesMaintenanceWindow { } // GetDayOfTheWeek returns the DayOfTheWeek field value -// If the value is explicit nil, nil is returned -func (o *KubernetesMaintenanceWindow) GetDayOfTheWeek() *string { +func (o *KubernetesMaintenanceWindow) GetDayOfTheWeek() string { if o == nil { - return nil + var ret string + return ret } return o.DayOfTheWeek - } // GetDayOfTheWeekOk returns a tuple with the DayOfTheWeek field value // 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 *KubernetesMaintenanceWindow) GetDayOfTheWeekOk() (*string, bool) { if o == nil { return nil, false } - - return o.DayOfTheWeek, true + return &o.DayOfTheWeek, true } // SetDayOfTheWeek sets field value func (o *KubernetesMaintenanceWindow) SetDayOfTheWeek(v string) { - - o.DayOfTheWeek = &v - -} - -// HasDayOfTheWeek returns a boolean if a field has been set. -func (o *KubernetesMaintenanceWindow) HasDayOfTheWeek() bool { - if o != nil && o.DayOfTheWeek != nil { - return true - } - - return false + o.DayOfTheWeek = v } // GetTime returns the Time field value -// If the value is explicit nil, nil is returned -func (o *KubernetesMaintenanceWindow) GetTime() *string { +func (o *KubernetesMaintenanceWindow) GetTime() string { if o == nil { - return nil + var ret string + return ret } return o.Time - } // GetTimeOk returns a tuple with the Time field value // 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 *KubernetesMaintenanceWindow) GetTimeOk() (*string, bool) { if o == nil { return nil, false } - - return o.Time, true + return &o.Time, true } // SetTime sets field value func (o *KubernetesMaintenanceWindow) SetTime(v string) { - - o.Time = &v - + o.Time = v } -// HasTime returns a boolean if a field has been set. -func (o *KubernetesMaintenanceWindow) HasTime() bool { - if o != nil && o.Time != nil { - return true +func (o KubernetesMaintenanceWindow) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } - - return false + return json.Marshal(toSerialize) } -func (o KubernetesMaintenanceWindow) MarshalJSON() ([]byte, error) { +func (o KubernetesMaintenanceWindow) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.DayOfTheWeek != nil { - toSerialize["dayOfTheWeek"] = o.DayOfTheWeek - } - - if o.Time != nil { - toSerialize["time"] = o.Time - } - - return json.Marshal(toSerialize) + toSerialize["dayOfTheWeek"] = o.DayOfTheWeek + toSerialize["time"] = o.Time + return toSerialize, nil } type NullableKubernetesMaintenanceWindow struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_kubernetes_node.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_kubernetes_node.go similarity index 64% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_kubernetes_node.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_kubernetes_node.go index e2fd1b394..f6e74270e 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_kubernetes_node.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_kubernetes_node.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the KubernetesNode type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &KubernetesNode{} + // KubernetesNode struct for KubernetesNode type KubernetesNode struct { // The resource's unique identifier. @@ -21,9 +24,9 @@ type KubernetesNode struct { // The object type. Type *string `json:"type,omitempty"` // The URL to the object representation (absolute path). - Href *string `json:"href,omitempty"` - Metadata *KubernetesNodeMetadata `json:"metadata,omitempty"` - Properties *KubernetesNodeProperties `json:"properties"` + Href *string `json:"href,omitempty"` + Metadata *KubernetesNodeMetadata `json:"metadata,omitempty"` + Properties KubernetesNodeProperties `json:"properties"` } // NewKubernetesNode instantiates a new KubernetesNode object @@ -33,7 +36,7 @@ type KubernetesNode struct { func NewKubernetesNode(properties KubernetesNodeProperties) *KubernetesNode { this := KubernetesNode{} - this.Properties = &properties + this.Properties = properties return &this } @@ -46,219 +49,182 @@ func NewKubernetesNodeWithDefaults() *KubernetesNode { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNode) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *KubernetesNode) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *KubernetesNode) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *KubernetesNode) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *KubernetesNode) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNode) GetType() *string { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *KubernetesNode) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *KubernetesNode) 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 +// GetTypeOk returns a tuple with the Type 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 *KubernetesNode) GetTypeOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *KubernetesNode) SetType(v string) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *KubernetesNode) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNode) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *KubernetesNode) SetType(v string) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *KubernetesNode) 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 +// GetHrefOk returns a tuple with the Href 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 *KubernetesNode) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *KubernetesNode) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *KubernetesNode) HasHref() bool { - if o != nil && o.Href != nil { + if o != nil && !IsNil(o.Href) { return true } return false } -// GetMetadata returns the Metadata field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNode) GetMetadata() *KubernetesNodeMetadata { - if o == nil { - return nil - } - - return o.Metadata +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *KubernetesNode) SetHref(v string) { + o.Href = &v +} +// GetMetadata returns the Metadata field value if set, zero value otherwise. +func (o *KubernetesNode) GetMetadata() KubernetesNodeMetadata { + if o == nil || IsNil(o.Metadata) { + var ret KubernetesNodeMetadata + return ret + } + return *o.Metadata } -// GetMetadataOk returns a tuple with the Metadata field value +// GetMetadataOk returns a tuple with the Metadata 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 *KubernetesNode) GetMetadataOk() (*KubernetesNodeMetadata, bool) { - if o == nil { + if o == nil || IsNil(o.Metadata) { return nil, false } - return o.Metadata, true } -// SetMetadata sets field value -func (o *KubernetesNode) SetMetadata(v KubernetesNodeMetadata) { - - o.Metadata = &v - -} - // HasMetadata returns a boolean if a field has been set. func (o *KubernetesNode) HasMetadata() bool { - if o != nil && o.Metadata != nil { + if o != nil && !IsNil(o.Metadata) { return true } return false } +// SetMetadata gets a reference to the given KubernetesNodeMetadata and assigns it to the Metadata field. +func (o *KubernetesNode) SetMetadata(v KubernetesNodeMetadata) { + o.Metadata = &v +} + // GetProperties returns the Properties field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNode) GetProperties() *KubernetesNodeProperties { +func (o *KubernetesNode) GetProperties() KubernetesNodeProperties { if o == nil { - return nil + var ret KubernetesNodeProperties + return ret } return o.Properties - } // GetPropertiesOk returns a tuple with the Properties field value // 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 *KubernetesNode) GetPropertiesOk() (*KubernetesNodeProperties, bool) { if o == nil { return nil, false } - - return o.Properties, true + return &o.Properties, true } // SetProperties sets field value func (o *KubernetesNode) SetProperties(v KubernetesNodeProperties) { - - o.Properties = &v - + o.Properties = v } -// HasProperties returns a boolean if a field has been set. -func (o *KubernetesNode) HasProperties() bool { - if o != nil && o.Properties != nil { - return true +func (o KubernetesNode) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } - - return false + return json.Marshal(toSerialize) } -func (o KubernetesNode) MarshalJSON() ([]byte, error) { +func (o KubernetesNode) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Metadata != nil { + if !IsNil(o.Metadata) { toSerialize["metadata"] = o.Metadata } - - if o.Properties != nil { - toSerialize["properties"] = o.Properties - } - - return json.Marshal(toSerialize) + toSerialize["properties"] = o.Properties + return toSerialize, nil } type NullableKubernetesNode struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_kubernetes_node_metadata.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_kubernetes_node_metadata.go similarity index 65% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_kubernetes_node_metadata.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_kubernetes_node_metadata.go index d810eed54..0657c52d7 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_kubernetes_node_metadata.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_kubernetes_node_metadata.go @@ -12,21 +12,25 @@ package ionoscloud import ( "encoding/json" + "time" ) +// checks if the KubernetesNodeMetadata type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &KubernetesNodeMetadata{} + // KubernetesNodeMetadata struct for KubernetesNodeMetadata type KubernetesNodeMetadata struct { // The resource entity tag as defined in http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.11 Entity tags are also added as 'ETag' response headers to requests that do not use the 'depth' parameter. Etag *string `json:"etag,omitempty"` // The date the resource was created. - CreatedDate *IonosTime + CreatedDate *IonosTime `json:"createdDate,omitempty"` // The date the resource was last modified. - LastModifiedDate *IonosTime + LastModifiedDate *IonosTime `json:"lastModifiedDate,omitempty"` // The resource state. State *string `json:"state,omitempty"` // The date when the software on the node was last updated. - LastSoftwareUpdatedDate *IonosTime + LastSoftwareUpdatedDate *IonosTime `json:"lastSoftwareUpdatedDate,omitempty"` } // NewKubernetesNodeMetadata instantiates a new KubernetesNodeMetadata object @@ -47,240 +51,192 @@ func NewKubernetesNodeMetadataWithDefaults() *KubernetesNodeMetadata { return &this } -// GetEtag returns the Etag field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNodeMetadata) GetEtag() *string { - if o == nil { - return nil +// GetEtag returns the Etag field value if set, zero value otherwise. +func (o *KubernetesNodeMetadata) GetEtag() string { + if o == nil || IsNil(o.Etag) { + var ret string + return ret } - - return o.Etag - + return *o.Etag } -// GetEtagOk returns a tuple with the Etag field value +// GetEtagOk returns a tuple with the Etag 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 *KubernetesNodeMetadata) GetEtagOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Etag) { return nil, false } - return o.Etag, true } -// SetEtag sets field value -func (o *KubernetesNodeMetadata) SetEtag(v string) { - - o.Etag = &v - -} - // HasEtag returns a boolean if a field has been set. func (o *KubernetesNodeMetadata) HasEtag() bool { - if o != nil && o.Etag != nil { + if o != nil && !IsNil(o.Etag) { return true } return false } -// GetCreatedDate returns the CreatedDate field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNodeMetadata) GetCreatedDate() *time.Time { - if o == nil { - return nil - } +// SetEtag gets a reference to the given string and assigns it to the Etag field. +func (o *KubernetesNodeMetadata) SetEtag(v string) { + o.Etag = &v +} - if o.CreatedDate == nil { - return nil +// GetCreatedDate returns the CreatedDate field value if set, zero value otherwise. +func (o *KubernetesNodeMetadata) GetCreatedDate() time.Time { + if o == nil || IsNil(o.CreatedDate) { + var ret time.Time + return ret } - return &o.CreatedDate.Time - + return o.CreatedDate.Time } -// GetCreatedDateOk returns a tuple with the CreatedDate field value +// GetCreatedDateOk returns a tuple with the CreatedDate 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 *KubernetesNodeMetadata) GetCreatedDateOk() (*time.Time, bool) { - if o == nil { - return nil, false - } - - if o.CreatedDate == nil { + if o == nil || IsNil(o.CreatedDate) { return nil, false } return &o.CreatedDate.Time, true - -} - -// SetCreatedDate sets field value -func (o *KubernetesNodeMetadata) SetCreatedDate(v time.Time) { - - o.CreatedDate = &IonosTime{v} - } // HasCreatedDate returns a boolean if a field has been set. func (o *KubernetesNodeMetadata) HasCreatedDate() bool { - if o != nil && o.CreatedDate != nil { + if o != nil && !IsNil(o.CreatedDate) { return true } return false } -// GetLastModifiedDate returns the LastModifiedDate field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNodeMetadata) GetLastModifiedDate() *time.Time { - if o == nil { - return nil - } +// SetCreatedDate gets a reference to the given time.Time and assigns it to the CreatedDate field. +func (o *KubernetesNodeMetadata) SetCreatedDate(v time.Time) { + o.CreatedDate = &IonosTime{v} +} - if o.LastModifiedDate == nil { - return nil +// GetLastModifiedDate returns the LastModifiedDate field value if set, zero value otherwise. +func (o *KubernetesNodeMetadata) GetLastModifiedDate() time.Time { + if o == nil || IsNil(o.LastModifiedDate) { + var ret time.Time + return ret } - return &o.LastModifiedDate.Time - + return o.LastModifiedDate.Time } -// GetLastModifiedDateOk returns a tuple with the LastModifiedDate field value +// GetLastModifiedDateOk returns a tuple with the LastModifiedDate 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 *KubernetesNodeMetadata) GetLastModifiedDateOk() (*time.Time, bool) { - if o == nil { - return nil, false - } - - if o.LastModifiedDate == nil { + if o == nil || IsNil(o.LastModifiedDate) { return nil, false } return &o.LastModifiedDate.Time, true - -} - -// SetLastModifiedDate sets field value -func (o *KubernetesNodeMetadata) SetLastModifiedDate(v time.Time) { - - o.LastModifiedDate = &IonosTime{v} - } // HasLastModifiedDate returns a boolean if a field has been set. func (o *KubernetesNodeMetadata) HasLastModifiedDate() bool { - if o != nil && o.LastModifiedDate != nil { + if o != nil && !IsNil(o.LastModifiedDate) { return true } return false } -// GetState returns the State field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNodeMetadata) GetState() *string { - if o == nil { - return nil - } - - return o.State +// SetLastModifiedDate gets a reference to the given time.Time and assigns it to the LastModifiedDate field. +func (o *KubernetesNodeMetadata) SetLastModifiedDate(v time.Time) { + o.LastModifiedDate = &IonosTime{v} +} +// GetState returns the State field value if set, zero value otherwise. +func (o *KubernetesNodeMetadata) 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 +// GetStateOk returns a tuple with the State 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 *KubernetesNodeMetadata) GetStateOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.State) { return nil, false } - return o.State, true } -// SetState sets field value -func (o *KubernetesNodeMetadata) SetState(v string) { - - o.State = &v - -} - // HasState returns a boolean if a field has been set. func (o *KubernetesNodeMetadata) HasState() bool { - if o != nil && o.State != nil { + if o != nil && !IsNil(o.State) { return true } return false } -// GetLastSoftwareUpdatedDate returns the LastSoftwareUpdatedDate field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNodeMetadata) GetLastSoftwareUpdatedDate() *time.Time { - if o == nil { - return nil - } +// SetState gets a reference to the given string and assigns it to the State field. +func (o *KubernetesNodeMetadata) SetState(v string) { + o.State = &v +} - if o.LastSoftwareUpdatedDate == nil { - return nil +// GetLastSoftwareUpdatedDate returns the LastSoftwareUpdatedDate field value if set, zero value otherwise. +func (o *KubernetesNodeMetadata) GetLastSoftwareUpdatedDate() time.Time { + if o == nil || IsNil(o.LastSoftwareUpdatedDate) { + var ret time.Time + return ret } - return &o.LastSoftwareUpdatedDate.Time - + return o.LastSoftwareUpdatedDate.Time } -// GetLastSoftwareUpdatedDateOk returns a tuple with the LastSoftwareUpdatedDate field value +// GetLastSoftwareUpdatedDateOk returns a tuple with the LastSoftwareUpdatedDate 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 *KubernetesNodeMetadata) GetLastSoftwareUpdatedDateOk() (*time.Time, bool) { - if o == nil { - return nil, false - } - - if o.LastSoftwareUpdatedDate == nil { + if o == nil || IsNil(o.LastSoftwareUpdatedDate) { return nil, false } return &o.LastSoftwareUpdatedDate.Time, true - -} - -// SetLastSoftwareUpdatedDate sets field value -func (o *KubernetesNodeMetadata) SetLastSoftwareUpdatedDate(v time.Time) { - - o.LastSoftwareUpdatedDate = &IonosTime{v} - } // HasLastSoftwareUpdatedDate returns a boolean if a field has been set. func (o *KubernetesNodeMetadata) HasLastSoftwareUpdatedDate() bool { - if o != nil && o.LastSoftwareUpdatedDate != nil { + if o != nil && !IsNil(o.LastSoftwareUpdatedDate) { return true } return false } +// SetLastSoftwareUpdatedDate gets a reference to the given time.Time and assigns it to the LastSoftwareUpdatedDate field. +func (o *KubernetesNodeMetadata) SetLastSoftwareUpdatedDate(v time.Time) { + o.LastSoftwareUpdatedDate = &IonosTime{v} +} + func (o KubernetesNodeMetadata) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o KubernetesNodeMetadata) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Etag != nil { + if !IsNil(o.Etag) { toSerialize["etag"] = o.Etag } - - if o.CreatedDate != nil { + if !IsNil(o.CreatedDate) { toSerialize["createdDate"] = o.CreatedDate } - - if o.LastModifiedDate != nil { + if !IsNil(o.LastModifiedDate) { toSerialize["lastModifiedDate"] = o.LastModifiedDate } - - if o.State != nil { + if !IsNil(o.State) { toSerialize["state"] = o.State } - - if o.LastSoftwareUpdatedDate != nil { + if !IsNil(o.LastSoftwareUpdatedDate) { toSerialize["lastSoftwareUpdatedDate"] = o.LastSoftwareUpdatedDate } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableKubernetesNodeMetadata struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_kubernetes_node_pool.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_kubernetes_node_pool.go similarity index 64% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_kubernetes_node_pool.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_kubernetes_node_pool.go index dd4f5d406..9bfe18500 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_kubernetes_node_pool.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_kubernetes_node_pool.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the KubernetesNodePool type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &KubernetesNodePool{} + // KubernetesNodePool struct for KubernetesNodePool type KubernetesNodePool struct { // The resource's unique identifier. @@ -21,9 +24,9 @@ type KubernetesNodePool struct { // The object type. Type *string `json:"type,omitempty"` // The URL to the object representation (absolute path). - Href *string `json:"href,omitempty"` - Metadata *DatacenterElementMetadata `json:"metadata,omitempty"` - Properties *KubernetesNodePoolProperties `json:"properties"` + Href *string `json:"href,omitempty"` + Metadata *DatacenterElementMetadata `json:"metadata,omitempty"` + Properties KubernetesNodePoolProperties `json:"properties"` } // NewKubernetesNodePool instantiates a new KubernetesNodePool object @@ -33,7 +36,7 @@ type KubernetesNodePool struct { func NewKubernetesNodePool(properties KubernetesNodePoolProperties) *KubernetesNodePool { this := KubernetesNodePool{} - this.Properties = &properties + this.Properties = properties return &this } @@ -46,219 +49,182 @@ func NewKubernetesNodePoolWithDefaults() *KubernetesNodePool { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNodePool) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *KubernetesNodePool) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *KubernetesNodePool) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *KubernetesNodePool) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *KubernetesNodePool) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNodePool) GetType() *string { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *KubernetesNodePool) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *KubernetesNodePool) 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 +// GetTypeOk returns a tuple with the Type 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 *KubernetesNodePool) GetTypeOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *KubernetesNodePool) SetType(v string) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *KubernetesNodePool) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNodePool) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *KubernetesNodePool) SetType(v string) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *KubernetesNodePool) 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 +// GetHrefOk returns a tuple with the Href 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 *KubernetesNodePool) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *KubernetesNodePool) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *KubernetesNodePool) HasHref() bool { - if o != nil && o.Href != nil { + if o != nil && !IsNil(o.Href) { return true } return false } -// GetMetadata returns the Metadata field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNodePool) GetMetadata() *DatacenterElementMetadata { - if o == nil { - return nil - } - - return o.Metadata +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *KubernetesNodePool) SetHref(v string) { + o.Href = &v +} +// GetMetadata returns the Metadata field value if set, zero value otherwise. +func (o *KubernetesNodePool) GetMetadata() DatacenterElementMetadata { + if o == nil || IsNil(o.Metadata) { + var ret DatacenterElementMetadata + return ret + } + return *o.Metadata } -// GetMetadataOk returns a tuple with the Metadata field value +// GetMetadataOk returns a tuple with the Metadata 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 *KubernetesNodePool) GetMetadataOk() (*DatacenterElementMetadata, bool) { - if o == nil { + if o == nil || IsNil(o.Metadata) { return nil, false } - return o.Metadata, true } -// SetMetadata sets field value -func (o *KubernetesNodePool) SetMetadata(v DatacenterElementMetadata) { - - o.Metadata = &v - -} - // HasMetadata returns a boolean if a field has been set. func (o *KubernetesNodePool) HasMetadata() bool { - if o != nil && o.Metadata != nil { + if o != nil && !IsNil(o.Metadata) { return true } return false } +// SetMetadata gets a reference to the given DatacenterElementMetadata and assigns it to the Metadata field. +func (o *KubernetesNodePool) SetMetadata(v DatacenterElementMetadata) { + o.Metadata = &v +} + // GetProperties returns the Properties field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNodePool) GetProperties() *KubernetesNodePoolProperties { +func (o *KubernetesNodePool) GetProperties() KubernetesNodePoolProperties { if o == nil { - return nil + var ret KubernetesNodePoolProperties + return ret } return o.Properties - } // GetPropertiesOk returns a tuple with the Properties field value // 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 *KubernetesNodePool) GetPropertiesOk() (*KubernetesNodePoolProperties, bool) { if o == nil { return nil, false } - - return o.Properties, true + return &o.Properties, true } // SetProperties sets field value func (o *KubernetesNodePool) SetProperties(v KubernetesNodePoolProperties) { - - o.Properties = &v - + o.Properties = v } -// HasProperties returns a boolean if a field has been set. -func (o *KubernetesNodePool) HasProperties() bool { - if o != nil && o.Properties != nil { - return true +func (o KubernetesNodePool) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } - - return false + return json.Marshal(toSerialize) } -func (o KubernetesNodePool) MarshalJSON() ([]byte, error) { +func (o KubernetesNodePool) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Metadata != nil { + if !IsNil(o.Metadata) { toSerialize["metadata"] = o.Metadata } - - if o.Properties != nil { - toSerialize["properties"] = o.Properties - } - - return json.Marshal(toSerialize) + toSerialize["properties"] = o.Properties + return toSerialize, nil } type NullableKubernetesNodePool struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_kubernetes_node_pool_for_post.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_kubernetes_node_pool_for_post.go similarity index 65% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_kubernetes_node_pool_for_post.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_kubernetes_node_pool_for_post.go index da4033525..80bfb90ea 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_kubernetes_node_pool_for_post.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_kubernetes_node_pool_for_post.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the KubernetesNodePoolForPost type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &KubernetesNodePoolForPost{} + // KubernetesNodePoolForPost struct for KubernetesNodePoolForPost type KubernetesNodePoolForPost struct { // The resource's unique identifier. @@ -21,9 +24,9 @@ type KubernetesNodePoolForPost struct { // The object type. Type *string `json:"type,omitempty"` // The URL to the object representation (absolute path). - Href *string `json:"href,omitempty"` - Metadata *DatacenterElementMetadata `json:"metadata,omitempty"` - Properties *KubernetesNodePoolPropertiesForPost `json:"properties"` + Href *string `json:"href,omitempty"` + Metadata *DatacenterElementMetadata `json:"metadata,omitempty"` + Properties KubernetesNodePoolPropertiesForPost `json:"properties"` } // NewKubernetesNodePoolForPost instantiates a new KubernetesNodePoolForPost object @@ -33,7 +36,7 @@ type KubernetesNodePoolForPost struct { func NewKubernetesNodePoolForPost(properties KubernetesNodePoolPropertiesForPost) *KubernetesNodePoolForPost { this := KubernetesNodePoolForPost{} - this.Properties = &properties + this.Properties = properties return &this } @@ -46,219 +49,182 @@ func NewKubernetesNodePoolForPostWithDefaults() *KubernetesNodePoolForPost { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNodePoolForPost) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *KubernetesNodePoolForPost) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *KubernetesNodePoolForPost) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *KubernetesNodePoolForPost) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *KubernetesNodePoolForPost) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNodePoolForPost) GetType() *string { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *KubernetesNodePoolForPost) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *KubernetesNodePoolForPost) 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 +// GetTypeOk returns a tuple with the Type 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 *KubernetesNodePoolForPost) GetTypeOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *KubernetesNodePoolForPost) SetType(v string) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *KubernetesNodePoolForPost) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNodePoolForPost) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *KubernetesNodePoolForPost) SetType(v string) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *KubernetesNodePoolForPost) 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 +// GetHrefOk returns a tuple with the Href 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 *KubernetesNodePoolForPost) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *KubernetesNodePoolForPost) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *KubernetesNodePoolForPost) HasHref() bool { - if o != nil && o.Href != nil { + if o != nil && !IsNil(o.Href) { return true } return false } -// GetMetadata returns the Metadata field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNodePoolForPost) GetMetadata() *DatacenterElementMetadata { - if o == nil { - return nil - } - - return o.Metadata +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *KubernetesNodePoolForPost) SetHref(v string) { + o.Href = &v +} +// GetMetadata returns the Metadata field value if set, zero value otherwise. +func (o *KubernetesNodePoolForPost) GetMetadata() DatacenterElementMetadata { + if o == nil || IsNil(o.Metadata) { + var ret DatacenterElementMetadata + return ret + } + return *o.Metadata } -// GetMetadataOk returns a tuple with the Metadata field value +// GetMetadataOk returns a tuple with the Metadata 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 *KubernetesNodePoolForPost) GetMetadataOk() (*DatacenterElementMetadata, bool) { - if o == nil { + if o == nil || IsNil(o.Metadata) { return nil, false } - return o.Metadata, true } -// SetMetadata sets field value -func (o *KubernetesNodePoolForPost) SetMetadata(v DatacenterElementMetadata) { - - o.Metadata = &v - -} - // HasMetadata returns a boolean if a field has been set. func (o *KubernetesNodePoolForPost) HasMetadata() bool { - if o != nil && o.Metadata != nil { + if o != nil && !IsNil(o.Metadata) { return true } return false } +// SetMetadata gets a reference to the given DatacenterElementMetadata and assigns it to the Metadata field. +func (o *KubernetesNodePoolForPost) SetMetadata(v DatacenterElementMetadata) { + o.Metadata = &v +} + // GetProperties returns the Properties field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNodePoolForPost) GetProperties() *KubernetesNodePoolPropertiesForPost { +func (o *KubernetesNodePoolForPost) GetProperties() KubernetesNodePoolPropertiesForPost { if o == nil { - return nil + var ret KubernetesNodePoolPropertiesForPost + return ret } return o.Properties - } // GetPropertiesOk returns a tuple with the Properties field value // 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 *KubernetesNodePoolForPost) GetPropertiesOk() (*KubernetesNodePoolPropertiesForPost, bool) { if o == nil { return nil, false } - - return o.Properties, true + return &o.Properties, true } // SetProperties sets field value func (o *KubernetesNodePoolForPost) SetProperties(v KubernetesNodePoolPropertiesForPost) { - - o.Properties = &v - + o.Properties = v } -// HasProperties returns a boolean if a field has been set. -func (o *KubernetesNodePoolForPost) HasProperties() bool { - if o != nil && o.Properties != nil { - return true +func (o KubernetesNodePoolForPost) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } - - return false + return json.Marshal(toSerialize) } -func (o KubernetesNodePoolForPost) MarshalJSON() ([]byte, error) { +func (o KubernetesNodePoolForPost) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Metadata != nil { + if !IsNil(o.Metadata) { toSerialize["metadata"] = o.Metadata } - - if o.Properties != nil { - toSerialize["properties"] = o.Properties - } - - return json.Marshal(toSerialize) + toSerialize["properties"] = o.Properties + return toSerialize, nil } type NullableKubernetesNodePoolForPost struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_kubernetes_node_pool_for_put.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_kubernetes_node_pool_for_put.go similarity index 65% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_kubernetes_node_pool_for_put.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_kubernetes_node_pool_for_put.go index 076af3167..993cddfc9 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_kubernetes_node_pool_for_put.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_kubernetes_node_pool_for_put.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the KubernetesNodePoolForPut type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &KubernetesNodePoolForPut{} + // KubernetesNodePoolForPut struct for KubernetesNodePoolForPut type KubernetesNodePoolForPut struct { // The resource's unique identifier. @@ -21,9 +24,9 @@ type KubernetesNodePoolForPut struct { // The object type. Type *string `json:"type,omitempty"` // The URL to the object representation (absolute path). - Href *string `json:"href,omitempty"` - Metadata *DatacenterElementMetadata `json:"metadata,omitempty"` - Properties *KubernetesNodePoolPropertiesForPut `json:"properties"` + Href *string `json:"href,omitempty"` + Metadata *DatacenterElementMetadata `json:"metadata,omitempty"` + Properties KubernetesNodePoolPropertiesForPut `json:"properties"` } // NewKubernetesNodePoolForPut instantiates a new KubernetesNodePoolForPut object @@ -33,7 +36,7 @@ type KubernetesNodePoolForPut struct { func NewKubernetesNodePoolForPut(properties KubernetesNodePoolPropertiesForPut) *KubernetesNodePoolForPut { this := KubernetesNodePoolForPut{} - this.Properties = &properties + this.Properties = properties return &this } @@ -46,219 +49,182 @@ func NewKubernetesNodePoolForPutWithDefaults() *KubernetesNodePoolForPut { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNodePoolForPut) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *KubernetesNodePoolForPut) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *KubernetesNodePoolForPut) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *KubernetesNodePoolForPut) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *KubernetesNodePoolForPut) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNodePoolForPut) GetType() *string { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *KubernetesNodePoolForPut) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *KubernetesNodePoolForPut) 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 +// GetTypeOk returns a tuple with the Type 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 *KubernetesNodePoolForPut) GetTypeOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *KubernetesNodePoolForPut) SetType(v string) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *KubernetesNodePoolForPut) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNodePoolForPut) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *KubernetesNodePoolForPut) SetType(v string) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *KubernetesNodePoolForPut) 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 +// GetHrefOk returns a tuple with the Href 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 *KubernetesNodePoolForPut) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *KubernetesNodePoolForPut) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *KubernetesNodePoolForPut) HasHref() bool { - if o != nil && o.Href != nil { + if o != nil && !IsNil(o.Href) { return true } return false } -// GetMetadata returns the Metadata field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNodePoolForPut) GetMetadata() *DatacenterElementMetadata { - if o == nil { - return nil - } - - return o.Metadata +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *KubernetesNodePoolForPut) SetHref(v string) { + o.Href = &v +} +// GetMetadata returns the Metadata field value if set, zero value otherwise. +func (o *KubernetesNodePoolForPut) GetMetadata() DatacenterElementMetadata { + if o == nil || IsNil(o.Metadata) { + var ret DatacenterElementMetadata + return ret + } + return *o.Metadata } -// GetMetadataOk returns a tuple with the Metadata field value +// GetMetadataOk returns a tuple with the Metadata 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 *KubernetesNodePoolForPut) GetMetadataOk() (*DatacenterElementMetadata, bool) { - if o == nil { + if o == nil || IsNil(o.Metadata) { return nil, false } - return o.Metadata, true } -// SetMetadata sets field value -func (o *KubernetesNodePoolForPut) SetMetadata(v DatacenterElementMetadata) { - - o.Metadata = &v - -} - // HasMetadata returns a boolean if a field has been set. func (o *KubernetesNodePoolForPut) HasMetadata() bool { - if o != nil && o.Metadata != nil { + if o != nil && !IsNil(o.Metadata) { return true } return false } +// SetMetadata gets a reference to the given DatacenterElementMetadata and assigns it to the Metadata field. +func (o *KubernetesNodePoolForPut) SetMetadata(v DatacenterElementMetadata) { + o.Metadata = &v +} + // GetProperties returns the Properties field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNodePoolForPut) GetProperties() *KubernetesNodePoolPropertiesForPut { +func (o *KubernetesNodePoolForPut) GetProperties() KubernetesNodePoolPropertiesForPut { if o == nil { - return nil + var ret KubernetesNodePoolPropertiesForPut + return ret } return o.Properties - } // GetPropertiesOk returns a tuple with the Properties field value // 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 *KubernetesNodePoolForPut) GetPropertiesOk() (*KubernetesNodePoolPropertiesForPut, bool) { if o == nil { return nil, false } - - return o.Properties, true + return &o.Properties, true } // SetProperties sets field value func (o *KubernetesNodePoolForPut) SetProperties(v KubernetesNodePoolPropertiesForPut) { - - o.Properties = &v - + o.Properties = v } -// HasProperties returns a boolean if a field has been set. -func (o *KubernetesNodePoolForPut) HasProperties() bool { - if o != nil && o.Properties != nil { - return true +func (o KubernetesNodePoolForPut) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } - - return false + return json.Marshal(toSerialize) } -func (o KubernetesNodePoolForPut) MarshalJSON() ([]byte, error) { +func (o KubernetesNodePoolForPut) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Metadata != nil { + if !IsNil(o.Metadata) { toSerialize["metadata"] = o.Metadata } - - if o.Properties != nil { - toSerialize["properties"] = o.Properties - } - - return json.Marshal(toSerialize) + toSerialize["properties"] = o.Properties + return toSerialize, nil } type NullableKubernetesNodePoolForPut struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_kubernetes_node_pool_lan.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_kubernetes_node_pool_lan.go similarity index 68% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_kubernetes_node_pool_lan.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_kubernetes_node_pool_lan.go index 7086b6b1e..885bfcdda 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_kubernetes_node_pool_lan.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_kubernetes_node_pool_lan.go @@ -14,16 +14,19 @@ import ( "encoding/json" ) +// checks if the KubernetesNodePoolLan type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &KubernetesNodePoolLan{} + // KubernetesNodePoolLan struct for KubernetesNodePoolLan type KubernetesNodePoolLan struct { // The datacenter ID, requires system privileges, for internal usage only DatacenterId *string `json:"datacenterId,omitempty"` // The LAN ID of an existing LAN at the related data center - Id *int32 `json:"id"` + Id int32 `json:"id"` // Specifies whether the Kubernetes node pool LAN reserves an IP with DHCP. Dhcp *bool `json:"dhcp,omitempty"` // The array of additional LANs attached to worker nodes. - Routes *[]KubernetesNodePoolLanRoutes `json:"routes,omitempty"` + Routes []KubernetesNodePoolLanRoutes `json:"routes,omitempty"` } // NewKubernetesNodePoolLan instantiates a new KubernetesNodePoolLan object @@ -33,7 +36,7 @@ type KubernetesNodePoolLan struct { func NewKubernetesNodePoolLan(id int32) *KubernetesNodePoolLan { this := KubernetesNodePoolLan{} - this.Id = &id + this.Id = id return &this } @@ -46,177 +49,147 @@ func NewKubernetesNodePoolLanWithDefaults() *KubernetesNodePoolLan { return &this } -// GetDatacenterId returns the DatacenterId field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNodePoolLan) GetDatacenterId() *string { - if o == nil { - return nil +// GetDatacenterId returns the DatacenterId field value if set, zero value otherwise. +func (o *KubernetesNodePoolLan) GetDatacenterId() string { + if o == nil || IsNil(o.DatacenterId) { + var ret string + return ret } - - return o.DatacenterId - + return *o.DatacenterId } -// GetDatacenterIdOk returns a tuple with the DatacenterId field value +// GetDatacenterIdOk returns a tuple with the DatacenterId 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 *KubernetesNodePoolLan) GetDatacenterIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.DatacenterId) { return nil, false } - return o.DatacenterId, true } -// SetDatacenterId sets field value -func (o *KubernetesNodePoolLan) SetDatacenterId(v string) { - - o.DatacenterId = &v - -} - // HasDatacenterId returns a boolean if a field has been set. func (o *KubernetesNodePoolLan) HasDatacenterId() bool { - if o != nil && o.DatacenterId != nil { + if o != nil && !IsNil(o.DatacenterId) { return true } return false } +// SetDatacenterId gets a reference to the given string and assigns it to the DatacenterId field. +func (o *KubernetesNodePoolLan) SetDatacenterId(v string) { + o.DatacenterId = &v +} + // GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNodePoolLan) GetId() *int32 { +func (o *KubernetesNodePoolLan) GetId() int32 { if o == nil { - return nil + var ret int32 + 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. -// NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *KubernetesNodePoolLan) GetIdOk() (*int32, bool) { if o == nil { return nil, false } - - return o.Id, true + return &o.Id, true } // SetId sets field value func (o *KubernetesNodePoolLan) SetId(v int32) { - - o.Id = &v - -} - -// HasId returns a boolean if a field has been set. -func (o *KubernetesNodePoolLan) HasId() bool { - if o != nil && o.Id != nil { - return true - } - - return false + o.Id = v } -// GetDhcp returns the Dhcp field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNodePoolLan) GetDhcp() *bool { - if o == nil { - return nil +// GetDhcp returns the Dhcp field value if set, zero value otherwise. +func (o *KubernetesNodePoolLan) GetDhcp() bool { + if o == nil || IsNil(o.Dhcp) { + var ret bool + return ret } - - return o.Dhcp - + return *o.Dhcp } -// GetDhcpOk returns a tuple with the Dhcp field value +// GetDhcpOk returns a tuple with the Dhcp 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 *KubernetesNodePoolLan) GetDhcpOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.Dhcp) { return nil, false } - return o.Dhcp, true } -// SetDhcp sets field value -func (o *KubernetesNodePoolLan) SetDhcp(v bool) { - - o.Dhcp = &v - -} - // HasDhcp returns a boolean if a field has been set. func (o *KubernetesNodePoolLan) HasDhcp() bool { - if o != nil && o.Dhcp != nil { + if o != nil && !IsNil(o.Dhcp) { return true } return false } -// GetRoutes returns the Routes field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNodePoolLan) GetRoutes() *[]KubernetesNodePoolLanRoutes { - if o == nil { - return nil - } +// SetDhcp gets a reference to the given bool and assigns it to the Dhcp field. +func (o *KubernetesNodePoolLan) SetDhcp(v bool) { + o.Dhcp = &v +} +// GetRoutes returns the Routes field value if set, zero value otherwise. +func (o *KubernetesNodePoolLan) GetRoutes() []KubernetesNodePoolLanRoutes { + if o == nil || IsNil(o.Routes) { + var ret []KubernetesNodePoolLanRoutes + return ret + } return o.Routes - } -// GetRoutesOk returns a tuple with the Routes field value +// GetRoutesOk returns a tuple with the Routes 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 *KubernetesNodePoolLan) GetRoutesOk() (*[]KubernetesNodePoolLanRoutes, bool) { - if o == nil { +func (o *KubernetesNodePoolLan) GetRoutesOk() ([]KubernetesNodePoolLanRoutes, bool) { + if o == nil || IsNil(o.Routes) { return nil, false } - return o.Routes, true } -// SetRoutes sets field value -func (o *KubernetesNodePoolLan) SetRoutes(v []KubernetesNodePoolLanRoutes) { - - o.Routes = &v - -} - // HasRoutes returns a boolean if a field has been set. func (o *KubernetesNodePoolLan) HasRoutes() bool { - if o != nil && o.Routes != nil { + if o != nil && !IsNil(o.Routes) { return true } return false } +// SetRoutes gets a reference to the given []KubernetesNodePoolLanRoutes and assigns it to the Routes field. +func (o *KubernetesNodePoolLan) SetRoutes(v []KubernetesNodePoolLanRoutes) { + o.Routes = v +} + func (o KubernetesNodePoolLan) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.DatacenterId != nil { - toSerialize["datacenterId"] = o.DatacenterId + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } + return json.Marshal(toSerialize) +} - if o.Id != nil { - toSerialize["id"] = o.Id +func (o KubernetesNodePoolLan) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.DatacenterId) { + toSerialize["datacenterId"] = o.DatacenterId } - - if o.Dhcp != nil { + toSerialize["id"] = o.Id + if !IsNil(o.Dhcp) { toSerialize["dhcp"] = o.Dhcp } - - if o.Routes != nil { + if !IsNil(o.Routes) { toSerialize["routes"] = o.Routes } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableKubernetesNodePoolLan struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_kubernetes_node_pool_lan_routes.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_kubernetes_node_pool_lan_routes.go similarity index 74% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_kubernetes_node_pool_lan_routes.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_kubernetes_node_pool_lan_routes.go index e1d6eab3f..2d533d958 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_kubernetes_node_pool_lan_routes.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_kubernetes_node_pool_lan_routes.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the KubernetesNodePoolLanRoutes type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &KubernetesNodePoolLanRoutes{} + // KubernetesNodePoolLanRoutes struct for KubernetesNodePoolLanRoutes type KubernetesNodePoolLanRoutes struct { // IPv4 or IPv6 CIDR to be routed via the interface. @@ -40,93 +43,87 @@ func NewKubernetesNodePoolLanRoutesWithDefaults() *KubernetesNodePoolLanRoutes { return &this } -// GetNetwork returns the Network field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNodePoolLanRoutes) GetNetwork() *string { - if o == nil { - return nil +// GetNetwork returns the Network field value if set, zero value otherwise. +func (o *KubernetesNodePoolLanRoutes) GetNetwork() string { + if o == nil || IsNil(o.Network) { + var ret string + return ret } - - return o.Network - + return *o.Network } -// GetNetworkOk returns a tuple with the Network field value +// GetNetworkOk returns a tuple with the Network 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 *KubernetesNodePoolLanRoutes) GetNetworkOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Network) { return nil, false } - return o.Network, true } -// SetNetwork sets field value -func (o *KubernetesNodePoolLanRoutes) SetNetwork(v string) { - - o.Network = &v - -} - // HasNetwork returns a boolean if a field has been set. func (o *KubernetesNodePoolLanRoutes) HasNetwork() bool { - if o != nil && o.Network != nil { + if o != nil && !IsNil(o.Network) { return true } return false } -// GetGatewayIp returns the GatewayIp field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNodePoolLanRoutes) GetGatewayIp() *string { - if o == nil { - return nil - } - - return o.GatewayIp +// SetNetwork gets a reference to the given string and assigns it to the Network field. +func (o *KubernetesNodePoolLanRoutes) SetNetwork(v string) { + o.Network = &v +} +// GetGatewayIp returns the GatewayIp field value if set, zero value otherwise. +func (o *KubernetesNodePoolLanRoutes) GetGatewayIp() string { + if o == nil || IsNil(o.GatewayIp) { + var ret string + return ret + } + return *o.GatewayIp } -// GetGatewayIpOk returns a tuple with the GatewayIp field value +// GetGatewayIpOk returns a tuple with the GatewayIp 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 *KubernetesNodePoolLanRoutes) GetGatewayIpOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.GatewayIp) { return nil, false } - return o.GatewayIp, true } -// SetGatewayIp sets field value -func (o *KubernetesNodePoolLanRoutes) SetGatewayIp(v string) { - - o.GatewayIp = &v - -} - // HasGatewayIp returns a boolean if a field has been set. func (o *KubernetesNodePoolLanRoutes) HasGatewayIp() bool { - if o != nil && o.GatewayIp != nil { + if o != nil && !IsNil(o.GatewayIp) { return true } return false } +// SetGatewayIp gets a reference to the given string and assigns it to the GatewayIp field. +func (o *KubernetesNodePoolLanRoutes) SetGatewayIp(v string) { + o.GatewayIp = &v +} + func (o KubernetesNodePoolLanRoutes) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o KubernetesNodePoolLanRoutes) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Network != nil { + if !IsNil(o.Network) { toSerialize["network"] = o.Network } - - if o.GatewayIp != nil { + if !IsNil(o.GatewayIp) { toSerialize["gatewayIp"] = o.GatewayIp } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableKubernetesNodePoolLanRoutes struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_kubernetes_node_pool_properties.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_kubernetes_node_pool_properties.go similarity index 59% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_kubernetes_node_pool_properties.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_kubernetes_node_pool_properties.go index 256501d4f..711a2ce1e 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_kubernetes_node_pool_properties.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_kubernetes_node_pool_properties.go @@ -14,40 +14,43 @@ import ( "encoding/json" ) +// checks if the KubernetesNodePoolProperties type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &KubernetesNodePoolProperties{} + // KubernetesNodePoolProperties struct for KubernetesNodePoolProperties type KubernetesNodePoolProperties struct { // A Kubernetes node pool name. Valid Kubernetes node pool name must be 63 characters or less and must be empty or begin and end with an alphanumeric character ([a-z0-9A-Z]) with dashes (-), underscores (_), dots (.), and alphanumerics between. - Name *string `json:"name"` + Name string `json:"name"` // The unique identifier of the VDC where the worker nodes of the node pool are provisioned.Note that the data center is located in the exact place where the parent cluster of the node pool is located. - DatacenterId *string `json:"datacenterId"` + DatacenterId string `json:"datacenterId"` // The number of worker nodes of the node pool. - NodeCount *int32 `json:"nodeCount"` + NodeCount int32 `json:"nodeCount"` // The CPU type for the nodes. - CpuFamily *string `json:"cpuFamily"` + CpuFamily string `json:"cpuFamily"` // The total number of cores for the nodes. - CoresCount *int32 `json:"coresCount"` + CoresCount int32 `json:"coresCount"` // The RAM size for the nodes. Must be specified in multiples of 1024 MB, with a minimum size of 2048 MB. - RamSize *int32 `json:"ramSize"` + RamSize int32 `json:"ramSize"` // The availability zone in which the target VM should be provisioned. - AvailabilityZone *string `json:"availabilityZone"` + AvailabilityZone string `json:"availabilityZone"` // The storage type for the nodes. - StorageType *string `json:"storageType"` + StorageType string `json:"storageType"` // The allocated volume size in GB. The allocated volume size in GB. To achieve good performance, we recommend a size greater than 100GB for SSD. - StorageSize *int32 `json:"storageSize"` + StorageSize int32 `json:"storageSize"` // The Kubernetes version running in the node pool. Note that this imposes restrictions on which Kubernetes versions can run in the node pools of a cluster. Also, not all Kubernetes versions are suitable upgrade targets for all earlier versions. K8sVersion *string `json:"k8sVersion,omitempty"` MaintenanceWindow *KubernetesMaintenanceWindow `json:"maintenanceWindow,omitempty"` AutoScaling *KubernetesAutoScaling `json:"autoScaling,omitempty"` // The array of existing private LANs to attach to worker nodes. - Lans *[]KubernetesNodePoolLan `json:"lans,omitempty"` + Lans []KubernetesNodePoolLan `json:"lans,omitempty"` // The labels attached to the node pool. Labels *map[string]string `json:"labels,omitempty"` // The annotations attached to the node pool. Annotations *map[string]string `json:"annotations,omitempty"` // Optional array of reserved public IP addresses to be used by the nodes. The IPs must be from the exact location of the node pool's data center. If autoscaling is used, the array must contain one more IP than the maximum possible number of nodes (nodeCount+1 for a fixed number of nodes or maxNodeCount+1). The extra IP is used when the nodes are rebuilt. - PublicIps *[]string `json:"publicIps,omitempty"` + PublicIps []string `json:"publicIps,omitempty"` // The list of available versions for upgrading the node pool. - AvailableUpgradeVersions *[]string `json:"availableUpgradeVersions,omitempty"` + AvailableUpgradeVersions []string `json:"availableUpgradeVersions,omitempty"` } // NewKubernetesNodePoolProperties instantiates a new KubernetesNodePoolProperties object @@ -57,15 +60,15 @@ type KubernetesNodePoolProperties struct { func NewKubernetesNodePoolProperties(name string, datacenterId string, nodeCount int32, cpuFamily string, coresCount int32, ramSize int32, availabilityZone string, storageType string, storageSize int32) *KubernetesNodePoolProperties { this := KubernetesNodePoolProperties{} - this.Name = &name - this.DatacenterId = &datacenterId - this.NodeCount = &nodeCount - this.CpuFamily = &cpuFamily - this.CoresCount = &coresCount - this.RamSize = &ramSize - this.AvailabilityZone = &availabilityZone - this.StorageType = &storageType - this.StorageSize = &storageSize + this.Name = name + this.DatacenterId = datacenterId + this.NodeCount = nodeCount + this.CpuFamily = cpuFamily + this.CoresCount = coresCount + this.RamSize = ramSize + this.AvailabilityZone = availabilityZone + this.StorageType = storageType + this.StorageSize = storageSize return &this } @@ -79,722 +82,521 @@ func NewKubernetesNodePoolPropertiesWithDefaults() *KubernetesNodePoolProperties } // GetName returns the Name field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNodePoolProperties) GetName() *string { +func (o *KubernetesNodePoolProperties) GetName() string { if o == nil { - return 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. -// NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *KubernetesNodePoolProperties) GetNameOk() (*string, bool) { if o == nil { return nil, false } - - return o.Name, true + return &o.Name, true } // SetName sets field value func (o *KubernetesNodePoolProperties) SetName(v string) { - - o.Name = &v - -} - -// HasName returns a boolean if a field has been set. -func (o *KubernetesNodePoolProperties) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false + o.Name = v } // GetDatacenterId returns the DatacenterId field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNodePoolProperties) GetDatacenterId() *string { +func (o *KubernetesNodePoolProperties) GetDatacenterId() string { if o == nil { - return nil + var ret string + return ret } return o.DatacenterId - } // GetDatacenterIdOk returns a tuple with the DatacenterId field value // 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 *KubernetesNodePoolProperties) GetDatacenterIdOk() (*string, bool) { if o == nil { return nil, false } - - return o.DatacenterId, true + return &o.DatacenterId, true } // SetDatacenterId sets field value func (o *KubernetesNodePoolProperties) SetDatacenterId(v string) { - - o.DatacenterId = &v - -} - -// HasDatacenterId returns a boolean if a field has been set. -func (o *KubernetesNodePoolProperties) HasDatacenterId() bool { - if o != nil && o.DatacenterId != nil { - return true - } - - return false + o.DatacenterId = v } // GetNodeCount returns the NodeCount field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNodePoolProperties) GetNodeCount() *int32 { +func (o *KubernetesNodePoolProperties) GetNodeCount() int32 { if o == nil { - return nil + var ret int32 + return ret } return o.NodeCount - } // GetNodeCountOk returns a tuple with the NodeCount field value // 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 *KubernetesNodePoolProperties) GetNodeCountOk() (*int32, bool) { if o == nil { return nil, false } - - return o.NodeCount, true + return &o.NodeCount, true } // SetNodeCount sets field value func (o *KubernetesNodePoolProperties) SetNodeCount(v int32) { - - o.NodeCount = &v - -} - -// HasNodeCount returns a boolean if a field has been set. -func (o *KubernetesNodePoolProperties) HasNodeCount() bool { - if o != nil && o.NodeCount != nil { - return true - } - - return false + o.NodeCount = v } // GetCpuFamily returns the CpuFamily field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNodePoolProperties) GetCpuFamily() *string { +func (o *KubernetesNodePoolProperties) GetCpuFamily() string { if o == nil { - return nil + var ret string + return ret } return o.CpuFamily - } // GetCpuFamilyOk returns a tuple with the CpuFamily field value // 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 *KubernetesNodePoolProperties) GetCpuFamilyOk() (*string, bool) { if o == nil { return nil, false } - - return o.CpuFamily, true + return &o.CpuFamily, true } // SetCpuFamily sets field value func (o *KubernetesNodePoolProperties) SetCpuFamily(v string) { - - o.CpuFamily = &v - -} - -// HasCpuFamily returns a boolean if a field has been set. -func (o *KubernetesNodePoolProperties) HasCpuFamily() bool { - if o != nil && o.CpuFamily != nil { - return true - } - - return false + o.CpuFamily = v } // GetCoresCount returns the CoresCount field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNodePoolProperties) GetCoresCount() *int32 { +func (o *KubernetesNodePoolProperties) GetCoresCount() int32 { if o == nil { - return nil + var ret int32 + return ret } return o.CoresCount - } // GetCoresCountOk returns a tuple with the CoresCount field value // 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 *KubernetesNodePoolProperties) GetCoresCountOk() (*int32, bool) { if o == nil { return nil, false } - - return o.CoresCount, true + return &o.CoresCount, true } // SetCoresCount sets field value func (o *KubernetesNodePoolProperties) SetCoresCount(v int32) { - - o.CoresCount = &v - -} - -// HasCoresCount returns a boolean if a field has been set. -func (o *KubernetesNodePoolProperties) HasCoresCount() bool { - if o != nil && o.CoresCount != nil { - return true - } - - return false + o.CoresCount = v } // GetRamSize returns the RamSize field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNodePoolProperties) GetRamSize() *int32 { +func (o *KubernetesNodePoolProperties) GetRamSize() int32 { if o == nil { - return nil + var ret int32 + return ret } return o.RamSize - } // GetRamSizeOk returns a tuple with the RamSize field value // 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 *KubernetesNodePoolProperties) GetRamSizeOk() (*int32, bool) { if o == nil { return nil, false } - - return o.RamSize, true + return &o.RamSize, true } // SetRamSize sets field value func (o *KubernetesNodePoolProperties) SetRamSize(v int32) { - - o.RamSize = &v - -} - -// HasRamSize returns a boolean if a field has been set. -func (o *KubernetesNodePoolProperties) HasRamSize() bool { - if o != nil && o.RamSize != nil { - return true - } - - return false + o.RamSize = v } // GetAvailabilityZone returns the AvailabilityZone field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNodePoolProperties) GetAvailabilityZone() *string { +func (o *KubernetesNodePoolProperties) GetAvailabilityZone() string { if o == nil { - return nil + var ret string + return ret } return o.AvailabilityZone - } // GetAvailabilityZoneOk returns a tuple with the AvailabilityZone field value // 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 *KubernetesNodePoolProperties) GetAvailabilityZoneOk() (*string, bool) { if o == nil { return nil, false } - - return o.AvailabilityZone, true + return &o.AvailabilityZone, true } // SetAvailabilityZone sets field value func (o *KubernetesNodePoolProperties) SetAvailabilityZone(v string) { - - o.AvailabilityZone = &v - -} - -// HasAvailabilityZone returns a boolean if a field has been set. -func (o *KubernetesNodePoolProperties) HasAvailabilityZone() bool { - if o != nil && o.AvailabilityZone != nil { - return true - } - - return false + o.AvailabilityZone = v } // GetStorageType returns the StorageType field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNodePoolProperties) GetStorageType() *string { +func (o *KubernetesNodePoolProperties) GetStorageType() string { if o == nil { - return nil + var ret string + return ret } return o.StorageType - } // GetStorageTypeOk returns a tuple with the StorageType field value // 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 *KubernetesNodePoolProperties) GetStorageTypeOk() (*string, bool) { if o == nil { return nil, false } - - return o.StorageType, true + return &o.StorageType, true } // SetStorageType sets field value func (o *KubernetesNodePoolProperties) SetStorageType(v string) { - - o.StorageType = &v - -} - -// HasStorageType returns a boolean if a field has been set. -func (o *KubernetesNodePoolProperties) HasStorageType() bool { - if o != nil && o.StorageType != nil { - return true - } - - return false + o.StorageType = v } // GetStorageSize returns the StorageSize field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNodePoolProperties) GetStorageSize() *int32 { +func (o *KubernetesNodePoolProperties) GetStorageSize() int32 { if o == nil { - return nil + var ret int32 + return ret } return o.StorageSize - } // GetStorageSizeOk returns a tuple with the StorageSize field value // 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 *KubernetesNodePoolProperties) GetStorageSizeOk() (*int32, bool) { if o == nil { return nil, false } - - return o.StorageSize, true + return &o.StorageSize, true } // SetStorageSize sets field value func (o *KubernetesNodePoolProperties) SetStorageSize(v int32) { - - o.StorageSize = &v - -} - -// HasStorageSize returns a boolean if a field has been set. -func (o *KubernetesNodePoolProperties) HasStorageSize() bool { - if o != nil && o.StorageSize != nil { - return true - } - - return false + o.StorageSize = v } -// GetK8sVersion returns the K8sVersion field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNodePoolProperties) GetK8sVersion() *string { - if o == nil { - return nil +// GetK8sVersion returns the K8sVersion field value if set, zero value otherwise. +func (o *KubernetesNodePoolProperties) GetK8sVersion() string { + if o == nil || IsNil(o.K8sVersion) { + var ret string + return ret } - - return o.K8sVersion - + return *o.K8sVersion } -// GetK8sVersionOk returns a tuple with the K8sVersion field value +// GetK8sVersionOk returns a tuple with the K8sVersion 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 *KubernetesNodePoolProperties) GetK8sVersionOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.K8sVersion) { return nil, false } - return o.K8sVersion, true } -// SetK8sVersion sets field value -func (o *KubernetesNodePoolProperties) SetK8sVersion(v string) { - - o.K8sVersion = &v - -} - // HasK8sVersion returns a boolean if a field has been set. func (o *KubernetesNodePoolProperties) HasK8sVersion() bool { - if o != nil && o.K8sVersion != nil { + if o != nil && !IsNil(o.K8sVersion) { return true } return false } -// GetMaintenanceWindow returns the MaintenanceWindow field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNodePoolProperties) GetMaintenanceWindow() *KubernetesMaintenanceWindow { - if o == nil { - return nil - } - - return o.MaintenanceWindow +// SetK8sVersion gets a reference to the given string and assigns it to the K8sVersion field. +func (o *KubernetesNodePoolProperties) SetK8sVersion(v string) { + o.K8sVersion = &v +} +// GetMaintenanceWindow returns the MaintenanceWindow field value if set, zero value otherwise. +func (o *KubernetesNodePoolProperties) GetMaintenanceWindow() KubernetesMaintenanceWindow { + if o == nil || IsNil(o.MaintenanceWindow) { + var ret KubernetesMaintenanceWindow + return ret + } + return *o.MaintenanceWindow } -// GetMaintenanceWindowOk returns a tuple with the MaintenanceWindow field value +// GetMaintenanceWindowOk returns a tuple with the MaintenanceWindow 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 *KubernetesNodePoolProperties) GetMaintenanceWindowOk() (*KubernetesMaintenanceWindow, bool) { - if o == nil { + if o == nil || IsNil(o.MaintenanceWindow) { return nil, false } - return o.MaintenanceWindow, true } -// SetMaintenanceWindow sets field value -func (o *KubernetesNodePoolProperties) SetMaintenanceWindow(v KubernetesMaintenanceWindow) { - - o.MaintenanceWindow = &v - -} - // HasMaintenanceWindow returns a boolean if a field has been set. func (o *KubernetesNodePoolProperties) HasMaintenanceWindow() bool { - if o != nil && o.MaintenanceWindow != nil { + if o != nil && !IsNil(o.MaintenanceWindow) { return true } return false } -// GetAutoScaling returns the AutoScaling field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNodePoolProperties) GetAutoScaling() *KubernetesAutoScaling { - if o == nil { - return nil - } - - return o.AutoScaling +// SetMaintenanceWindow gets a reference to the given KubernetesMaintenanceWindow and assigns it to the MaintenanceWindow field. +func (o *KubernetesNodePoolProperties) SetMaintenanceWindow(v KubernetesMaintenanceWindow) { + o.MaintenanceWindow = &v +} +// GetAutoScaling returns the AutoScaling field value if set, zero value otherwise. +func (o *KubernetesNodePoolProperties) GetAutoScaling() KubernetesAutoScaling { + if o == nil || IsNil(o.AutoScaling) { + var ret KubernetesAutoScaling + return ret + } + return *o.AutoScaling } -// GetAutoScalingOk returns a tuple with the AutoScaling field value +// GetAutoScalingOk returns a tuple with the AutoScaling 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 *KubernetesNodePoolProperties) GetAutoScalingOk() (*KubernetesAutoScaling, bool) { - if o == nil { + if o == nil || IsNil(o.AutoScaling) { return nil, false } - return o.AutoScaling, true } -// SetAutoScaling sets field value -func (o *KubernetesNodePoolProperties) SetAutoScaling(v KubernetesAutoScaling) { - - o.AutoScaling = &v - -} - // HasAutoScaling returns a boolean if a field has been set. func (o *KubernetesNodePoolProperties) HasAutoScaling() bool { - if o != nil && o.AutoScaling != nil { + if o != nil && !IsNil(o.AutoScaling) { return true } return false } -// GetLans returns the Lans field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNodePoolProperties) GetLans() *[]KubernetesNodePoolLan { - if o == nil { - return nil - } +// SetAutoScaling gets a reference to the given KubernetesAutoScaling and assigns it to the AutoScaling field. +func (o *KubernetesNodePoolProperties) SetAutoScaling(v KubernetesAutoScaling) { + o.AutoScaling = &v +} +// GetLans returns the Lans field value if set, zero value otherwise. +func (o *KubernetesNodePoolProperties) GetLans() []KubernetesNodePoolLan { + if o == nil || IsNil(o.Lans) { + var ret []KubernetesNodePoolLan + return ret + } return o.Lans - } -// GetLansOk returns a tuple with the Lans field value +// GetLansOk returns a tuple with the Lans 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 *KubernetesNodePoolProperties) GetLansOk() (*[]KubernetesNodePoolLan, bool) { - if o == nil { +func (o *KubernetesNodePoolProperties) GetLansOk() ([]KubernetesNodePoolLan, bool) { + if o == nil || IsNil(o.Lans) { return nil, false } - return o.Lans, true } -// SetLans sets field value -func (o *KubernetesNodePoolProperties) SetLans(v []KubernetesNodePoolLan) { - - o.Lans = &v - -} - // HasLans returns a boolean if a field has been set. func (o *KubernetesNodePoolProperties) HasLans() bool { - if o != nil && o.Lans != nil { + if o != nil && !IsNil(o.Lans) { return true } return false } -// GetLabels returns the Labels field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNodePoolProperties) GetLabels() *map[string]string { - if o == nil { - return nil - } - - return o.Labels +// SetLans gets a reference to the given []KubernetesNodePoolLan and assigns it to the Lans field. +func (o *KubernetesNodePoolProperties) SetLans(v []KubernetesNodePoolLan) { + o.Lans = v +} +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *KubernetesNodePoolProperties) GetLabels() map[string]string { + if o == nil || IsNil(o.Labels) { + var ret map[string]string + return ret + } + return *o.Labels } -// GetLabelsOk returns a tuple with the Labels field value +// GetLabelsOk returns a tuple with the Labels 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 *KubernetesNodePoolProperties) GetLabelsOk() (*map[string]string, bool) { - if o == nil { + if o == nil || IsNil(o.Labels) { return nil, false } - return o.Labels, true } -// SetLabels sets field value -func (o *KubernetesNodePoolProperties) SetLabels(v map[string]string) { - - o.Labels = &v - -} - // HasLabels returns a boolean if a field has been set. func (o *KubernetesNodePoolProperties) HasLabels() bool { - if o != nil && o.Labels != nil { + if o != nil && !IsNil(o.Labels) { return true } return false } -// GetAnnotations returns the Annotations field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNodePoolProperties) GetAnnotations() *map[string]string { - if o == nil { - return nil - } - - return o.Annotations +// SetLabels gets a reference to the given map[string]string and assigns it to the Labels field. +func (o *KubernetesNodePoolProperties) SetLabels(v map[string]string) { + o.Labels = &v +} +// GetAnnotations returns the Annotations field value if set, zero value otherwise. +func (o *KubernetesNodePoolProperties) GetAnnotations() map[string]string { + if o == nil || IsNil(o.Annotations) { + var ret map[string]string + return ret + } + return *o.Annotations } -// GetAnnotationsOk returns a tuple with the Annotations field value +// GetAnnotationsOk returns a tuple with the Annotations 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 *KubernetesNodePoolProperties) GetAnnotationsOk() (*map[string]string, bool) { - if o == nil { + if o == nil || IsNil(o.Annotations) { return nil, false } - return o.Annotations, true } -// SetAnnotations sets field value -func (o *KubernetesNodePoolProperties) SetAnnotations(v map[string]string) { - - o.Annotations = &v - -} - // HasAnnotations returns a boolean if a field has been set. func (o *KubernetesNodePoolProperties) HasAnnotations() bool { - if o != nil && o.Annotations != nil { + if o != nil && !IsNil(o.Annotations) { return true } return false } -// GetPublicIps returns the PublicIps field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNodePoolProperties) GetPublicIps() *[]string { - if o == nil { - return nil - } +// SetAnnotations gets a reference to the given map[string]string and assigns it to the Annotations field. +func (o *KubernetesNodePoolProperties) SetAnnotations(v map[string]string) { + o.Annotations = &v +} +// GetPublicIps returns the PublicIps field value if set, zero value otherwise. +func (o *KubernetesNodePoolProperties) GetPublicIps() []string { + if o == nil || IsNil(o.PublicIps) { + var ret []string + return ret + } return o.PublicIps - } -// GetPublicIpsOk returns a tuple with the PublicIps field value +// GetPublicIpsOk returns a tuple with the PublicIps 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 *KubernetesNodePoolProperties) GetPublicIpsOk() (*[]string, bool) { - if o == nil { +func (o *KubernetesNodePoolProperties) GetPublicIpsOk() ([]string, bool) { + if o == nil || IsNil(o.PublicIps) { return nil, false } - return o.PublicIps, true } -// SetPublicIps sets field value -func (o *KubernetesNodePoolProperties) SetPublicIps(v []string) { - - o.PublicIps = &v - -} - // HasPublicIps returns a boolean if a field has been set. func (o *KubernetesNodePoolProperties) HasPublicIps() bool { - if o != nil && o.PublicIps != nil { + if o != nil && !IsNil(o.PublicIps) { return true } return false } -// GetAvailableUpgradeVersions returns the AvailableUpgradeVersions field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNodePoolProperties) GetAvailableUpgradeVersions() *[]string { - if o == nil { - return nil - } +// SetPublicIps gets a reference to the given []string and assigns it to the PublicIps field. +func (o *KubernetesNodePoolProperties) SetPublicIps(v []string) { + o.PublicIps = v +} +// GetAvailableUpgradeVersions returns the AvailableUpgradeVersions field value if set, zero value otherwise. +func (o *KubernetesNodePoolProperties) GetAvailableUpgradeVersions() []string { + if o == nil || IsNil(o.AvailableUpgradeVersions) { + var ret []string + return ret + } return o.AvailableUpgradeVersions - } -// GetAvailableUpgradeVersionsOk returns a tuple with the AvailableUpgradeVersions field value +// GetAvailableUpgradeVersionsOk returns a tuple with the AvailableUpgradeVersions 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 *KubernetesNodePoolProperties) GetAvailableUpgradeVersionsOk() (*[]string, bool) { - if o == nil { +func (o *KubernetesNodePoolProperties) GetAvailableUpgradeVersionsOk() ([]string, bool) { + if o == nil || IsNil(o.AvailableUpgradeVersions) { return nil, false } - return o.AvailableUpgradeVersions, true } -// SetAvailableUpgradeVersions sets field value -func (o *KubernetesNodePoolProperties) SetAvailableUpgradeVersions(v []string) { - - o.AvailableUpgradeVersions = &v - -} - // HasAvailableUpgradeVersions returns a boolean if a field has been set. func (o *KubernetesNodePoolProperties) HasAvailableUpgradeVersions() bool { - if o != nil && o.AvailableUpgradeVersions != nil { + if o != nil && !IsNil(o.AvailableUpgradeVersions) { return true } return false } -func (o KubernetesNodePoolProperties) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.Name != nil { - toSerialize["name"] = o.Name - } - - if o.DatacenterId != nil { - toSerialize["datacenterId"] = o.DatacenterId - } - - if o.NodeCount != nil { - toSerialize["nodeCount"] = o.NodeCount - } - - if o.CpuFamily != nil { - toSerialize["cpuFamily"] = o.CpuFamily - } - - if o.CoresCount != nil { - toSerialize["coresCount"] = o.CoresCount - } - - if o.RamSize != nil { - toSerialize["ramSize"] = o.RamSize - } - - if o.AvailabilityZone != nil { - toSerialize["availabilityZone"] = o.AvailabilityZone - } - - if o.StorageType != nil { - toSerialize["storageType"] = o.StorageType - } +// SetAvailableUpgradeVersions gets a reference to the given []string and assigns it to the AvailableUpgradeVersions field. +func (o *KubernetesNodePoolProperties) SetAvailableUpgradeVersions(v []string) { + o.AvailableUpgradeVersions = v +} - if o.StorageSize != nil { - toSerialize["storageSize"] = o.StorageSize +func (o KubernetesNodePoolProperties) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } + return json.Marshal(toSerialize) +} - if o.K8sVersion != nil { +func (o KubernetesNodePoolProperties) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["name"] = o.Name + toSerialize["datacenterId"] = o.DatacenterId + toSerialize["nodeCount"] = o.NodeCount + toSerialize["cpuFamily"] = o.CpuFamily + toSerialize["coresCount"] = o.CoresCount + toSerialize["ramSize"] = o.RamSize + toSerialize["availabilityZone"] = o.AvailabilityZone + toSerialize["storageType"] = o.StorageType + toSerialize["storageSize"] = o.StorageSize + if !IsNil(o.K8sVersion) { toSerialize["k8sVersion"] = o.K8sVersion } - - if o.MaintenanceWindow != nil { + if !IsNil(o.MaintenanceWindow) { toSerialize["maintenanceWindow"] = o.MaintenanceWindow } - - if o.AutoScaling != nil { + if !IsNil(o.AutoScaling) { toSerialize["autoScaling"] = o.AutoScaling } - - if o.Lans != nil { + if !IsNil(o.Lans) { toSerialize["lans"] = o.Lans } - - if o.Labels != nil { + if !IsNil(o.Labels) { toSerialize["labels"] = o.Labels } - - if o.Annotations != nil { + if !IsNil(o.Annotations) { toSerialize["annotations"] = o.Annotations } - - if o.PublicIps != nil { + if !IsNil(o.PublicIps) { toSerialize["publicIps"] = o.PublicIps } - - if o.AvailableUpgradeVersions != nil { + if !IsNil(o.AvailableUpgradeVersions) { toSerialize["availableUpgradeVersions"] = o.AvailableUpgradeVersions } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableKubernetesNodePoolProperties struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_kubernetes_node_pool_properties_for_post.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_kubernetes_node_pool_properties_for_post.go similarity index 61% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_kubernetes_node_pool_properties_for_post.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_kubernetes_node_pool_properties_for_post.go index c49512613..701e98334 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_kubernetes_node_pool_properties_for_post.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_kubernetes_node_pool_properties_for_post.go @@ -14,38 +14,41 @@ import ( "encoding/json" ) +// checks if the KubernetesNodePoolPropertiesForPost type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &KubernetesNodePoolPropertiesForPost{} + // KubernetesNodePoolPropertiesForPost struct for KubernetesNodePoolPropertiesForPost type KubernetesNodePoolPropertiesForPost struct { // A Kubernetes node pool name. Valid Kubernetes node pool name must be 63 characters or less and must be empty or begin and end with an alphanumeric character ([a-z0-9A-Z]) with dashes (-), underscores (_), dots (.), and alphanumerics between. - Name *string `json:"name"` + Name string `json:"name"` // The unique identifier of the VDC where the worker nodes of the node pool are provisioned.Note that the data center is located in the exact place where the parent cluster of the node pool is located. - DatacenterId *string `json:"datacenterId"` + DatacenterId string `json:"datacenterId"` // The number of worker nodes of the node pool. - NodeCount *int32 `json:"nodeCount"` + NodeCount int32 `json:"nodeCount"` // The CPU type for the nodes. - CpuFamily *string `json:"cpuFamily"` + CpuFamily string `json:"cpuFamily"` // The total number of cores for the nodes. - CoresCount *int32 `json:"coresCount"` + CoresCount int32 `json:"coresCount"` // The RAM size for the nodes. Must be specified in multiples of 1024 MB, with a minimum size of 2048 MB. - RamSize *int32 `json:"ramSize"` + RamSize int32 `json:"ramSize"` // The availability zone in which the target VM should be provisioned. - AvailabilityZone *string `json:"availabilityZone"` + AvailabilityZone string `json:"availabilityZone"` // The storage type for the nodes. - StorageType *string `json:"storageType"` + StorageType string `json:"storageType"` // The allocated volume size in GB. The allocated volume size in GB. To achieve good performance, we recommend a size greater than 100GB for SSD. - StorageSize *int32 `json:"storageSize"` + StorageSize int32 `json:"storageSize"` // The Kubernetes version running in the node pool. Note that this imposes restrictions on which Kubernetes versions can run in the node pools of a cluster. Also, not all Kubernetes versions are suitable upgrade targets for all earlier versions. K8sVersion *string `json:"k8sVersion,omitempty"` MaintenanceWindow *KubernetesMaintenanceWindow `json:"maintenanceWindow,omitempty"` AutoScaling *KubernetesAutoScaling `json:"autoScaling,omitempty"` // The array of existing private LANs to attach to worker nodes. - Lans *[]KubernetesNodePoolLan `json:"lans,omitempty"` + Lans []KubernetesNodePoolLan `json:"lans,omitempty"` // The labels attached to the node pool. Labels *map[string]string `json:"labels,omitempty"` // The annotations attached to the node pool. Annotations *map[string]string `json:"annotations,omitempty"` // Optional array of reserved public IP addresses to be used by the nodes. The IPs must be from the exact location of the node pool's data center. If autoscaling is used, the array must contain one more IP than the maximum possible number of nodes (nodeCount+1 for a fixed number of nodes or maxNodeCount+1). The extra IP is used when the nodes are rebuilt. - PublicIps *[]string `json:"publicIps,omitempty"` + PublicIps []string `json:"publicIps,omitempty"` } // NewKubernetesNodePoolPropertiesForPost instantiates a new KubernetesNodePoolPropertiesForPost object @@ -55,15 +58,15 @@ type KubernetesNodePoolPropertiesForPost struct { func NewKubernetesNodePoolPropertiesForPost(name string, datacenterId string, nodeCount int32, cpuFamily string, coresCount int32, ramSize int32, availabilityZone string, storageType string, storageSize int32) *KubernetesNodePoolPropertiesForPost { this := KubernetesNodePoolPropertiesForPost{} - this.Name = &name - this.DatacenterId = &datacenterId - this.NodeCount = &nodeCount - this.CpuFamily = &cpuFamily - this.CoresCount = &coresCount - this.RamSize = &ramSize - this.AvailabilityZone = &availabilityZone - this.StorageType = &storageType - this.StorageSize = &storageSize + this.Name = name + this.DatacenterId = datacenterId + this.NodeCount = nodeCount + this.CpuFamily = cpuFamily + this.CoresCount = coresCount + this.RamSize = ramSize + this.AvailabilityZone = availabilityZone + this.StorageType = storageType + this.StorageSize = storageSize return &this } @@ -77,680 +80,486 @@ func NewKubernetesNodePoolPropertiesForPostWithDefaults() *KubernetesNodePoolPro } // GetName returns the Name field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNodePoolPropertiesForPost) GetName() *string { +func (o *KubernetesNodePoolPropertiesForPost) GetName() string { if o == nil { - return 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. -// NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *KubernetesNodePoolPropertiesForPost) GetNameOk() (*string, bool) { if o == nil { return nil, false } - - return o.Name, true + return &o.Name, true } // SetName sets field value func (o *KubernetesNodePoolPropertiesForPost) SetName(v string) { - - o.Name = &v - -} - -// HasName returns a boolean if a field has been set. -func (o *KubernetesNodePoolPropertiesForPost) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false + o.Name = v } // GetDatacenterId returns the DatacenterId field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNodePoolPropertiesForPost) GetDatacenterId() *string { +func (o *KubernetesNodePoolPropertiesForPost) GetDatacenterId() string { if o == nil { - return nil + var ret string + return ret } return o.DatacenterId - } // GetDatacenterIdOk returns a tuple with the DatacenterId field value // 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 *KubernetesNodePoolPropertiesForPost) GetDatacenterIdOk() (*string, bool) { if o == nil { return nil, false } - - return o.DatacenterId, true + return &o.DatacenterId, true } // SetDatacenterId sets field value func (o *KubernetesNodePoolPropertiesForPost) SetDatacenterId(v string) { - - o.DatacenterId = &v - -} - -// HasDatacenterId returns a boolean if a field has been set. -func (o *KubernetesNodePoolPropertiesForPost) HasDatacenterId() bool { - if o != nil && o.DatacenterId != nil { - return true - } - - return false + o.DatacenterId = v } // GetNodeCount returns the NodeCount field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNodePoolPropertiesForPost) GetNodeCount() *int32 { +func (o *KubernetesNodePoolPropertiesForPost) GetNodeCount() int32 { if o == nil { - return nil + var ret int32 + return ret } return o.NodeCount - } // GetNodeCountOk returns a tuple with the NodeCount field value // 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 *KubernetesNodePoolPropertiesForPost) GetNodeCountOk() (*int32, bool) { if o == nil { return nil, false } - - return o.NodeCount, true + return &o.NodeCount, true } // SetNodeCount sets field value func (o *KubernetesNodePoolPropertiesForPost) SetNodeCount(v int32) { - - o.NodeCount = &v - -} - -// HasNodeCount returns a boolean if a field has been set. -func (o *KubernetesNodePoolPropertiesForPost) HasNodeCount() bool { - if o != nil && o.NodeCount != nil { - return true - } - - return false + o.NodeCount = v } // GetCpuFamily returns the CpuFamily field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNodePoolPropertiesForPost) GetCpuFamily() *string { +func (o *KubernetesNodePoolPropertiesForPost) GetCpuFamily() string { if o == nil { - return nil + var ret string + return ret } return o.CpuFamily - } // GetCpuFamilyOk returns a tuple with the CpuFamily field value // 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 *KubernetesNodePoolPropertiesForPost) GetCpuFamilyOk() (*string, bool) { if o == nil { return nil, false } - - return o.CpuFamily, true + return &o.CpuFamily, true } // SetCpuFamily sets field value func (o *KubernetesNodePoolPropertiesForPost) SetCpuFamily(v string) { - - o.CpuFamily = &v - -} - -// HasCpuFamily returns a boolean if a field has been set. -func (o *KubernetesNodePoolPropertiesForPost) HasCpuFamily() bool { - if o != nil && o.CpuFamily != nil { - return true - } - - return false + o.CpuFamily = v } // GetCoresCount returns the CoresCount field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNodePoolPropertiesForPost) GetCoresCount() *int32 { +func (o *KubernetesNodePoolPropertiesForPost) GetCoresCount() int32 { if o == nil { - return nil + var ret int32 + return ret } return o.CoresCount - } // GetCoresCountOk returns a tuple with the CoresCount field value // 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 *KubernetesNodePoolPropertiesForPost) GetCoresCountOk() (*int32, bool) { if o == nil { return nil, false } - - return o.CoresCount, true + return &o.CoresCount, true } // SetCoresCount sets field value func (o *KubernetesNodePoolPropertiesForPost) SetCoresCount(v int32) { - - o.CoresCount = &v - -} - -// HasCoresCount returns a boolean if a field has been set. -func (o *KubernetesNodePoolPropertiesForPost) HasCoresCount() bool { - if o != nil && o.CoresCount != nil { - return true - } - - return false + o.CoresCount = v } // GetRamSize returns the RamSize field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNodePoolPropertiesForPost) GetRamSize() *int32 { +func (o *KubernetesNodePoolPropertiesForPost) GetRamSize() int32 { if o == nil { - return nil + var ret int32 + return ret } return o.RamSize - } // GetRamSizeOk returns a tuple with the RamSize field value // 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 *KubernetesNodePoolPropertiesForPost) GetRamSizeOk() (*int32, bool) { if o == nil { return nil, false } - - return o.RamSize, true + return &o.RamSize, true } // SetRamSize sets field value func (o *KubernetesNodePoolPropertiesForPost) SetRamSize(v int32) { - - o.RamSize = &v - -} - -// HasRamSize returns a boolean if a field has been set. -func (o *KubernetesNodePoolPropertiesForPost) HasRamSize() bool { - if o != nil && o.RamSize != nil { - return true - } - - return false + o.RamSize = v } // GetAvailabilityZone returns the AvailabilityZone field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNodePoolPropertiesForPost) GetAvailabilityZone() *string { +func (o *KubernetesNodePoolPropertiesForPost) GetAvailabilityZone() string { if o == nil { - return nil + var ret string + return ret } return o.AvailabilityZone - } // GetAvailabilityZoneOk returns a tuple with the AvailabilityZone field value // 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 *KubernetesNodePoolPropertiesForPost) GetAvailabilityZoneOk() (*string, bool) { if o == nil { return nil, false } - - return o.AvailabilityZone, true + return &o.AvailabilityZone, true } // SetAvailabilityZone sets field value func (o *KubernetesNodePoolPropertiesForPost) SetAvailabilityZone(v string) { - - o.AvailabilityZone = &v - -} - -// HasAvailabilityZone returns a boolean if a field has been set. -func (o *KubernetesNodePoolPropertiesForPost) HasAvailabilityZone() bool { - if o != nil && o.AvailabilityZone != nil { - return true - } - - return false + o.AvailabilityZone = v } // GetStorageType returns the StorageType field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNodePoolPropertiesForPost) GetStorageType() *string { +func (o *KubernetesNodePoolPropertiesForPost) GetStorageType() string { if o == nil { - return nil + var ret string + return ret } return o.StorageType - } // GetStorageTypeOk returns a tuple with the StorageType field value // 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 *KubernetesNodePoolPropertiesForPost) GetStorageTypeOk() (*string, bool) { if o == nil { return nil, false } - - return o.StorageType, true + return &o.StorageType, true } // SetStorageType sets field value func (o *KubernetesNodePoolPropertiesForPost) SetStorageType(v string) { - - o.StorageType = &v - -} - -// HasStorageType returns a boolean if a field has been set. -func (o *KubernetesNodePoolPropertiesForPost) HasStorageType() bool { - if o != nil && o.StorageType != nil { - return true - } - - return false + o.StorageType = v } // GetStorageSize returns the StorageSize field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNodePoolPropertiesForPost) GetStorageSize() *int32 { +func (o *KubernetesNodePoolPropertiesForPost) GetStorageSize() int32 { if o == nil { - return nil + var ret int32 + return ret } return o.StorageSize - } // GetStorageSizeOk returns a tuple with the StorageSize field value // 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 *KubernetesNodePoolPropertiesForPost) GetStorageSizeOk() (*int32, bool) { if o == nil { return nil, false } - - return o.StorageSize, true + return &o.StorageSize, true } // SetStorageSize sets field value func (o *KubernetesNodePoolPropertiesForPost) SetStorageSize(v int32) { - - o.StorageSize = &v - -} - -// HasStorageSize returns a boolean if a field has been set. -func (o *KubernetesNodePoolPropertiesForPost) HasStorageSize() bool { - if o != nil && o.StorageSize != nil { - return true - } - - return false + o.StorageSize = v } -// GetK8sVersion returns the K8sVersion field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNodePoolPropertiesForPost) GetK8sVersion() *string { - if o == nil { - return nil +// GetK8sVersion returns the K8sVersion field value if set, zero value otherwise. +func (o *KubernetesNodePoolPropertiesForPost) GetK8sVersion() string { + if o == nil || IsNil(o.K8sVersion) { + var ret string + return ret } - - return o.K8sVersion - + return *o.K8sVersion } -// GetK8sVersionOk returns a tuple with the K8sVersion field value +// GetK8sVersionOk returns a tuple with the K8sVersion 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 *KubernetesNodePoolPropertiesForPost) GetK8sVersionOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.K8sVersion) { return nil, false } - return o.K8sVersion, true } -// SetK8sVersion sets field value -func (o *KubernetesNodePoolPropertiesForPost) SetK8sVersion(v string) { - - o.K8sVersion = &v - -} - // HasK8sVersion returns a boolean if a field has been set. func (o *KubernetesNodePoolPropertiesForPost) HasK8sVersion() bool { - if o != nil && o.K8sVersion != nil { + if o != nil && !IsNil(o.K8sVersion) { return true } return false } -// GetMaintenanceWindow returns the MaintenanceWindow field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNodePoolPropertiesForPost) GetMaintenanceWindow() *KubernetesMaintenanceWindow { - if o == nil { - return nil - } - - return o.MaintenanceWindow +// SetK8sVersion gets a reference to the given string and assigns it to the K8sVersion field. +func (o *KubernetesNodePoolPropertiesForPost) SetK8sVersion(v string) { + o.K8sVersion = &v +} +// GetMaintenanceWindow returns the MaintenanceWindow field value if set, zero value otherwise. +func (o *KubernetesNodePoolPropertiesForPost) GetMaintenanceWindow() KubernetesMaintenanceWindow { + if o == nil || IsNil(o.MaintenanceWindow) { + var ret KubernetesMaintenanceWindow + return ret + } + return *o.MaintenanceWindow } -// GetMaintenanceWindowOk returns a tuple with the MaintenanceWindow field value +// GetMaintenanceWindowOk returns a tuple with the MaintenanceWindow 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 *KubernetesNodePoolPropertiesForPost) GetMaintenanceWindowOk() (*KubernetesMaintenanceWindow, bool) { - if o == nil { + if o == nil || IsNil(o.MaintenanceWindow) { return nil, false } - return o.MaintenanceWindow, true } -// SetMaintenanceWindow sets field value -func (o *KubernetesNodePoolPropertiesForPost) SetMaintenanceWindow(v KubernetesMaintenanceWindow) { - - o.MaintenanceWindow = &v - -} - // HasMaintenanceWindow returns a boolean if a field has been set. func (o *KubernetesNodePoolPropertiesForPost) HasMaintenanceWindow() bool { - if o != nil && o.MaintenanceWindow != nil { + if o != nil && !IsNil(o.MaintenanceWindow) { return true } return false } -// GetAutoScaling returns the AutoScaling field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNodePoolPropertiesForPost) GetAutoScaling() *KubernetesAutoScaling { - if o == nil { - return nil - } - - return o.AutoScaling +// SetMaintenanceWindow gets a reference to the given KubernetesMaintenanceWindow and assigns it to the MaintenanceWindow field. +func (o *KubernetesNodePoolPropertiesForPost) SetMaintenanceWindow(v KubernetesMaintenanceWindow) { + o.MaintenanceWindow = &v +} +// GetAutoScaling returns the AutoScaling field value if set, zero value otherwise. +func (o *KubernetesNodePoolPropertiesForPost) GetAutoScaling() KubernetesAutoScaling { + if o == nil || IsNil(o.AutoScaling) { + var ret KubernetesAutoScaling + return ret + } + return *o.AutoScaling } -// GetAutoScalingOk returns a tuple with the AutoScaling field value +// GetAutoScalingOk returns a tuple with the AutoScaling 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 *KubernetesNodePoolPropertiesForPost) GetAutoScalingOk() (*KubernetesAutoScaling, bool) { - if o == nil { + if o == nil || IsNil(o.AutoScaling) { return nil, false } - return o.AutoScaling, true } -// SetAutoScaling sets field value -func (o *KubernetesNodePoolPropertiesForPost) SetAutoScaling(v KubernetesAutoScaling) { - - o.AutoScaling = &v - -} - // HasAutoScaling returns a boolean if a field has been set. func (o *KubernetesNodePoolPropertiesForPost) HasAutoScaling() bool { - if o != nil && o.AutoScaling != nil { + if o != nil && !IsNil(o.AutoScaling) { return true } return false } -// GetLans returns the Lans field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNodePoolPropertiesForPost) GetLans() *[]KubernetesNodePoolLan { - if o == nil { - return nil - } +// SetAutoScaling gets a reference to the given KubernetesAutoScaling and assigns it to the AutoScaling field. +func (o *KubernetesNodePoolPropertiesForPost) SetAutoScaling(v KubernetesAutoScaling) { + o.AutoScaling = &v +} +// GetLans returns the Lans field value if set, zero value otherwise. +func (o *KubernetesNodePoolPropertiesForPost) GetLans() []KubernetesNodePoolLan { + if o == nil || IsNil(o.Lans) { + var ret []KubernetesNodePoolLan + return ret + } return o.Lans - } -// GetLansOk returns a tuple with the Lans field value +// GetLansOk returns a tuple with the Lans 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 *KubernetesNodePoolPropertiesForPost) GetLansOk() (*[]KubernetesNodePoolLan, bool) { - if o == nil { +func (o *KubernetesNodePoolPropertiesForPost) GetLansOk() ([]KubernetesNodePoolLan, bool) { + if o == nil || IsNil(o.Lans) { return nil, false } - return o.Lans, true } -// SetLans sets field value -func (o *KubernetesNodePoolPropertiesForPost) SetLans(v []KubernetesNodePoolLan) { - - o.Lans = &v - -} - // HasLans returns a boolean if a field has been set. func (o *KubernetesNodePoolPropertiesForPost) HasLans() bool { - if o != nil && o.Lans != nil { + if o != nil && !IsNil(o.Lans) { return true } return false } -// GetLabels returns the Labels field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNodePoolPropertiesForPost) GetLabels() *map[string]string { - if o == nil { - return nil - } - - return o.Labels +// SetLans gets a reference to the given []KubernetesNodePoolLan and assigns it to the Lans field. +func (o *KubernetesNodePoolPropertiesForPost) SetLans(v []KubernetesNodePoolLan) { + o.Lans = v +} +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *KubernetesNodePoolPropertiesForPost) GetLabels() map[string]string { + if o == nil || IsNil(o.Labels) { + var ret map[string]string + return ret + } + return *o.Labels } -// GetLabelsOk returns a tuple with the Labels field value +// GetLabelsOk returns a tuple with the Labels 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 *KubernetesNodePoolPropertiesForPost) GetLabelsOk() (*map[string]string, bool) { - if o == nil { + if o == nil || IsNil(o.Labels) { return nil, false } - return o.Labels, true } -// SetLabels sets field value -func (o *KubernetesNodePoolPropertiesForPost) SetLabels(v map[string]string) { - - o.Labels = &v - -} - // HasLabels returns a boolean if a field has been set. func (o *KubernetesNodePoolPropertiesForPost) HasLabels() bool { - if o != nil && o.Labels != nil { + if o != nil && !IsNil(o.Labels) { return true } return false } -// GetAnnotations returns the Annotations field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNodePoolPropertiesForPost) GetAnnotations() *map[string]string { - if o == nil { - return nil - } - - return o.Annotations +// SetLabels gets a reference to the given map[string]string and assigns it to the Labels field. +func (o *KubernetesNodePoolPropertiesForPost) SetLabels(v map[string]string) { + o.Labels = &v +} +// GetAnnotations returns the Annotations field value if set, zero value otherwise. +func (o *KubernetesNodePoolPropertiesForPost) GetAnnotations() map[string]string { + if o == nil || IsNil(o.Annotations) { + var ret map[string]string + return ret + } + return *o.Annotations } -// GetAnnotationsOk returns a tuple with the Annotations field value +// GetAnnotationsOk returns a tuple with the Annotations 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 *KubernetesNodePoolPropertiesForPost) GetAnnotationsOk() (*map[string]string, bool) { - if o == nil { + if o == nil || IsNil(o.Annotations) { return nil, false } - return o.Annotations, true } -// SetAnnotations sets field value -func (o *KubernetesNodePoolPropertiesForPost) SetAnnotations(v map[string]string) { - - o.Annotations = &v - -} - // HasAnnotations returns a boolean if a field has been set. func (o *KubernetesNodePoolPropertiesForPost) HasAnnotations() bool { - if o != nil && o.Annotations != nil { + if o != nil && !IsNil(o.Annotations) { return true } return false } -// GetPublicIps returns the PublicIps field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNodePoolPropertiesForPost) GetPublicIps() *[]string { - if o == nil { - return nil - } +// SetAnnotations gets a reference to the given map[string]string and assigns it to the Annotations field. +func (o *KubernetesNodePoolPropertiesForPost) SetAnnotations(v map[string]string) { + o.Annotations = &v +} +// GetPublicIps returns the PublicIps field value if set, zero value otherwise. +func (o *KubernetesNodePoolPropertiesForPost) GetPublicIps() []string { + if o == nil || IsNil(o.PublicIps) { + var ret []string + return ret + } return o.PublicIps - } -// GetPublicIpsOk returns a tuple with the PublicIps field value +// GetPublicIpsOk returns a tuple with the PublicIps 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 *KubernetesNodePoolPropertiesForPost) GetPublicIpsOk() (*[]string, bool) { - if o == nil { +func (o *KubernetesNodePoolPropertiesForPost) GetPublicIpsOk() ([]string, bool) { + if o == nil || IsNil(o.PublicIps) { return nil, false } - return o.PublicIps, true } -// SetPublicIps sets field value -func (o *KubernetesNodePoolPropertiesForPost) SetPublicIps(v []string) { - - o.PublicIps = &v - -} - // HasPublicIps returns a boolean if a field has been set. func (o *KubernetesNodePoolPropertiesForPost) HasPublicIps() bool { - if o != nil && o.PublicIps != nil { + if o != nil && !IsNil(o.PublicIps) { return true } return false } -func (o KubernetesNodePoolPropertiesForPost) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.Name != nil { - toSerialize["name"] = o.Name - } - - if o.DatacenterId != nil { - toSerialize["datacenterId"] = o.DatacenterId - } - - if o.NodeCount != nil { - toSerialize["nodeCount"] = o.NodeCount - } - - if o.CpuFamily != nil { - toSerialize["cpuFamily"] = o.CpuFamily - } - - if o.CoresCount != nil { - toSerialize["coresCount"] = o.CoresCount - } - - if o.RamSize != nil { - toSerialize["ramSize"] = o.RamSize - } - - if o.AvailabilityZone != nil { - toSerialize["availabilityZone"] = o.AvailabilityZone - } - - if o.StorageType != nil { - toSerialize["storageType"] = o.StorageType - } +// SetPublicIps gets a reference to the given []string and assigns it to the PublicIps field. +func (o *KubernetesNodePoolPropertiesForPost) SetPublicIps(v []string) { + o.PublicIps = v +} - if o.StorageSize != nil { - toSerialize["storageSize"] = o.StorageSize +func (o KubernetesNodePoolPropertiesForPost) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } + return json.Marshal(toSerialize) +} - if o.K8sVersion != nil { +func (o KubernetesNodePoolPropertiesForPost) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["name"] = o.Name + toSerialize["datacenterId"] = o.DatacenterId + toSerialize["nodeCount"] = o.NodeCount + toSerialize["cpuFamily"] = o.CpuFamily + toSerialize["coresCount"] = o.CoresCount + toSerialize["ramSize"] = o.RamSize + toSerialize["availabilityZone"] = o.AvailabilityZone + toSerialize["storageType"] = o.StorageType + toSerialize["storageSize"] = o.StorageSize + if !IsNil(o.K8sVersion) { toSerialize["k8sVersion"] = o.K8sVersion } - - if o.MaintenanceWindow != nil { + if !IsNil(o.MaintenanceWindow) { toSerialize["maintenanceWindow"] = o.MaintenanceWindow } - - if o.AutoScaling != nil { + if !IsNil(o.AutoScaling) { toSerialize["autoScaling"] = o.AutoScaling } - - if o.Lans != nil { + if !IsNil(o.Lans) { toSerialize["lans"] = o.Lans } - - if o.Labels != nil { + if !IsNil(o.Labels) { toSerialize["labels"] = o.Labels } - - if o.Annotations != nil { + if !IsNil(o.Annotations) { toSerialize["annotations"] = o.Annotations } - - if o.PublicIps != nil { + if !IsNil(o.PublicIps) { toSerialize["publicIps"] = o.PublicIps } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableKubernetesNodePoolPropertiesForPost struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_kubernetes_node_pool_properties_for_put.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_kubernetes_node_pool_properties_for_put.go similarity index 65% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_kubernetes_node_pool_properties_for_put.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_kubernetes_node_pool_properties_for_put.go index 1983fb36f..ffa4c86e4 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_kubernetes_node_pool_properties_for_put.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_kubernetes_node_pool_properties_for_put.go @@ -14,24 +14,27 @@ import ( "encoding/json" ) +// checks if the KubernetesNodePoolPropertiesForPut type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &KubernetesNodePoolPropertiesForPut{} + // KubernetesNodePoolPropertiesForPut struct for KubernetesNodePoolPropertiesForPut type KubernetesNodePoolPropertiesForPut struct { // A Kubernetes node pool name. Valid Kubernetes node pool name must be 63 characters or less and must be empty or begin and end with an alphanumeric character ([a-z0-9A-Z]) with dashes (-), underscores (_), dots (.), and alphanumerics between. Name *string `json:"name,omitempty"` // The number of worker nodes of the node pool. - NodeCount *int32 `json:"nodeCount"` + NodeCount int32 `json:"nodeCount"` // The Kubernetes version running in the node pool. Note that this imposes restrictions on which Kubernetes versions can run in the node pools of a cluster. Also, not all Kubernetes versions are suitable upgrade targets for all earlier versions. K8sVersion *string `json:"k8sVersion,omitempty"` MaintenanceWindow *KubernetesMaintenanceWindow `json:"maintenanceWindow,omitempty"` AutoScaling *KubernetesAutoScaling `json:"autoScaling,omitempty"` // The array of existing private LANs to attach to worker nodes. - Lans *[]KubernetesNodePoolLan `json:"lans,omitempty"` + Lans []KubernetesNodePoolLan `json:"lans,omitempty"` // The labels attached to the node pool. Labels *map[string]string `json:"labels,omitempty"` // The annotations attached to the node pool. Annotations *map[string]string `json:"annotations,omitempty"` // Optional array of reserved public IP addresses to be used by the nodes. The IPs must be from the exact location of the node pool's data center. If autoscaling is used, the array must contain one more IP than the maximum possible number of nodes (nodeCount+1 for a fixed number of nodes or maxNodeCount+1). The extra IP is used when the nodes are rebuilt. - PublicIps *[]string `json:"publicIps,omitempty"` + PublicIps []string `json:"publicIps,omitempty"` } // NewKubernetesNodePoolPropertiesForPut instantiates a new KubernetesNodePoolPropertiesForPut object @@ -41,7 +44,7 @@ type KubernetesNodePoolPropertiesForPut struct { func NewKubernetesNodePoolPropertiesForPut(nodeCount int32) *KubernetesNodePoolPropertiesForPut { this := KubernetesNodePoolPropertiesForPut{} - this.NodeCount = &nodeCount + this.NodeCount = nodeCount return &this } @@ -54,387 +57,322 @@ func NewKubernetesNodePoolPropertiesForPutWithDefaults() *KubernetesNodePoolProp return &this } -// GetName returns the Name field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNodePoolPropertiesForPut) GetName() *string { - if o == nil { - return nil +// GetName returns the Name field value if set, zero value otherwise. +func (o *KubernetesNodePoolPropertiesForPut) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret } - - return o.Name - + return *o.Name } -// GetNameOk returns a tuple with the Name field value +// GetNameOk returns a tuple with the Name 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 *KubernetesNodePoolPropertiesForPut) GetNameOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Name) { return nil, false } - return o.Name, true } -// SetName sets field value -func (o *KubernetesNodePoolPropertiesForPut) SetName(v string) { - - o.Name = &v - -} - // HasName returns a boolean if a field has been set. func (o *KubernetesNodePoolPropertiesForPut) HasName() bool { - if o != nil && o.Name != nil { + 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 *KubernetesNodePoolPropertiesForPut) SetName(v string) { + o.Name = &v +} + // GetNodeCount returns the NodeCount field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNodePoolPropertiesForPut) GetNodeCount() *int32 { +func (o *KubernetesNodePoolPropertiesForPut) GetNodeCount() int32 { if o == nil { - return nil + var ret int32 + return ret } return o.NodeCount - } // GetNodeCountOk returns a tuple with the NodeCount field value // 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 *KubernetesNodePoolPropertiesForPut) GetNodeCountOk() (*int32, bool) { if o == nil { return nil, false } - - return o.NodeCount, true + return &o.NodeCount, true } // SetNodeCount sets field value func (o *KubernetesNodePoolPropertiesForPut) SetNodeCount(v int32) { - - o.NodeCount = &v - + o.NodeCount = v } -// HasNodeCount returns a boolean if a field has been set. -func (o *KubernetesNodePoolPropertiesForPut) HasNodeCount() bool { - if o != nil && o.NodeCount != nil { - return true - } - - return false -} - -// GetK8sVersion returns the K8sVersion field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNodePoolPropertiesForPut) GetK8sVersion() *string { - if o == nil { - return nil +// GetK8sVersion returns the K8sVersion field value if set, zero value otherwise. +func (o *KubernetesNodePoolPropertiesForPut) GetK8sVersion() string { + if o == nil || IsNil(o.K8sVersion) { + var ret string + return ret } - - return o.K8sVersion - + return *o.K8sVersion } -// GetK8sVersionOk returns a tuple with the K8sVersion field value +// GetK8sVersionOk returns a tuple with the K8sVersion 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 *KubernetesNodePoolPropertiesForPut) GetK8sVersionOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.K8sVersion) { return nil, false } - return o.K8sVersion, true } -// SetK8sVersion sets field value -func (o *KubernetesNodePoolPropertiesForPut) SetK8sVersion(v string) { - - o.K8sVersion = &v - -} - // HasK8sVersion returns a boolean if a field has been set. func (o *KubernetesNodePoolPropertiesForPut) HasK8sVersion() bool { - if o != nil && o.K8sVersion != nil { + if o != nil && !IsNil(o.K8sVersion) { return true } return false } -// GetMaintenanceWindow returns the MaintenanceWindow field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNodePoolPropertiesForPut) GetMaintenanceWindow() *KubernetesMaintenanceWindow { - if o == nil { - return nil - } - - return o.MaintenanceWindow +// SetK8sVersion gets a reference to the given string and assigns it to the K8sVersion field. +func (o *KubernetesNodePoolPropertiesForPut) SetK8sVersion(v string) { + o.K8sVersion = &v +} +// GetMaintenanceWindow returns the MaintenanceWindow field value if set, zero value otherwise. +func (o *KubernetesNodePoolPropertiesForPut) GetMaintenanceWindow() KubernetesMaintenanceWindow { + if o == nil || IsNil(o.MaintenanceWindow) { + var ret KubernetesMaintenanceWindow + return ret + } + return *o.MaintenanceWindow } -// GetMaintenanceWindowOk returns a tuple with the MaintenanceWindow field value +// GetMaintenanceWindowOk returns a tuple with the MaintenanceWindow 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 *KubernetesNodePoolPropertiesForPut) GetMaintenanceWindowOk() (*KubernetesMaintenanceWindow, bool) { - if o == nil { + if o == nil || IsNil(o.MaintenanceWindow) { return nil, false } - return o.MaintenanceWindow, true } -// SetMaintenanceWindow sets field value -func (o *KubernetesNodePoolPropertiesForPut) SetMaintenanceWindow(v KubernetesMaintenanceWindow) { - - o.MaintenanceWindow = &v - -} - // HasMaintenanceWindow returns a boolean if a field has been set. func (o *KubernetesNodePoolPropertiesForPut) HasMaintenanceWindow() bool { - if o != nil && o.MaintenanceWindow != nil { + if o != nil && !IsNil(o.MaintenanceWindow) { return true } return false } -// GetAutoScaling returns the AutoScaling field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNodePoolPropertiesForPut) GetAutoScaling() *KubernetesAutoScaling { - if o == nil { - return nil - } - - return o.AutoScaling +// SetMaintenanceWindow gets a reference to the given KubernetesMaintenanceWindow and assigns it to the MaintenanceWindow field. +func (o *KubernetesNodePoolPropertiesForPut) SetMaintenanceWindow(v KubernetesMaintenanceWindow) { + o.MaintenanceWindow = &v +} +// GetAutoScaling returns the AutoScaling field value if set, zero value otherwise. +func (o *KubernetesNodePoolPropertiesForPut) GetAutoScaling() KubernetesAutoScaling { + if o == nil || IsNil(o.AutoScaling) { + var ret KubernetesAutoScaling + return ret + } + return *o.AutoScaling } -// GetAutoScalingOk returns a tuple with the AutoScaling field value +// GetAutoScalingOk returns a tuple with the AutoScaling 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 *KubernetesNodePoolPropertiesForPut) GetAutoScalingOk() (*KubernetesAutoScaling, bool) { - if o == nil { + if o == nil || IsNil(o.AutoScaling) { return nil, false } - return o.AutoScaling, true } -// SetAutoScaling sets field value -func (o *KubernetesNodePoolPropertiesForPut) SetAutoScaling(v KubernetesAutoScaling) { - - o.AutoScaling = &v - -} - // HasAutoScaling returns a boolean if a field has been set. func (o *KubernetesNodePoolPropertiesForPut) HasAutoScaling() bool { - if o != nil && o.AutoScaling != nil { + if o != nil && !IsNil(o.AutoScaling) { return true } return false } -// GetLans returns the Lans field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNodePoolPropertiesForPut) GetLans() *[]KubernetesNodePoolLan { - if o == nil { - return nil - } +// SetAutoScaling gets a reference to the given KubernetesAutoScaling and assigns it to the AutoScaling field. +func (o *KubernetesNodePoolPropertiesForPut) SetAutoScaling(v KubernetesAutoScaling) { + o.AutoScaling = &v +} +// GetLans returns the Lans field value if set, zero value otherwise. +func (o *KubernetesNodePoolPropertiesForPut) GetLans() []KubernetesNodePoolLan { + if o == nil || IsNil(o.Lans) { + var ret []KubernetesNodePoolLan + return ret + } return o.Lans - } -// GetLansOk returns a tuple with the Lans field value +// GetLansOk returns a tuple with the Lans 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 *KubernetesNodePoolPropertiesForPut) GetLansOk() (*[]KubernetesNodePoolLan, bool) { - if o == nil { +func (o *KubernetesNodePoolPropertiesForPut) GetLansOk() ([]KubernetesNodePoolLan, bool) { + if o == nil || IsNil(o.Lans) { return nil, false } - return o.Lans, true } -// SetLans sets field value -func (o *KubernetesNodePoolPropertiesForPut) SetLans(v []KubernetesNodePoolLan) { - - o.Lans = &v - -} - // HasLans returns a boolean if a field has been set. func (o *KubernetesNodePoolPropertiesForPut) HasLans() bool { - if o != nil && o.Lans != nil { + if o != nil && !IsNil(o.Lans) { return true } return false } -// GetLabels returns the Labels field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNodePoolPropertiesForPut) GetLabels() *map[string]string { - if o == nil { - return nil - } - - return o.Labels +// SetLans gets a reference to the given []KubernetesNodePoolLan and assigns it to the Lans field. +func (o *KubernetesNodePoolPropertiesForPut) SetLans(v []KubernetesNodePoolLan) { + o.Lans = v +} +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *KubernetesNodePoolPropertiesForPut) GetLabels() map[string]string { + if o == nil || IsNil(o.Labels) { + var ret map[string]string + return ret + } + return *o.Labels } -// GetLabelsOk returns a tuple with the Labels field value +// GetLabelsOk returns a tuple with the Labels 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 *KubernetesNodePoolPropertiesForPut) GetLabelsOk() (*map[string]string, bool) { - if o == nil { + if o == nil || IsNil(o.Labels) { return nil, false } - return o.Labels, true } -// SetLabels sets field value -func (o *KubernetesNodePoolPropertiesForPut) SetLabels(v map[string]string) { - - o.Labels = &v - -} - // HasLabels returns a boolean if a field has been set. func (o *KubernetesNodePoolPropertiesForPut) HasLabels() bool { - if o != nil && o.Labels != nil { + if o != nil && !IsNil(o.Labels) { return true } return false } -// GetAnnotations returns the Annotations field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNodePoolPropertiesForPut) GetAnnotations() *map[string]string { - if o == nil { - return nil - } - - return o.Annotations +// SetLabels gets a reference to the given map[string]string and assigns it to the Labels field. +func (o *KubernetesNodePoolPropertiesForPut) SetLabels(v map[string]string) { + o.Labels = &v +} +// GetAnnotations returns the Annotations field value if set, zero value otherwise. +func (o *KubernetesNodePoolPropertiesForPut) GetAnnotations() map[string]string { + if o == nil || IsNil(o.Annotations) { + var ret map[string]string + return ret + } + return *o.Annotations } -// GetAnnotationsOk returns a tuple with the Annotations field value +// GetAnnotationsOk returns a tuple with the Annotations 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 *KubernetesNodePoolPropertiesForPut) GetAnnotationsOk() (*map[string]string, bool) { - if o == nil { + if o == nil || IsNil(o.Annotations) { return nil, false } - return o.Annotations, true } -// SetAnnotations sets field value -func (o *KubernetesNodePoolPropertiesForPut) SetAnnotations(v map[string]string) { - - o.Annotations = &v - -} - // HasAnnotations returns a boolean if a field has been set. func (o *KubernetesNodePoolPropertiesForPut) HasAnnotations() bool { - if o != nil && o.Annotations != nil { + if o != nil && !IsNil(o.Annotations) { return true } return false } -// GetPublicIps returns the PublicIps field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNodePoolPropertiesForPut) GetPublicIps() *[]string { - if o == nil { - return nil - } +// SetAnnotations gets a reference to the given map[string]string and assigns it to the Annotations field. +func (o *KubernetesNodePoolPropertiesForPut) SetAnnotations(v map[string]string) { + o.Annotations = &v +} +// GetPublicIps returns the PublicIps field value if set, zero value otherwise. +func (o *KubernetesNodePoolPropertiesForPut) GetPublicIps() []string { + if o == nil || IsNil(o.PublicIps) { + var ret []string + return ret + } return o.PublicIps - } -// GetPublicIpsOk returns a tuple with the PublicIps field value +// GetPublicIpsOk returns a tuple with the PublicIps 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 *KubernetesNodePoolPropertiesForPut) GetPublicIpsOk() (*[]string, bool) { - if o == nil { +func (o *KubernetesNodePoolPropertiesForPut) GetPublicIpsOk() ([]string, bool) { + if o == nil || IsNil(o.PublicIps) { return nil, false } - return o.PublicIps, true } -// SetPublicIps sets field value -func (o *KubernetesNodePoolPropertiesForPut) SetPublicIps(v []string) { - - o.PublicIps = &v - -} - // HasPublicIps returns a boolean if a field has been set. func (o *KubernetesNodePoolPropertiesForPut) HasPublicIps() bool { - if o != nil && o.PublicIps != nil { + if o != nil && !IsNil(o.PublicIps) { return true } return false } +// SetPublicIps gets a reference to the given []string and assigns it to the PublicIps field. +func (o *KubernetesNodePoolPropertiesForPut) SetPublicIps(v []string) { + o.PublicIps = v +} + func (o KubernetesNodePoolPropertiesForPut) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.Name != nil { - toSerialize["name"] = o.Name + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } + return json.Marshal(toSerialize) +} - if o.NodeCount != nil { - toSerialize["nodeCount"] = o.NodeCount +func (o KubernetesNodePoolPropertiesForPut) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Name) { + toSerialize["name"] = o.Name } - - if o.K8sVersion != nil { + toSerialize["nodeCount"] = o.NodeCount + if !IsNil(o.K8sVersion) { toSerialize["k8sVersion"] = o.K8sVersion } - - if o.MaintenanceWindow != nil { + if !IsNil(o.MaintenanceWindow) { toSerialize["maintenanceWindow"] = o.MaintenanceWindow } - - if o.AutoScaling != nil { + if !IsNil(o.AutoScaling) { toSerialize["autoScaling"] = o.AutoScaling } - - if o.Lans != nil { + if !IsNil(o.Lans) { toSerialize["lans"] = o.Lans } - - if o.Labels != nil { + if !IsNil(o.Labels) { toSerialize["labels"] = o.Labels } - - if o.Annotations != nil { + if !IsNil(o.Annotations) { toSerialize["annotations"] = o.Annotations } - - if o.PublicIps != nil { + if !IsNil(o.PublicIps) { toSerialize["publicIps"] = o.PublicIps } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableKubernetesNodePoolPropertiesForPut struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_kubernetes_node_pools.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_kubernetes_node_pools.go similarity index 65% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_kubernetes_node_pools.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_kubernetes_node_pools.go index 81e426401..c34be42cb 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_kubernetes_node_pools.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_kubernetes_node_pools.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the KubernetesNodePools type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &KubernetesNodePools{} + // KubernetesNodePools struct for KubernetesNodePools type KubernetesNodePools struct { // A unique representation of the Kubernetes node pool as a resource collection. @@ -23,7 +26,7 @@ type KubernetesNodePools struct { // The URL to the collection representation (absolute path). Href *string `json:"href,omitempty"` // Array of items in the collection. - Items *[]KubernetesNodePool `json:"items,omitempty"` + Items []KubernetesNodePool `json:"items,omitempty"` } // NewKubernetesNodePools instantiates a new KubernetesNodePools object @@ -44,177 +47,157 @@ func NewKubernetesNodePoolsWithDefaults() *KubernetesNodePools { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNodePools) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *KubernetesNodePools) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *KubernetesNodePools) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *KubernetesNodePools) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *KubernetesNodePools) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNodePools) GetType() *string { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *KubernetesNodePools) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *KubernetesNodePools) 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 +// GetTypeOk returns a tuple with the Type 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 *KubernetesNodePools) GetTypeOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *KubernetesNodePools) SetType(v string) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *KubernetesNodePools) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNodePools) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *KubernetesNodePools) SetType(v string) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *KubernetesNodePools) 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 +// GetHrefOk returns a tuple with the Href 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 *KubernetesNodePools) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *KubernetesNodePools) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *KubernetesNodePools) HasHref() bool { - if o != nil && o.Href != nil { + if o != nil && !IsNil(o.Href) { return true } return false } -// GetItems returns the Items field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNodePools) GetItems() *[]KubernetesNodePool { - if o == nil { - return nil - } +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *KubernetesNodePools) SetHref(v string) { + o.Href = &v +} +// GetItems returns the Items field value if set, zero value otherwise. +func (o *KubernetesNodePools) GetItems() []KubernetesNodePool { + if o == nil || IsNil(o.Items) { + var ret []KubernetesNodePool + return ret + } return o.Items - } -// GetItemsOk returns a tuple with the Items field value +// GetItemsOk returns a tuple with the Items 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 *KubernetesNodePools) GetItemsOk() (*[]KubernetesNodePool, bool) { - if o == nil { +func (o *KubernetesNodePools) GetItemsOk() ([]KubernetesNodePool, bool) { + if o == nil || IsNil(o.Items) { return nil, false } - return o.Items, true } -// SetItems sets field value -func (o *KubernetesNodePools) SetItems(v []KubernetesNodePool) { - - o.Items = &v - -} - // HasItems returns a boolean if a field has been set. func (o *KubernetesNodePools) HasItems() bool { - if o != nil && o.Items != nil { + if o != nil && !IsNil(o.Items) { return true } return false } +// SetItems gets a reference to the given []KubernetesNodePool and assigns it to the Items field. +func (o *KubernetesNodePools) SetItems(v []KubernetesNodePool) { + o.Items = v +} + func (o KubernetesNodePools) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o KubernetesNodePools) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Items != nil { + if !IsNil(o.Items) { toSerialize["items"] = o.Items } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableKubernetesNodePools struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_kubernetes_node_properties.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_kubernetes_node_properties.go similarity index 71% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_kubernetes_node_properties.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_kubernetes_node_properties.go index 51d015ef1..132db92f5 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_kubernetes_node_properties.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_kubernetes_node_properties.go @@ -14,16 +14,19 @@ import ( "encoding/json" ) +// checks if the KubernetesNodeProperties type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &KubernetesNodeProperties{} + // KubernetesNodeProperties struct for KubernetesNodeProperties type KubernetesNodeProperties struct { // The Kubernetes node name. - Name *string `json:"name"` + Name string `json:"name"` // The public IP associated with the node. PublicIP *string `json:"publicIP,omitempty"` // The private IP associated with the node. PrivateIP *string `json:"privateIP,omitempty"` // The Kubernetes version running in the node pool. Note that this imposes restrictions on which Kubernetes versions can run in the node pools of a cluster. Also, not all Kubernetes versions are suitable upgrade targets for all earlier versions. - K8sVersion *string `json:"k8sVersion"` + K8sVersion string `json:"k8sVersion"` } // NewKubernetesNodeProperties instantiates a new KubernetesNodeProperties object @@ -33,8 +36,8 @@ type KubernetesNodeProperties struct { func NewKubernetesNodeProperties(name string, k8sVersion string) *KubernetesNodeProperties { this := KubernetesNodeProperties{} - this.Name = &name - this.K8sVersion = &k8sVersion + this.Name = name + this.K8sVersion = k8sVersion return &this } @@ -48,176 +51,136 @@ func NewKubernetesNodePropertiesWithDefaults() *KubernetesNodeProperties { } // GetName returns the Name field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNodeProperties) GetName() *string { +func (o *KubernetesNodeProperties) GetName() string { if o == nil { - return 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. -// NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *KubernetesNodeProperties) GetNameOk() (*string, bool) { if o == nil { return nil, false } - - return o.Name, true + return &o.Name, true } // SetName sets field value func (o *KubernetesNodeProperties) SetName(v string) { - - o.Name = &v - + o.Name = v } -// HasName returns a boolean if a field has been set. -func (o *KubernetesNodeProperties) HasName() bool { - if o != nil && o.Name != nil { - return true +// GetPublicIP returns the PublicIP field value if set, zero value otherwise. +func (o *KubernetesNodeProperties) GetPublicIP() string { + if o == nil || IsNil(o.PublicIP) { + var ret string + return ret } - - return false + return *o.PublicIP } -// GetPublicIP returns the PublicIP field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNodeProperties) GetPublicIP() *string { - if o == nil { - return nil - } - - return o.PublicIP - -} - -// GetPublicIPOk returns a tuple with the PublicIP field value +// GetPublicIPOk returns a tuple with the PublicIP 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 *KubernetesNodeProperties) GetPublicIPOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.PublicIP) { return nil, false } - return o.PublicIP, true } -// SetPublicIP sets field value -func (o *KubernetesNodeProperties) SetPublicIP(v string) { - - o.PublicIP = &v - -} - // HasPublicIP returns a boolean if a field has been set. func (o *KubernetesNodeProperties) HasPublicIP() bool { - if o != nil && o.PublicIP != nil { + if o != nil && !IsNil(o.PublicIP) { return true } return false } -// GetPrivateIP returns the PrivateIP field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNodeProperties) GetPrivateIP() *string { - if o == nil { - return nil - } - - return o.PrivateIP +// SetPublicIP gets a reference to the given string and assigns it to the PublicIP field. +func (o *KubernetesNodeProperties) SetPublicIP(v string) { + o.PublicIP = &v +} +// GetPrivateIP returns the PrivateIP field value if set, zero value otherwise. +func (o *KubernetesNodeProperties) GetPrivateIP() string { + if o == nil || IsNil(o.PrivateIP) { + var ret string + return ret + } + return *o.PrivateIP } -// GetPrivateIPOk returns a tuple with the PrivateIP field value +// GetPrivateIPOk returns a tuple with the PrivateIP 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 *KubernetesNodeProperties) GetPrivateIPOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.PrivateIP) { return nil, false } - return o.PrivateIP, true } -// SetPrivateIP sets field value -func (o *KubernetesNodeProperties) SetPrivateIP(v string) { - - o.PrivateIP = &v - -} - // HasPrivateIP returns a boolean if a field has been set. func (o *KubernetesNodeProperties) HasPrivateIP() bool { - if o != nil && o.PrivateIP != nil { + if o != nil && !IsNil(o.PrivateIP) { return true } return false } +// SetPrivateIP gets a reference to the given string and assigns it to the PrivateIP field. +func (o *KubernetesNodeProperties) SetPrivateIP(v string) { + o.PrivateIP = &v +} + // GetK8sVersion returns the K8sVersion field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNodeProperties) GetK8sVersion() *string { +func (o *KubernetesNodeProperties) GetK8sVersion() string { if o == nil { - return nil + var ret string + return ret } return o.K8sVersion - } // GetK8sVersionOk returns a tuple with the K8sVersion field value // 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 *KubernetesNodeProperties) GetK8sVersionOk() (*string, bool) { if o == nil { return nil, false } - - return o.K8sVersion, true + return &o.K8sVersion, true } // SetK8sVersion sets field value func (o *KubernetesNodeProperties) SetK8sVersion(v string) { - - o.K8sVersion = &v - + o.K8sVersion = v } -// HasK8sVersion returns a boolean if a field has been set. -func (o *KubernetesNodeProperties) HasK8sVersion() bool { - if o != nil && o.K8sVersion != nil { - return true +func (o KubernetesNodeProperties) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } - - return false + return json.Marshal(toSerialize) } -func (o KubernetesNodeProperties) MarshalJSON() ([]byte, error) { +func (o KubernetesNodeProperties) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Name != nil { - toSerialize["name"] = o.Name - } - - if o.PublicIP != nil { + toSerialize["name"] = o.Name + if !IsNil(o.PublicIP) { toSerialize["publicIP"] = o.PublicIP } - - if o.PrivateIP != nil { + if !IsNil(o.PrivateIP) { toSerialize["privateIP"] = o.PrivateIP } - - if o.K8sVersion != nil { - toSerialize["k8sVersion"] = o.K8sVersion - } - - return json.Marshal(toSerialize) + toSerialize["k8sVersion"] = o.K8sVersion + return toSerialize, nil } type NullableKubernetesNodeProperties struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_kubernetes_nodes.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_kubernetes_nodes.go similarity index 65% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_kubernetes_nodes.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_kubernetes_nodes.go index e475582c2..c9233e67f 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_kubernetes_nodes.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_kubernetes_nodes.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the KubernetesNodes type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &KubernetesNodes{} + // KubernetesNodes struct for KubernetesNodes type KubernetesNodes struct { // A unique representation of the Kubernetes node pool as a resource collection. @@ -23,7 +26,7 @@ type KubernetesNodes struct { // The URL to the collection representation (absolute path). Href *string `json:"href,omitempty"` // Array of items in the collection. - Items *[]KubernetesNode `json:"items,omitempty"` + Items []KubernetesNode `json:"items,omitempty"` } // NewKubernetesNodes instantiates a new KubernetesNodes object @@ -44,177 +47,157 @@ func NewKubernetesNodesWithDefaults() *KubernetesNodes { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNodes) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *KubernetesNodes) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *KubernetesNodes) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *KubernetesNodes) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *KubernetesNodes) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNodes) GetType() *string { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *KubernetesNodes) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *KubernetesNodes) 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 +// GetTypeOk returns a tuple with the Type 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 *KubernetesNodes) GetTypeOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *KubernetesNodes) SetType(v string) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *KubernetesNodes) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNodes) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *KubernetesNodes) SetType(v string) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *KubernetesNodes) 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 +// GetHrefOk returns a tuple with the Href 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 *KubernetesNodes) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *KubernetesNodes) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *KubernetesNodes) HasHref() bool { - if o != nil && o.Href != nil { + if o != nil && !IsNil(o.Href) { return true } return false } -// GetItems returns the Items field value -// If the value is explicit nil, nil is returned -func (o *KubernetesNodes) GetItems() *[]KubernetesNode { - if o == nil { - return nil - } +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *KubernetesNodes) SetHref(v string) { + o.Href = &v +} +// GetItems returns the Items field value if set, zero value otherwise. +func (o *KubernetesNodes) GetItems() []KubernetesNode { + if o == nil || IsNil(o.Items) { + var ret []KubernetesNode + return ret + } return o.Items - } -// GetItemsOk returns a tuple with the Items field value +// GetItemsOk returns a tuple with the Items 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 *KubernetesNodes) GetItemsOk() (*[]KubernetesNode, bool) { - if o == nil { +func (o *KubernetesNodes) GetItemsOk() ([]KubernetesNode, bool) { + if o == nil || IsNil(o.Items) { return nil, false } - return o.Items, true } -// SetItems sets field value -func (o *KubernetesNodes) SetItems(v []KubernetesNode) { - - o.Items = &v - -} - // HasItems returns a boolean if a field has been set. func (o *KubernetesNodes) HasItems() bool { - if o != nil && o.Items != nil { + if o != nil && !IsNil(o.Items) { return true } return false } +// SetItems gets a reference to the given []KubernetesNode and assigns it to the Items field. +func (o *KubernetesNodes) SetItems(v []KubernetesNode) { + o.Items = v +} + func (o KubernetesNodes) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o KubernetesNodes) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Items != nil { + if !IsNil(o.Items) { toSerialize["items"] = o.Items } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableKubernetesNodes struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_label.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_label.go similarity index 65% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_label.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_label.go index 3aa3b2151..eba6837d5 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_label.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_label.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the Label type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Label{} + // Label struct for Label type Label struct { // Label is identified using standard URN. @@ -23,7 +26,7 @@ type Label struct { // URL to the object representation (absolute path). Href *string `json:"href,omitempty"` Metadata *NoStateMetaData `json:"metadata,omitempty"` - Properties *LabelProperties `json:"properties"` + Properties LabelProperties `json:"properties"` } // NewLabel instantiates a new Label object @@ -33,7 +36,7 @@ type Label struct { func NewLabel(properties LabelProperties) *Label { this := Label{} - this.Properties = &properties + this.Properties = properties return &this } @@ -46,219 +49,182 @@ func NewLabelWithDefaults() *Label { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *Label) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *Label) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *Label) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *Label) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *Label) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *Label) GetType() *string { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Label) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *Label) 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 +// GetTypeOk returns a tuple with the Type 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 *Label) GetTypeOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *Label) SetType(v string) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *Label) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *Label) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *Label) SetType(v string) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *Label) 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 +// GetHrefOk returns a tuple with the Href 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 *Label) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *Label) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *Label) HasHref() bool { - if o != nil && o.Href != nil { + if o != nil && !IsNil(o.Href) { return true } return false } -// GetMetadata returns the Metadata field value -// If the value is explicit nil, nil is returned -func (o *Label) GetMetadata() *NoStateMetaData { - if o == nil { - return nil - } - - return o.Metadata +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *Label) SetHref(v string) { + o.Href = &v +} +// GetMetadata returns the Metadata field value if set, zero value otherwise. +func (o *Label) GetMetadata() NoStateMetaData { + if o == nil || IsNil(o.Metadata) { + var ret NoStateMetaData + return ret + } + return *o.Metadata } -// GetMetadataOk returns a tuple with the Metadata field value +// GetMetadataOk returns a tuple with the Metadata 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 *Label) GetMetadataOk() (*NoStateMetaData, bool) { - if o == nil { + if o == nil || IsNil(o.Metadata) { return nil, false } - return o.Metadata, true } -// SetMetadata sets field value -func (o *Label) SetMetadata(v NoStateMetaData) { - - o.Metadata = &v - -} - // HasMetadata returns a boolean if a field has been set. func (o *Label) HasMetadata() bool { - if o != nil && o.Metadata != nil { + if o != nil && !IsNil(o.Metadata) { return true } return false } +// SetMetadata gets a reference to the given NoStateMetaData and assigns it to the Metadata field. +func (o *Label) SetMetadata(v NoStateMetaData) { + o.Metadata = &v +} + // GetProperties returns the Properties field value -// If the value is explicit nil, nil is returned -func (o *Label) GetProperties() *LabelProperties { +func (o *Label) GetProperties() LabelProperties { if o == nil { - return nil + var ret LabelProperties + return ret } return o.Properties - } // GetPropertiesOk returns a tuple with the Properties field value // 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 *Label) GetPropertiesOk() (*LabelProperties, bool) { if o == nil { return nil, false } - - return o.Properties, true + return &o.Properties, true } // SetProperties sets field value func (o *Label) SetProperties(v LabelProperties) { - - o.Properties = &v - + o.Properties = v } -// HasProperties returns a boolean if a field has been set. -func (o *Label) HasProperties() bool { - if o != nil && o.Properties != nil { - return true +func (o Label) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } - - return false + return json.Marshal(toSerialize) } -func (o Label) MarshalJSON() ([]byte, error) { +func (o Label) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Metadata != nil { + if !IsNil(o.Metadata) { toSerialize["metadata"] = o.Metadata } - - if o.Properties != nil { - toSerialize["properties"] = o.Properties - } - - return json.Marshal(toSerialize) + toSerialize["properties"] = o.Properties + return toSerialize, nil } type NullableLabel struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_label_properties.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_label_properties.go similarity index 66% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_label_properties.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_label_properties.go index 4c2e8e96d..3fa289b74 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_label_properties.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_label_properties.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the LabelProperties type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &LabelProperties{} + // LabelProperties struct for LabelProperties type LabelProperties struct { // A label key @@ -46,219 +49,192 @@ func NewLabelPropertiesWithDefaults() *LabelProperties { return &this } -// GetKey returns the Key field value -// If the value is explicit nil, nil is returned -func (o *LabelProperties) GetKey() *string { - if o == nil { - return nil +// GetKey returns the Key field value if set, zero value otherwise. +func (o *LabelProperties) GetKey() string { + if o == nil || IsNil(o.Key) { + var ret string + return ret } - - return o.Key - + return *o.Key } -// GetKeyOk returns a tuple with the Key field value +// GetKeyOk returns a tuple with the Key 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 *LabelProperties) GetKeyOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Key) { return nil, false } - return o.Key, true } -// SetKey sets field value -func (o *LabelProperties) SetKey(v string) { - - o.Key = &v - -} - // HasKey returns a boolean if a field has been set. func (o *LabelProperties) HasKey() bool { - if o != nil && o.Key != nil { + if o != nil && !IsNil(o.Key) { return true } return false } -// GetValue returns the Value field value -// If the value is explicit nil, nil is returned -func (o *LabelProperties) GetValue() *string { - if o == nil { - return nil - } - - return o.Value +// SetKey gets a reference to the given string and assigns it to the Key field. +func (o *LabelProperties) SetKey(v string) { + o.Key = &v +} +// GetValue returns the Value field value if set, zero value otherwise. +func (o *LabelProperties) GetValue() string { + if o == nil || IsNil(o.Value) { + var ret string + return ret + } + return *o.Value } -// GetValueOk returns a tuple with the Value field value +// GetValueOk returns a tuple with the Value 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 *LabelProperties) GetValueOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Value) { return nil, false } - return o.Value, true } -// SetValue sets field value -func (o *LabelProperties) SetValue(v string) { - - o.Value = &v - -} - // HasValue returns a boolean if a field has been set. func (o *LabelProperties) HasValue() bool { - if o != nil && o.Value != nil { + if o != nil && !IsNil(o.Value) { return true } return false } -// GetResourceId returns the ResourceId field value -// If the value is explicit nil, nil is returned -func (o *LabelProperties) GetResourceId() *string { - if o == nil { - return nil - } - - return o.ResourceId +// SetValue gets a reference to the given string and assigns it to the Value field. +func (o *LabelProperties) SetValue(v string) { + o.Value = &v +} +// GetResourceId returns the ResourceId field value if set, zero value otherwise. +func (o *LabelProperties) GetResourceId() string { + if o == nil || IsNil(o.ResourceId) { + var ret string + return ret + } + return *o.ResourceId } -// GetResourceIdOk returns a tuple with the ResourceId field value +// GetResourceIdOk returns a tuple with the ResourceId 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 *LabelProperties) GetResourceIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.ResourceId) { return nil, false } - return o.ResourceId, true } -// SetResourceId sets field value -func (o *LabelProperties) SetResourceId(v string) { - - o.ResourceId = &v - -} - // HasResourceId returns a boolean if a field has been set. func (o *LabelProperties) HasResourceId() bool { - if o != nil && o.ResourceId != nil { + if o != nil && !IsNil(o.ResourceId) { return true } return false } -// GetResourceType returns the ResourceType field value -// If the value is explicit nil, nil is returned -func (o *LabelProperties) GetResourceType() *string { - if o == nil { - return nil - } - - return o.ResourceType +// SetResourceId gets a reference to the given string and assigns it to the ResourceId field. +func (o *LabelProperties) SetResourceId(v string) { + o.ResourceId = &v +} +// GetResourceType returns the ResourceType field value if set, zero value otherwise. +func (o *LabelProperties) GetResourceType() string { + if o == nil || IsNil(o.ResourceType) { + var ret string + return ret + } + return *o.ResourceType } -// GetResourceTypeOk returns a tuple with the ResourceType field value +// GetResourceTypeOk returns a tuple with the ResourceType 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 *LabelProperties) GetResourceTypeOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.ResourceType) { return nil, false } - return o.ResourceType, true } -// SetResourceType sets field value -func (o *LabelProperties) SetResourceType(v string) { - - o.ResourceType = &v - -} - // HasResourceType returns a boolean if a field has been set. func (o *LabelProperties) HasResourceType() bool { - if o != nil && o.ResourceType != nil { + if o != nil && !IsNil(o.ResourceType) { return true } return false } -// GetResourceHref returns the ResourceHref field value -// If the value is explicit nil, nil is returned -func (o *LabelProperties) GetResourceHref() *string { - if o == nil { - return nil - } - - return o.ResourceHref +// SetResourceType gets a reference to the given string and assigns it to the ResourceType field. +func (o *LabelProperties) SetResourceType(v string) { + o.ResourceType = &v +} +// GetResourceHref returns the ResourceHref field value if set, zero value otherwise. +func (o *LabelProperties) GetResourceHref() string { + if o == nil || IsNil(o.ResourceHref) { + var ret string + return ret + } + return *o.ResourceHref } -// GetResourceHrefOk returns a tuple with the ResourceHref field value +// GetResourceHrefOk returns a tuple with the ResourceHref 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 *LabelProperties) GetResourceHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.ResourceHref) { return nil, false } - return o.ResourceHref, true } -// SetResourceHref sets field value -func (o *LabelProperties) SetResourceHref(v string) { - - o.ResourceHref = &v - -} - // HasResourceHref returns a boolean if a field has been set. func (o *LabelProperties) HasResourceHref() bool { - if o != nil && o.ResourceHref != nil { + if o != nil && !IsNil(o.ResourceHref) { return true } return false } +// SetResourceHref gets a reference to the given string and assigns it to the ResourceHref field. +func (o *LabelProperties) SetResourceHref(v string) { + o.ResourceHref = &v +} + func (o LabelProperties) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o LabelProperties) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Key != nil { + if !IsNil(o.Key) { toSerialize["key"] = o.Key } - - if o.Value != nil { + if !IsNil(o.Value) { toSerialize["value"] = o.Value } - - if o.ResourceId != nil { + if !IsNil(o.ResourceId) { toSerialize["resourceId"] = o.ResourceId } - - if o.ResourceType != nil { + if !IsNil(o.ResourceType) { toSerialize["resourceType"] = o.ResourceType } - - if o.ResourceHref != nil { + if !IsNil(o.ResourceHref) { toSerialize["resourceHref"] = o.ResourceHref } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableLabelProperties struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_label_resource.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_label_resource.go similarity index 64% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_label_resource.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_label_resource.go index 5166c7a7a..944cc8ea1 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_label_resource.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_label_resource.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the LabelResource type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &LabelResource{} + // LabelResource struct for LabelResource type LabelResource struct { // Label on a resource is identified using label key. @@ -21,9 +24,9 @@ type LabelResource struct { // The type of object that has been created. Type *string `json:"type,omitempty"` // URL to the object representation (absolute path). - Href *string `json:"href,omitempty"` - Metadata *NoStateMetaData `json:"metadata,omitempty"` - Properties *LabelResourceProperties `json:"properties"` + Href *string `json:"href,omitempty"` + Metadata *NoStateMetaData `json:"metadata,omitempty"` + Properties LabelResourceProperties `json:"properties"` } // NewLabelResource instantiates a new LabelResource object @@ -33,7 +36,7 @@ type LabelResource struct { func NewLabelResource(properties LabelResourceProperties) *LabelResource { this := LabelResource{} - this.Properties = &properties + this.Properties = properties return &this } @@ -46,219 +49,182 @@ func NewLabelResourceWithDefaults() *LabelResource { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *LabelResource) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *LabelResource) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *LabelResource) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *LabelResource) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *LabelResource) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *LabelResource) GetType() *string { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *LabelResource) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *LabelResource) 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 +// GetTypeOk returns a tuple with the Type 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 *LabelResource) GetTypeOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *LabelResource) SetType(v string) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *LabelResource) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *LabelResource) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *LabelResource) SetType(v string) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *LabelResource) 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 +// GetHrefOk returns a tuple with the Href 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 *LabelResource) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *LabelResource) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *LabelResource) HasHref() bool { - if o != nil && o.Href != nil { + if o != nil && !IsNil(o.Href) { return true } return false } -// GetMetadata returns the Metadata field value -// If the value is explicit nil, nil is returned -func (o *LabelResource) GetMetadata() *NoStateMetaData { - if o == nil { - return nil - } - - return o.Metadata +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *LabelResource) SetHref(v string) { + o.Href = &v +} +// GetMetadata returns the Metadata field value if set, zero value otherwise. +func (o *LabelResource) GetMetadata() NoStateMetaData { + if o == nil || IsNil(o.Metadata) { + var ret NoStateMetaData + return ret + } + return *o.Metadata } -// GetMetadataOk returns a tuple with the Metadata field value +// GetMetadataOk returns a tuple with the Metadata 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 *LabelResource) GetMetadataOk() (*NoStateMetaData, bool) { - if o == nil { + if o == nil || IsNil(o.Metadata) { return nil, false } - return o.Metadata, true } -// SetMetadata sets field value -func (o *LabelResource) SetMetadata(v NoStateMetaData) { - - o.Metadata = &v - -} - // HasMetadata returns a boolean if a field has been set. func (o *LabelResource) HasMetadata() bool { - if o != nil && o.Metadata != nil { + if o != nil && !IsNil(o.Metadata) { return true } return false } +// SetMetadata gets a reference to the given NoStateMetaData and assigns it to the Metadata field. +func (o *LabelResource) SetMetadata(v NoStateMetaData) { + o.Metadata = &v +} + // GetProperties returns the Properties field value -// If the value is explicit nil, nil is returned -func (o *LabelResource) GetProperties() *LabelResourceProperties { +func (o *LabelResource) GetProperties() LabelResourceProperties { if o == nil { - return nil + var ret LabelResourceProperties + return ret } return o.Properties - } // GetPropertiesOk returns a tuple with the Properties field value // 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 *LabelResource) GetPropertiesOk() (*LabelResourceProperties, bool) { if o == nil { return nil, false } - - return o.Properties, true + return &o.Properties, true } // SetProperties sets field value func (o *LabelResource) SetProperties(v LabelResourceProperties) { - - o.Properties = &v - + o.Properties = v } -// HasProperties returns a boolean if a field has been set. -func (o *LabelResource) HasProperties() bool { - if o != nil && o.Properties != nil { - return true +func (o LabelResource) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } - - return false + return json.Marshal(toSerialize) } -func (o LabelResource) MarshalJSON() ([]byte, error) { +func (o LabelResource) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Metadata != nil { + if !IsNil(o.Metadata) { toSerialize["metadata"] = o.Metadata } - - if o.Properties != nil { - toSerialize["properties"] = o.Properties - } - - return json.Marshal(toSerialize) + toSerialize["properties"] = o.Properties + return toSerialize, nil } type NullableLabelResource struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_label_resource_properties.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_label_resource_properties.go similarity index 73% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_label_resource_properties.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_label_resource_properties.go index f0708ca20..793f8c05b 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_label_resource_properties.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_label_resource_properties.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the LabelResourceProperties type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &LabelResourceProperties{} + // LabelResourceProperties struct for LabelResourceProperties type LabelResourceProperties struct { // A label key @@ -40,93 +43,87 @@ func NewLabelResourcePropertiesWithDefaults() *LabelResourceProperties { return &this } -// GetKey returns the Key field value -// If the value is explicit nil, nil is returned -func (o *LabelResourceProperties) GetKey() *string { - if o == nil { - return nil +// GetKey returns the Key field value if set, zero value otherwise. +func (o *LabelResourceProperties) GetKey() string { + if o == nil || IsNil(o.Key) { + var ret string + return ret } - - return o.Key - + return *o.Key } -// GetKeyOk returns a tuple with the Key field value +// GetKeyOk returns a tuple with the Key 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 *LabelResourceProperties) GetKeyOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Key) { return nil, false } - return o.Key, true } -// SetKey sets field value -func (o *LabelResourceProperties) SetKey(v string) { - - o.Key = &v - -} - // HasKey returns a boolean if a field has been set. func (o *LabelResourceProperties) HasKey() bool { - if o != nil && o.Key != nil { + if o != nil && !IsNil(o.Key) { return true } return false } -// GetValue returns the Value field value -// If the value is explicit nil, nil is returned -func (o *LabelResourceProperties) GetValue() *string { - if o == nil { - return nil - } - - return o.Value +// SetKey gets a reference to the given string and assigns it to the Key field. +func (o *LabelResourceProperties) SetKey(v string) { + o.Key = &v +} +// GetValue returns the Value field value if set, zero value otherwise. +func (o *LabelResourceProperties) GetValue() string { + if o == nil || IsNil(o.Value) { + var ret string + return ret + } + return *o.Value } -// GetValueOk returns a tuple with the Value field value +// GetValueOk returns a tuple with the Value 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 *LabelResourceProperties) GetValueOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Value) { return nil, false } - return o.Value, true } -// SetValue sets field value -func (o *LabelResourceProperties) SetValue(v string) { - - o.Value = &v - -} - // HasValue returns a boolean if a field has been set. func (o *LabelResourceProperties) HasValue() bool { - if o != nil && o.Value != nil { + if o != nil && !IsNil(o.Value) { return true } return false } +// SetValue gets a reference to the given string and assigns it to the Value field. +func (o *LabelResourceProperties) SetValue(v string) { + o.Value = &v +} + func (o LabelResourceProperties) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o LabelResourceProperties) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Key != nil { + if !IsNil(o.Key) { toSerialize["key"] = o.Key } - - if o.Value != nil { + if !IsNil(o.Value) { toSerialize["value"] = o.Value } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableLabelResourceProperties struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_label_resources.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_label_resources.go similarity index 60% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_label_resources.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_label_resources.go index b81b98194..c53965254 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_label_resources.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_label_resources.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the LabelResources type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &LabelResources{} + // LabelResources struct for LabelResources type LabelResources struct { // A unique representation of the label as a resource collection. @@ -23,7 +26,7 @@ type LabelResources struct { // URL to the collection representation (absolute path). Href *string `json:"href,omitempty"` // Array of items in the collection. - Items *[]LabelResource `json:"items,omitempty"` + Items []LabelResource `json:"items,omitempty"` // The offset (if specified in the request). Offset *float32 `json:"offset,omitempty"` // The limit (if specified in the request). @@ -49,303 +52,262 @@ func NewLabelResourcesWithDefaults() *LabelResources { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *LabelResources) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *LabelResources) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *LabelResources) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *LabelResources) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *LabelResources) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *LabelResources) GetType() *string { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *LabelResources) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *LabelResources) 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 +// GetTypeOk returns a tuple with the Type 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 *LabelResources) GetTypeOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *LabelResources) SetType(v string) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *LabelResources) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *LabelResources) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *LabelResources) SetType(v string) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *LabelResources) 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 +// GetHrefOk returns a tuple with the Href 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 *LabelResources) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *LabelResources) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *LabelResources) HasHref() bool { - if o != nil && o.Href != nil { + if o != nil && !IsNil(o.Href) { return true } return false } -// GetItems returns the Items field value -// If the value is explicit nil, nil is returned -func (o *LabelResources) GetItems() *[]LabelResource { - if o == nil { - return nil - } +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *LabelResources) SetHref(v string) { + o.Href = &v +} +// GetItems returns the Items field value if set, zero value otherwise. +func (o *LabelResources) GetItems() []LabelResource { + if o == nil || IsNil(o.Items) { + var ret []LabelResource + return ret + } return o.Items - } -// GetItemsOk returns a tuple with the Items field value +// GetItemsOk returns a tuple with the Items 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 *LabelResources) GetItemsOk() (*[]LabelResource, bool) { - if o == nil { +func (o *LabelResources) GetItemsOk() ([]LabelResource, bool) { + if o == nil || IsNil(o.Items) { return nil, false } - return o.Items, true } -// SetItems sets field value -func (o *LabelResources) SetItems(v []LabelResource) { - - o.Items = &v - -} - // HasItems returns a boolean if a field has been set. func (o *LabelResources) HasItems() bool { - if o != nil && o.Items != nil { + if o != nil && !IsNil(o.Items) { return true } return false } -// GetOffset returns the Offset field value -// If the value is explicit nil, nil is returned -func (o *LabelResources) GetOffset() *float32 { - if o == nil { - return nil - } - - return o.Offset +// SetItems gets a reference to the given []LabelResource and assigns it to the Items field. +func (o *LabelResources) SetItems(v []LabelResource) { + o.Items = v +} +// GetOffset returns the Offset field value if set, zero value otherwise. +func (o *LabelResources) GetOffset() float32 { + if o == nil || IsNil(o.Offset) { + var ret float32 + return ret + } + return *o.Offset } -// GetOffsetOk returns a tuple with the Offset field value +// GetOffsetOk returns a tuple with the Offset 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 *LabelResources) GetOffsetOk() (*float32, bool) { - if o == nil { + if o == nil || IsNil(o.Offset) { return nil, false } - return o.Offset, true } -// SetOffset sets field value -func (o *LabelResources) SetOffset(v float32) { - - o.Offset = &v - -} - // HasOffset returns a boolean if a field has been set. func (o *LabelResources) HasOffset() bool { - if o != nil && o.Offset != nil { + if o != nil && !IsNil(o.Offset) { return true } return false } -// GetLimit returns the Limit field value -// If the value is explicit nil, nil is returned -func (o *LabelResources) GetLimit() *float32 { - if o == nil { - return nil - } - - return o.Limit +// SetOffset gets a reference to the given float32 and assigns it to the Offset field. +func (o *LabelResources) SetOffset(v float32) { + o.Offset = &v +} +// GetLimit returns the Limit field value if set, zero value otherwise. +func (o *LabelResources) GetLimit() float32 { + if o == nil || IsNil(o.Limit) { + var ret float32 + return ret + } + return *o.Limit } -// GetLimitOk returns a tuple with the Limit field value +// GetLimitOk returns a tuple with the Limit 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 *LabelResources) GetLimitOk() (*float32, bool) { - if o == nil { + if o == nil || IsNil(o.Limit) { return nil, false } - return o.Limit, true } -// SetLimit sets field value -func (o *LabelResources) SetLimit(v float32) { - - o.Limit = &v - -} - // HasLimit returns a boolean if a field has been set. func (o *LabelResources) HasLimit() bool { - if o != nil && o.Limit != nil { + if o != nil && !IsNil(o.Limit) { return true } return false } -// GetLinks returns the Links field value -// If the value is explicit nil, nil is returned -func (o *LabelResources) GetLinks() *PaginationLinks { - if o == nil { - return nil - } - - return o.Links +// SetLimit gets a reference to the given float32 and assigns it to the Limit field. +func (o *LabelResources) SetLimit(v float32) { + o.Limit = &v +} +// GetLinks returns the Links field value if set, zero value otherwise. +func (o *LabelResources) GetLinks() PaginationLinks { + if o == nil || IsNil(o.Links) { + var ret PaginationLinks + return ret + } + return *o.Links } -// GetLinksOk returns a tuple with the Links field value +// GetLinksOk returns a tuple with the Links 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 *LabelResources) GetLinksOk() (*PaginationLinks, bool) { - if o == nil { + if o == nil || IsNil(o.Links) { return nil, false } - return o.Links, true } -// SetLinks sets field value -func (o *LabelResources) SetLinks(v PaginationLinks) { - - o.Links = &v - -} - // HasLinks returns a boolean if a field has been set. func (o *LabelResources) HasLinks() bool { - if o != nil && o.Links != nil { + if o != nil && !IsNil(o.Links) { return true } return false } +// SetLinks gets a reference to the given PaginationLinks and assigns it to the Links field. +func (o *LabelResources) SetLinks(v PaginationLinks) { + o.Links = &v +} + func (o LabelResources) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o LabelResources) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Items != nil { + if !IsNil(o.Items) { toSerialize["items"] = o.Items } - - if o.Offset != nil { + if !IsNil(o.Offset) { toSerialize["offset"] = o.Offset } - - if o.Limit != nil { + if !IsNil(o.Limit) { toSerialize["limit"] = o.Limit } - - if o.Links != nil { + if !IsNil(o.Links) { toSerialize["_links"] = o.Links } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableLabelResources struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_labels.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_labels.go similarity index 64% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_labels.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_labels.go index 833c9e244..dc50cc29b 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_labels.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_labels.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the Labels type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Labels{} + // Labels struct for Labels type Labels struct { // A unique representation of the label as a resource collection. @@ -23,7 +26,7 @@ type Labels struct { // URL to the collection representation (absolute path). Href *string `json:"href,omitempty"` // Array of items in the collection. - Items *[]Label `json:"items,omitempty"` + Items []Label `json:"items,omitempty"` } // NewLabels instantiates a new Labels object @@ -44,177 +47,157 @@ func NewLabelsWithDefaults() *Labels { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *Labels) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *Labels) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *Labels) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *Labels) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *Labels) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *Labels) GetType() *string { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Labels) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *Labels) 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 +// GetTypeOk returns a tuple with the Type 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 *Labels) GetTypeOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *Labels) SetType(v string) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *Labels) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *Labels) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *Labels) SetType(v string) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *Labels) 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 +// GetHrefOk returns a tuple with the Href 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 *Labels) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *Labels) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *Labels) HasHref() bool { - if o != nil && o.Href != nil { + if o != nil && !IsNil(o.Href) { return true } return false } -// GetItems returns the Items field value -// If the value is explicit nil, nil is returned -func (o *Labels) GetItems() *[]Label { - if o == nil { - return nil - } +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *Labels) SetHref(v string) { + o.Href = &v +} +// GetItems returns the Items field value if set, zero value otherwise. +func (o *Labels) GetItems() []Label { + if o == nil || IsNil(o.Items) { + var ret []Label + return ret + } return o.Items - } -// GetItemsOk returns a tuple with the Items field value +// GetItemsOk returns a tuple with the Items 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 *Labels) GetItemsOk() (*[]Label, bool) { - if o == nil { +func (o *Labels) GetItemsOk() ([]Label, bool) { + if o == nil || IsNil(o.Items) { return nil, false } - return o.Items, true } -// SetItems sets field value -func (o *Labels) SetItems(v []Label) { - - o.Items = &v - -} - // HasItems returns a boolean if a field has been set. func (o *Labels) HasItems() bool { - if o != nil && o.Items != nil { + if o != nil && !IsNil(o.Items) { return true } return false } +// SetItems gets a reference to the given []Label and assigns it to the Items field. +func (o *Labels) SetItems(v []Label) { + o.Items = v +} + func (o Labels) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Labels) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Items != nil { + if !IsNil(o.Items) { toSerialize["items"] = o.Items } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableLabels struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_lan.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_lan.go similarity index 62% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_lan.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_lan.go index a4d1f2a13..5af9bcd46 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_lan.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_lan.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the Lan type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Lan{} + // Lan struct for Lan type Lan struct { // The resource's unique identifier. @@ -23,7 +26,7 @@ type Lan struct { // URL to the object representation (absolute path). Href *string `json:"href,omitempty"` Metadata *DatacenterElementMetadata `json:"metadata,omitempty"` - Properties *LanProperties `json:"properties"` + Properties LanProperties `json:"properties"` Entities *LanEntities `json:"entities,omitempty"` } @@ -34,7 +37,7 @@ type Lan struct { func NewLan(properties LanProperties) *Lan { this := Lan{} - this.Properties = &properties + this.Properties = properties return &this } @@ -47,261 +50,217 @@ func NewLanWithDefaults() *Lan { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *Lan) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *Lan) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *Lan) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *Lan) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *Lan) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *Lan) GetType() *Type { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Lan) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *Lan) GetType() Type { + if o == nil || IsNil(o.Type) { + var ret Type + return ret + } + return *o.Type } -// GetTypeOk returns a tuple with the Type field value +// GetTypeOk returns a tuple with the Type 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 *Lan) GetTypeOk() (*Type, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *Lan) SetType(v Type) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *Lan) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *Lan) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given Type and assigns it to the Type field. +func (o *Lan) SetType(v Type) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *Lan) 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 +// GetHrefOk returns a tuple with the Href 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 *Lan) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *Lan) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *Lan) HasHref() bool { - if o != nil && o.Href != nil { + if o != nil && !IsNil(o.Href) { return true } return false } -// GetMetadata returns the Metadata field value -// If the value is explicit nil, nil is returned -func (o *Lan) GetMetadata() *DatacenterElementMetadata { - if o == nil { - return nil - } - - return o.Metadata +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *Lan) SetHref(v string) { + o.Href = &v +} +// GetMetadata returns the Metadata field value if set, zero value otherwise. +func (o *Lan) GetMetadata() DatacenterElementMetadata { + if o == nil || IsNil(o.Metadata) { + var ret DatacenterElementMetadata + return ret + } + return *o.Metadata } -// GetMetadataOk returns a tuple with the Metadata field value +// GetMetadataOk returns a tuple with the Metadata 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 *Lan) GetMetadataOk() (*DatacenterElementMetadata, bool) { - if o == nil { + if o == nil || IsNil(o.Metadata) { return nil, false } - return o.Metadata, true } -// SetMetadata sets field value -func (o *Lan) SetMetadata(v DatacenterElementMetadata) { - - o.Metadata = &v - -} - // HasMetadata returns a boolean if a field has been set. func (o *Lan) HasMetadata() bool { - if o != nil && o.Metadata != nil { + if o != nil && !IsNil(o.Metadata) { return true } return false } +// SetMetadata gets a reference to the given DatacenterElementMetadata and assigns it to the Metadata field. +func (o *Lan) SetMetadata(v DatacenterElementMetadata) { + o.Metadata = &v +} + // GetProperties returns the Properties field value -// If the value is explicit nil, nil is returned -func (o *Lan) GetProperties() *LanProperties { +func (o *Lan) GetProperties() LanProperties { if o == nil { - return nil + var ret LanProperties + return ret } return o.Properties - } // GetPropertiesOk returns a tuple with the Properties field value // 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 *Lan) GetPropertiesOk() (*LanProperties, bool) { if o == nil { return nil, false } - - return o.Properties, true + return &o.Properties, true } // SetProperties sets field value func (o *Lan) SetProperties(v LanProperties) { - - o.Properties = &v - -} - -// HasProperties returns a boolean if a field has been set. -func (o *Lan) HasProperties() bool { - if o != nil && o.Properties != nil { - return true - } - - return false + o.Properties = v } -// GetEntities returns the Entities field value -// If the value is explicit nil, nil is returned -func (o *Lan) GetEntities() *LanEntities { - if o == nil { - return nil +// GetEntities returns the Entities field value if set, zero value otherwise. +func (o *Lan) GetEntities() LanEntities { + if o == nil || IsNil(o.Entities) { + var ret LanEntities + return ret } - - return o.Entities - + return *o.Entities } -// GetEntitiesOk returns a tuple with the Entities field value +// GetEntitiesOk returns a tuple with the Entities 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 *Lan) GetEntitiesOk() (*LanEntities, bool) { - if o == nil { + if o == nil || IsNil(o.Entities) { return nil, false } - return o.Entities, true } -// SetEntities sets field value -func (o *Lan) SetEntities(v LanEntities) { - - o.Entities = &v - -} - // HasEntities returns a boolean if a field has been set. func (o *Lan) HasEntities() bool { - if o != nil && o.Entities != nil { + if o != nil && !IsNil(o.Entities) { return true } return false } +// SetEntities gets a reference to the given LanEntities and assigns it to the Entities field. +func (o *Lan) SetEntities(v LanEntities) { + o.Entities = &v +} + func (o Lan) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Lan) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Metadata != nil { + if !IsNil(o.Metadata) { toSerialize["metadata"] = o.Metadata } - - if o.Properties != nil { - toSerialize["properties"] = o.Properties - } - - if o.Entities != nil { + toSerialize["properties"] = o.Properties + if !IsNil(o.Entities) { toSerialize["entities"] = o.Entities } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableLan struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_lan_entities.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_lan_entities.go similarity index 78% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_lan_entities.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_lan_entities.go index 2fd4f036a..87f93101b 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_lan_entities.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_lan_entities.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the LanEntities type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &LanEntities{} + // LanEntities struct for LanEntities type LanEntities struct { Nics *LanNics `json:"nics,omitempty"` @@ -37,51 +40,52 @@ func NewLanEntitiesWithDefaults() *LanEntities { return &this } -// GetNics returns the Nics field value -// If the value is explicit nil, nil is returned -func (o *LanEntities) GetNics() *LanNics { - if o == nil { - return nil +// GetNics returns the Nics field value if set, zero value otherwise. +func (o *LanEntities) GetNics() LanNics { + if o == nil || IsNil(o.Nics) { + var ret LanNics + return ret } - - return o.Nics - + return *o.Nics } -// GetNicsOk returns a tuple with the Nics field value +// GetNicsOk returns a tuple with the Nics 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 *LanEntities) GetNicsOk() (*LanNics, bool) { - if o == nil { + if o == nil || IsNil(o.Nics) { return nil, false } - return o.Nics, true } -// SetNics sets field value -func (o *LanEntities) SetNics(v LanNics) { - - o.Nics = &v - -} - // HasNics returns a boolean if a field has been set. func (o *LanEntities) HasNics() bool { - if o != nil && o.Nics != nil { + if o != nil && !IsNil(o.Nics) { return true } return false } +// SetNics gets a reference to the given LanNics and assigns it to the Nics field. +func (o *LanEntities) SetNics(v LanNics) { + o.Nics = &v +} + func (o LanEntities) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o LanEntities) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Nics != nil { + if !IsNil(o.Nics) { toSerialize["nics"] = o.Nics } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableLanEntities struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_lan_nics.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_lan_nics.go similarity index 60% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_lan_nics.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_lan_nics.go index f318facfe..6e7e98050 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_lan_nics.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_lan_nics.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the LanNics type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &LanNics{} + // LanNics struct for LanNics type LanNics struct { // The resource's unique identifier. @@ -23,7 +26,7 @@ type LanNics struct { // URL to the object representation (absolute path). Href *string `json:"href,omitempty"` // Array of items in the collection. - Items *[]Nic `json:"items,omitempty"` + Items []Nic `json:"items,omitempty"` // The offset (if specified in the request). Offset *float32 `json:"offset,omitempty"` // The limit (if specified in the request). @@ -49,303 +52,262 @@ func NewLanNicsWithDefaults() *LanNics { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *LanNics) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *LanNics) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *LanNics) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *LanNics) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *LanNics) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *LanNics) GetType() *Type { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *LanNics) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *LanNics) GetType() Type { + if o == nil || IsNil(o.Type) { + var ret Type + return ret + } + return *o.Type } -// GetTypeOk returns a tuple with the Type field value +// GetTypeOk returns a tuple with the Type 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 *LanNics) GetTypeOk() (*Type, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *LanNics) SetType(v Type) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *LanNics) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *LanNics) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given Type and assigns it to the Type field. +func (o *LanNics) SetType(v Type) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *LanNics) 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 +// GetHrefOk returns a tuple with the Href 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 *LanNics) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *LanNics) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *LanNics) HasHref() bool { - if o != nil && o.Href != nil { + if o != nil && !IsNil(o.Href) { return true } return false } -// GetItems returns the Items field value -// If the value is explicit nil, nil is returned -func (o *LanNics) GetItems() *[]Nic { - if o == nil { - return nil - } +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *LanNics) SetHref(v string) { + o.Href = &v +} +// GetItems returns the Items field value if set, zero value otherwise. +func (o *LanNics) GetItems() []Nic { + if o == nil || IsNil(o.Items) { + var ret []Nic + return ret + } return o.Items - } -// GetItemsOk returns a tuple with the Items field value +// GetItemsOk returns a tuple with the Items 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 *LanNics) GetItemsOk() (*[]Nic, bool) { - if o == nil { +func (o *LanNics) GetItemsOk() ([]Nic, bool) { + if o == nil || IsNil(o.Items) { return nil, false } - return o.Items, true } -// SetItems sets field value -func (o *LanNics) SetItems(v []Nic) { - - o.Items = &v - -} - // HasItems returns a boolean if a field has been set. func (o *LanNics) HasItems() bool { - if o != nil && o.Items != nil { + if o != nil && !IsNil(o.Items) { return true } return false } -// GetOffset returns the Offset field value -// If the value is explicit nil, nil is returned -func (o *LanNics) GetOffset() *float32 { - if o == nil { - return nil - } - - return o.Offset +// SetItems gets a reference to the given []Nic and assigns it to the Items field. +func (o *LanNics) SetItems(v []Nic) { + o.Items = v +} +// GetOffset returns the Offset field value if set, zero value otherwise. +func (o *LanNics) GetOffset() float32 { + if o == nil || IsNil(o.Offset) { + var ret float32 + return ret + } + return *o.Offset } -// GetOffsetOk returns a tuple with the Offset field value +// GetOffsetOk returns a tuple with the Offset 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 *LanNics) GetOffsetOk() (*float32, bool) { - if o == nil { + if o == nil || IsNil(o.Offset) { return nil, false } - return o.Offset, true } -// SetOffset sets field value -func (o *LanNics) SetOffset(v float32) { - - o.Offset = &v - -} - // HasOffset returns a boolean if a field has been set. func (o *LanNics) HasOffset() bool { - if o != nil && o.Offset != nil { + if o != nil && !IsNil(o.Offset) { return true } return false } -// GetLimit returns the Limit field value -// If the value is explicit nil, nil is returned -func (o *LanNics) GetLimit() *float32 { - if o == nil { - return nil - } - - return o.Limit +// SetOffset gets a reference to the given float32 and assigns it to the Offset field. +func (o *LanNics) SetOffset(v float32) { + o.Offset = &v +} +// GetLimit returns the Limit field value if set, zero value otherwise. +func (o *LanNics) GetLimit() float32 { + if o == nil || IsNil(o.Limit) { + var ret float32 + return ret + } + return *o.Limit } -// GetLimitOk returns a tuple with the Limit field value +// GetLimitOk returns a tuple with the Limit 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 *LanNics) GetLimitOk() (*float32, bool) { - if o == nil { + if o == nil || IsNil(o.Limit) { return nil, false } - return o.Limit, true } -// SetLimit sets field value -func (o *LanNics) SetLimit(v float32) { - - o.Limit = &v - -} - // HasLimit returns a boolean if a field has been set. func (o *LanNics) HasLimit() bool { - if o != nil && o.Limit != nil { + if o != nil && !IsNil(o.Limit) { return true } return false } -// GetLinks returns the Links field value -// If the value is explicit nil, nil is returned -func (o *LanNics) GetLinks() *PaginationLinks { - if o == nil { - return nil - } - - return o.Links +// SetLimit gets a reference to the given float32 and assigns it to the Limit field. +func (o *LanNics) SetLimit(v float32) { + o.Limit = &v +} +// GetLinks returns the Links field value if set, zero value otherwise. +func (o *LanNics) GetLinks() PaginationLinks { + if o == nil || IsNil(o.Links) { + var ret PaginationLinks + return ret + } + return *o.Links } -// GetLinksOk returns a tuple with the Links field value +// GetLinksOk returns a tuple with the Links 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 *LanNics) GetLinksOk() (*PaginationLinks, bool) { - if o == nil { + if o == nil || IsNil(o.Links) { return nil, false } - return o.Links, true } -// SetLinks sets field value -func (o *LanNics) SetLinks(v PaginationLinks) { - - o.Links = &v - -} - // HasLinks returns a boolean if a field has been set. func (o *LanNics) HasLinks() bool { - if o != nil && o.Links != nil { + if o != nil && !IsNil(o.Links) { return true } return false } +// SetLinks gets a reference to the given PaginationLinks and assigns it to the Links field. +func (o *LanNics) SetLinks(v PaginationLinks) { + o.Links = &v +} + func (o LanNics) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o LanNics) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Items != nil { + if !IsNil(o.Items) { toSerialize["items"] = o.Items } - - if o.Offset != nil { + if !IsNil(o.Offset) { toSerialize["offset"] = o.Offset } - - if o.Limit != nil { + if !IsNil(o.Limit) { toSerialize["limit"] = o.Limit } - - if o.Links != nil { + if !IsNil(o.Links) { toSerialize["_links"] = o.Links } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableLanNics struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_lan_properties.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_lan_properties.go similarity index 56% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_lan_properties.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_lan_properties.go index 909c1badd..105d4b576 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_lan_properties.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_lan_properties.go @@ -14,22 +14,25 @@ import ( "encoding/json" ) +// checks if the LanProperties type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &LanProperties{} + // LanProperties struct for LanProperties type LanProperties struct { // The name of the resource. Name *string `json:"name,omitempty"` // IP failover configurations for lan - IpFailover *[]IPFailover `json:"ipFailover,omitempty"` + IpFailover []IPFailover `json:"ipFailover,omitempty"` // For public LANs this property is null, for private LANs it contains the private IPv4 CIDR range. This property is a read only property. - // to set this field to `nil` in order to be marshalled, the explicit nil address `Nilstring` can be used, or the setter `SetIpv4CidrBlockNil` - Ipv4CidrBlock *string `json:"ipv4CidrBlock,omitempty"` + Ipv4CidrBlock NullableString `json:"ipv4CidrBlock,omitempty"` // For a GET request, this value is either 'null' or contains the LAN's /64 IPv6 CIDR block if this LAN is IPv6 enabled. For POST/PUT/PATCH requests, 'AUTO' will result in enabling this LAN for IPv6 and automatically assign a /64 IPv6 CIDR block to this LAN and /80 IPv6 CIDR blocks to the NICs and one /128 IPv6 address to each connected NIC. If you choose the IPv6 CIDR block for the LAN on your own, then you must provide a /64 block, which is inside the IPv6 CIDR block of the virtual datacenter and unique inside all LANs from this virtual datacenter. If you enable IPv6 on a LAN with NICs, those NICs will get a /80 IPv6 CIDR block and one IPv6 address assigned to each automatically, unless you specify them explicitly on the LAN and on the NICs. A virtual data center is limited to a maximum of 256 IPv6-enabled LANs. - // to set this field to `nil` in order to be marshalled, the explicit nil address `Nilstring` can be used, or the setter `SetIpv6CidrBlockNil` - Ipv6CidrBlock *string `json:"ipv6CidrBlock,omitempty"` + Ipv6CidrBlock NullableString `json:"ipv6CidrBlock,omitempty"` // The unique identifier of the Cross Connect the LAN is connected to, if any. It needs to be ensured that IP addresses of the NICs of all LANs connected to a given Cross Connect is not duplicated and belongs to the same subnet range. Pcc *string `json:"pcc,omitempty"` // Indicates if the LAN is connected to the internet or not. Public *bool `json:"public,omitempty"` + // The VNI value that is assigned to the LAN. + Vni *int32 `json:"vni,omitempty"` } // NewLanProperties instantiates a new LanProperties object @@ -50,274 +53,284 @@ func NewLanPropertiesWithDefaults() *LanProperties { return &this } -// GetName returns the Name field value -// If the value is explicit nil, nil is returned -func (o *LanProperties) GetName() *string { - if o == nil { - return nil +// GetName returns the Name field value if set, zero value otherwise. +func (o *LanProperties) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret } - - return o.Name - + return *o.Name } -// GetNameOk returns a tuple with the Name field value +// GetNameOk returns a tuple with the Name 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 *LanProperties) GetNameOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Name) { return nil, false } - return o.Name, true } -// SetName sets field value -func (o *LanProperties) SetName(v string) { - - o.Name = &v - -} - // HasName returns a boolean if a field has been set. func (o *LanProperties) HasName() bool { - if o != nil && o.Name != nil { + if o != nil && !IsNil(o.Name) { return true } return false } -// GetIpFailover returns the IpFailover field value -// If the value is explicit nil, nil is returned -func (o *LanProperties) GetIpFailover() *[]IPFailover { - if o == nil { - return nil - } +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *LanProperties) SetName(v string) { + o.Name = &v +} +// GetIpFailover returns the IpFailover field value if set, zero value otherwise. +func (o *LanProperties) GetIpFailover() []IPFailover { + if o == nil || IsNil(o.IpFailover) { + var ret []IPFailover + return ret + } return o.IpFailover - } -// GetIpFailoverOk returns a tuple with the IpFailover field value +// GetIpFailoverOk returns a tuple with the IpFailover 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 *LanProperties) GetIpFailoverOk() (*[]IPFailover, bool) { - if o == nil { +func (o *LanProperties) GetIpFailoverOk() ([]IPFailover, bool) { + if o == nil || IsNil(o.IpFailover) { return nil, false } - return o.IpFailover, true } -// SetIpFailover sets field value -func (o *LanProperties) SetIpFailover(v []IPFailover) { - - o.IpFailover = &v - -} - // HasIpFailover returns a boolean if a field has been set. func (o *LanProperties) HasIpFailover() bool { - if o != nil && o.IpFailover != nil { + if o != nil && !IsNil(o.IpFailover) { return true } return false } -// GetIpv4CidrBlock returns the Ipv4CidrBlock field value -// If the value is explicit nil, nil is returned -func (o *LanProperties) GetIpv4CidrBlock() *string { - if o == nil { - return nil - } - - return o.Ipv4CidrBlock +// SetIpFailover gets a reference to the given []IPFailover and assigns it to the IpFailover field. +func (o *LanProperties) SetIpFailover(v []IPFailover) { + o.IpFailover = v +} +// GetIpv4CidrBlock returns the Ipv4CidrBlock field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *LanProperties) GetIpv4CidrBlock() string { + if o == nil || IsNil(o.Ipv4CidrBlock.Get()) { + var ret string + return ret + } + return *o.Ipv4CidrBlock.Get() } -// GetIpv4CidrBlockOk returns a tuple with the Ipv4CidrBlock field value +// GetIpv4CidrBlockOk returns a tuple with the Ipv4CidrBlock 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 *LanProperties) GetIpv4CidrBlockOk() (*string, bool) { if o == nil { return nil, false } - - return o.Ipv4CidrBlock, true -} - -// SetIpv4CidrBlock sets field value -func (o *LanProperties) SetIpv4CidrBlock(v string) { - - o.Ipv4CidrBlock = &v - -} - -// sets Ipv4CidrBlock to the explicit address that will be encoded as nil when marshaled -func (o *LanProperties) SetIpv4CidrBlockNil() { - o.Ipv4CidrBlock = &Nilstring + return o.Ipv4CidrBlock.Get(), o.Ipv4CidrBlock.IsSet() } // HasIpv4CidrBlock returns a boolean if a field has been set. func (o *LanProperties) HasIpv4CidrBlock() bool { - if o != nil && o.Ipv4CidrBlock != nil { + if o != nil && o.Ipv4CidrBlock.IsSet() { return true } return false } -// GetIpv6CidrBlock returns the Ipv6CidrBlock field value -// If the value is explicit nil, nil is returned -func (o *LanProperties) GetIpv6CidrBlock() *string { - if o == nil { - return nil - } +// SetIpv4CidrBlock gets a reference to the given NullableString and assigns it to the Ipv4CidrBlock field. +func (o *LanProperties) SetIpv4CidrBlock(v string) { + o.Ipv4CidrBlock.Set(&v) +} + +// SetIpv4CidrBlockNil sets the value for Ipv4CidrBlock to be an explicit nil +func (o *LanProperties) SetIpv4CidrBlockNil() { + o.Ipv4CidrBlock.Set(nil) +} - return o.Ipv6CidrBlock +// UnsetIpv4CidrBlock ensures that no value is present for Ipv4CidrBlock, not even an explicit nil +func (o *LanProperties) UnsetIpv4CidrBlock() { + o.Ipv4CidrBlock.Unset() +} +// GetIpv6CidrBlock returns the Ipv6CidrBlock field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *LanProperties) GetIpv6CidrBlock() string { + if o == nil || IsNil(o.Ipv6CidrBlock.Get()) { + var ret string + return ret + } + return *o.Ipv6CidrBlock.Get() } -// GetIpv6CidrBlockOk returns a tuple with the Ipv6CidrBlock field value +// GetIpv6CidrBlockOk returns a tuple with the Ipv6CidrBlock 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 *LanProperties) GetIpv6CidrBlockOk() (*string, bool) { if o == nil { return nil, false } - - return o.Ipv6CidrBlock, true -} - -// SetIpv6CidrBlock sets field value -func (o *LanProperties) SetIpv6CidrBlock(v string) { - - o.Ipv6CidrBlock = &v - -} - -// sets Ipv6CidrBlock to the explicit address that will be encoded as nil when marshaled -func (o *LanProperties) SetIpv6CidrBlockNil() { - o.Ipv6CidrBlock = &Nilstring + return o.Ipv6CidrBlock.Get(), o.Ipv6CidrBlock.IsSet() } // HasIpv6CidrBlock returns a boolean if a field has been set. func (o *LanProperties) HasIpv6CidrBlock() bool { - if o != nil && o.Ipv6CidrBlock != nil { + if o != nil && o.Ipv6CidrBlock.IsSet() { return true } return false } -// GetPcc returns the Pcc field value -// If the value is explicit nil, nil is returned -func (o *LanProperties) GetPcc() *string { - if o == nil { - return nil - } +// SetIpv6CidrBlock gets a reference to the given NullableString and assigns it to the Ipv6CidrBlock field. +func (o *LanProperties) SetIpv6CidrBlock(v string) { + o.Ipv6CidrBlock.Set(&v) +} - return o.Pcc +// SetIpv6CidrBlockNil sets the value for Ipv6CidrBlock to be an explicit nil +func (o *LanProperties) SetIpv6CidrBlockNil() { + o.Ipv6CidrBlock.Set(nil) +} +// UnsetIpv6CidrBlock ensures that no value is present for Ipv6CidrBlock, not even an explicit nil +func (o *LanProperties) UnsetIpv6CidrBlock() { + o.Ipv6CidrBlock.Unset() } -// GetPccOk returns a tuple with the Pcc field value +// GetPcc returns the Pcc field value if set, zero value otherwise. +func (o *LanProperties) GetPcc() string { + if o == nil || IsNil(o.Pcc) { + var ret string + return ret + } + return *o.Pcc +} + +// GetPccOk returns a tuple with the Pcc 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 *LanProperties) GetPccOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Pcc) { return nil, false } - return o.Pcc, true } -// SetPcc sets field value -func (o *LanProperties) SetPcc(v string) { - - o.Pcc = &v - -} - // HasPcc returns a boolean if a field has been set. func (o *LanProperties) HasPcc() bool { - if o != nil && o.Pcc != nil { + if o != nil && !IsNil(o.Pcc) { return true } return false } -// GetPublic returns the Public field value -// If the value is explicit nil, nil is returned -func (o *LanProperties) GetPublic() *bool { - if o == nil { - return nil - } - - return o.Public +// SetPcc gets a reference to the given string and assigns it to the Pcc field. +func (o *LanProperties) SetPcc(v string) { + o.Pcc = &v +} +// GetPublic returns the Public field value if set, zero value otherwise. +func (o *LanProperties) 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 +// GetPublicOk returns a tuple with the Public 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 *LanProperties) GetPublicOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.Public) { return nil, false } - return o.Public, true } -// SetPublic sets field value -func (o *LanProperties) SetPublic(v bool) { +// HasPublic returns a boolean if a field has been set. +func (o *LanProperties) 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 *LanProperties) SetPublic(v bool) { o.Public = &v +} +// GetVni returns the Vni field value if set, zero value otherwise. +func (o *LanProperties) GetVni() int32 { + if o == nil || IsNil(o.Vni) { + var ret int32 + return ret + } + return *o.Vni } -// HasPublic returns a boolean if a field has been set. -func (o *LanProperties) HasPublic() bool { - if o != nil && o.Public != nil { +// GetVniOk returns a tuple with the Vni field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LanProperties) GetVniOk() (*int32, bool) { + if o == nil || IsNil(o.Vni) { + return nil, false + } + return o.Vni, true +} + +// HasVni returns a boolean if a field has been set. +func (o *LanProperties) HasVni() bool { + if o != nil && !IsNil(o.Vni) { return true } return false } +// SetVni gets a reference to the given int32 and assigns it to the Vni field. +func (o *LanProperties) SetVni(v int32) { + o.Vni = &v +} + func (o LanProperties) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o LanProperties) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Name != nil { + if !IsNil(o.Name) { toSerialize["name"] = o.Name } - - if o.IpFailover != nil { + if !IsNil(o.IpFailover) { toSerialize["ipFailover"] = o.IpFailover } - - if o.Ipv4CidrBlock == &Nilstring { - toSerialize["ipv4CidrBlock"] = nil - } else if o.Ipv4CidrBlock != nil { - toSerialize["ipv4CidrBlock"] = o.Ipv4CidrBlock + if o.Ipv4CidrBlock.IsSet() { + toSerialize["ipv4CidrBlock"] = o.Ipv4CidrBlock.Get() } - - if o.Ipv6CidrBlock == &Nilstring { - toSerialize["ipv6CidrBlock"] = nil - } else if o.Ipv6CidrBlock != nil { - toSerialize["ipv6CidrBlock"] = o.Ipv6CidrBlock + if o.Ipv6CidrBlock.IsSet() { + toSerialize["ipv6CidrBlock"] = o.Ipv6CidrBlock.Get() } - if o.Pcc != nil { + if !IsNil(o.Pcc) { toSerialize["pcc"] = o.Pcc } - - if o.Public != nil { + if !IsNil(o.Public) { toSerialize["public"] = o.Public } - - return json.Marshal(toSerialize) + if !IsNil(o.Vni) { + toSerialize["vni"] = o.Vni + } + return toSerialize, nil } type NullableLanProperties struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_lans.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_lans.go similarity index 59% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_lans.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_lans.go index 767d693d2..772bee41a 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_lans.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_lans.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the Lans type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Lans{} + // Lans struct for Lans type Lans struct { // The resource's unique identifier. @@ -23,7 +26,7 @@ type Lans struct { // URL to the object representation (absolute path). Href *string `json:"href,omitempty"` // Array of items in the collection. - Items *[]Lan `json:"items,omitempty"` + Items []Lan `json:"items,omitempty"` // The offset (if specified in the request). Offset *float32 `json:"offset,omitempty"` // The limit (if specified in the request). @@ -49,303 +52,262 @@ func NewLansWithDefaults() *Lans { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *Lans) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *Lans) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *Lans) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *Lans) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *Lans) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *Lans) GetType() *Type { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Lans) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *Lans) GetType() Type { + if o == nil || IsNil(o.Type) { + var ret Type + return ret + } + return *o.Type } -// GetTypeOk returns a tuple with the Type field value +// GetTypeOk returns a tuple with the Type 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 *Lans) GetTypeOk() (*Type, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *Lans) SetType(v Type) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *Lans) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *Lans) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given Type and assigns it to the Type field. +func (o *Lans) SetType(v Type) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *Lans) 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 +// GetHrefOk returns a tuple with the Href 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 *Lans) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *Lans) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *Lans) HasHref() bool { - if o != nil && o.Href != nil { + if o != nil && !IsNil(o.Href) { return true } return false } -// GetItems returns the Items field value -// If the value is explicit nil, nil is returned -func (o *Lans) GetItems() *[]Lan { - if o == nil { - return nil - } +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *Lans) SetHref(v string) { + o.Href = &v +} +// GetItems returns the Items field value if set, zero value otherwise. +func (o *Lans) GetItems() []Lan { + if o == nil || IsNil(o.Items) { + var ret []Lan + return ret + } return o.Items - } -// GetItemsOk returns a tuple with the Items field value +// GetItemsOk returns a tuple with the Items 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 *Lans) GetItemsOk() (*[]Lan, bool) { - if o == nil { +func (o *Lans) GetItemsOk() ([]Lan, bool) { + if o == nil || IsNil(o.Items) { return nil, false } - return o.Items, true } -// SetItems sets field value -func (o *Lans) SetItems(v []Lan) { - - o.Items = &v - -} - // HasItems returns a boolean if a field has been set. func (o *Lans) HasItems() bool { - if o != nil && o.Items != nil { + if o != nil && !IsNil(o.Items) { return true } return false } -// GetOffset returns the Offset field value -// If the value is explicit nil, nil is returned -func (o *Lans) GetOffset() *float32 { - if o == nil { - return nil - } - - return o.Offset +// SetItems gets a reference to the given []Lan and assigns it to the Items field. +func (o *Lans) SetItems(v []Lan) { + o.Items = v +} +// GetOffset returns the Offset field value if set, zero value otherwise. +func (o *Lans) GetOffset() float32 { + if o == nil || IsNil(o.Offset) { + var ret float32 + return ret + } + return *o.Offset } -// GetOffsetOk returns a tuple with the Offset field value +// GetOffsetOk returns a tuple with the Offset 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 *Lans) GetOffsetOk() (*float32, bool) { - if o == nil { + if o == nil || IsNil(o.Offset) { return nil, false } - return o.Offset, true } -// SetOffset sets field value -func (o *Lans) SetOffset(v float32) { - - o.Offset = &v - -} - // HasOffset returns a boolean if a field has been set. func (o *Lans) HasOffset() bool { - if o != nil && o.Offset != nil { + if o != nil && !IsNil(o.Offset) { return true } return false } -// GetLimit returns the Limit field value -// If the value is explicit nil, nil is returned -func (o *Lans) GetLimit() *float32 { - if o == nil { - return nil - } - - return o.Limit +// SetOffset gets a reference to the given float32 and assigns it to the Offset field. +func (o *Lans) SetOffset(v float32) { + o.Offset = &v +} +// GetLimit returns the Limit field value if set, zero value otherwise. +func (o *Lans) GetLimit() float32 { + if o == nil || IsNil(o.Limit) { + var ret float32 + return ret + } + return *o.Limit } -// GetLimitOk returns a tuple with the Limit field value +// GetLimitOk returns a tuple with the Limit 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 *Lans) GetLimitOk() (*float32, bool) { - if o == nil { + if o == nil || IsNil(o.Limit) { return nil, false } - return o.Limit, true } -// SetLimit sets field value -func (o *Lans) SetLimit(v float32) { - - o.Limit = &v - -} - // HasLimit returns a boolean if a field has been set. func (o *Lans) HasLimit() bool { - if o != nil && o.Limit != nil { + if o != nil && !IsNil(o.Limit) { return true } return false } -// GetLinks returns the Links field value -// If the value is explicit nil, nil is returned -func (o *Lans) GetLinks() *PaginationLinks { - if o == nil { - return nil - } - - return o.Links +// SetLimit gets a reference to the given float32 and assigns it to the Limit field. +func (o *Lans) SetLimit(v float32) { + o.Limit = &v +} +// GetLinks returns the Links field value if set, zero value otherwise. +func (o *Lans) GetLinks() PaginationLinks { + if o == nil || IsNil(o.Links) { + var ret PaginationLinks + return ret + } + return *o.Links } -// GetLinksOk returns a tuple with the Links field value +// GetLinksOk returns a tuple with the Links 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 *Lans) GetLinksOk() (*PaginationLinks, bool) { - if o == nil { + if o == nil || IsNil(o.Links) { return nil, false } - return o.Links, true } -// SetLinks sets field value -func (o *Lans) SetLinks(v PaginationLinks) { - - o.Links = &v - -} - // HasLinks returns a boolean if a field has been set. func (o *Lans) HasLinks() bool { - if o != nil && o.Links != nil { + if o != nil && !IsNil(o.Links) { return true } return false } +// SetLinks gets a reference to the given PaginationLinks and assigns it to the Links field. +func (o *Lans) SetLinks(v PaginationLinks) { + o.Links = &v +} + func (o Lans) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Lans) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Items != nil { + if !IsNil(o.Items) { toSerialize["items"] = o.Items } - - if o.Offset != nil { + if !IsNil(o.Offset) { toSerialize["offset"] = o.Offset } - - if o.Limit != nil { + if !IsNil(o.Limit) { toSerialize["limit"] = o.Limit } - - if o.Links != nil { + if !IsNil(o.Links) { toSerialize["_links"] = o.Links } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableLans struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_list_of_ids.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_list_of_ids.go similarity index 83% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_list_of_ids.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_list_of_ids.go index 060afe60c..dbcbe8d8b 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_list_of_ids.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_list_of_ids.go @@ -14,10 +14,13 @@ import ( "encoding/json" ) +// checks if the ListOfIds type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ListOfIds{} + // ListOfIds struct for ListOfIds type ListOfIds struct { // The list of IDs - Ids *[]string `json:"ids"` + Ids []string `json:"ids"` } // NewListOfIds instantiates a new ListOfIds object @@ -27,7 +30,7 @@ type ListOfIds struct { func NewListOfIds(ids []string) *ListOfIds { this := ListOfIds{} - this.Ids = &ids + this.Ids = ids return &this } @@ -41,50 +44,41 @@ func NewListOfIdsWithDefaults() *ListOfIds { } // GetIds returns the Ids field value -// If the value is explicit nil, nil is returned -func (o *ListOfIds) GetIds() *[]string { +func (o *ListOfIds) GetIds() []string { if o == nil { - return nil + var ret []string + return ret } return o.Ids - } // GetIdsOk returns a tuple with the Ids field value // 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 *ListOfIds) GetIdsOk() (*[]string, bool) { +func (o *ListOfIds) GetIdsOk() ([]string, bool) { if o == nil { return nil, false } - return o.Ids, true } // SetIds sets field value func (o *ListOfIds) SetIds(v []string) { - - o.Ids = &v - + o.Ids = v } -// HasIds returns a boolean if a field has been set. -func (o *ListOfIds) HasIds() bool { - if o != nil && o.Ids != nil { - return true +func (o ListOfIds) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } - - return false + return json.Marshal(toSerialize) } -func (o ListOfIds) MarshalJSON() ([]byte, error) { +func (o ListOfIds) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Ids != nil { - toSerialize["ids"] = o.Ids - } - - return json.Marshal(toSerialize) + toSerialize["ids"] = o.Ids + return toSerialize, nil } type NullableListOfIds struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_loadbalancer.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_loadbalancer.go similarity index 63% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_loadbalancer.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_loadbalancer.go index 47b6d887c..f62c121ce 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_loadbalancer.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_loadbalancer.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the Loadbalancer type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Loadbalancer{} + // Loadbalancer struct for Loadbalancer type Loadbalancer struct { // The resource's unique identifier. @@ -23,7 +26,7 @@ type Loadbalancer struct { // URL to the object representation (absolute path). Href *string `json:"href,omitempty"` Metadata *DatacenterElementMetadata `json:"metadata,omitempty"` - Properties *LoadbalancerProperties `json:"properties"` + Properties LoadbalancerProperties `json:"properties"` Entities *LoadbalancerEntities `json:"entities,omitempty"` } @@ -34,7 +37,7 @@ type Loadbalancer struct { func NewLoadbalancer(properties LoadbalancerProperties) *Loadbalancer { this := Loadbalancer{} - this.Properties = &properties + this.Properties = properties return &this } @@ -47,261 +50,217 @@ func NewLoadbalancerWithDefaults() *Loadbalancer { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *Loadbalancer) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *Loadbalancer) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *Loadbalancer) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *Loadbalancer) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *Loadbalancer) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *Loadbalancer) GetType() *Type { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Loadbalancer) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *Loadbalancer) GetType() Type { + if o == nil || IsNil(o.Type) { + var ret Type + return ret + } + return *o.Type } -// GetTypeOk returns a tuple with the Type field value +// GetTypeOk returns a tuple with the Type 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 *Loadbalancer) GetTypeOk() (*Type, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *Loadbalancer) SetType(v Type) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *Loadbalancer) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *Loadbalancer) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given Type and assigns it to the Type field. +func (o *Loadbalancer) SetType(v Type) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *Loadbalancer) 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 +// GetHrefOk returns a tuple with the Href 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 *Loadbalancer) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *Loadbalancer) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *Loadbalancer) HasHref() bool { - if o != nil && o.Href != nil { + if o != nil && !IsNil(o.Href) { return true } return false } -// GetMetadata returns the Metadata field value -// If the value is explicit nil, nil is returned -func (o *Loadbalancer) GetMetadata() *DatacenterElementMetadata { - if o == nil { - return nil - } - - return o.Metadata +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *Loadbalancer) SetHref(v string) { + o.Href = &v +} +// GetMetadata returns the Metadata field value if set, zero value otherwise. +func (o *Loadbalancer) GetMetadata() DatacenterElementMetadata { + if o == nil || IsNil(o.Metadata) { + var ret DatacenterElementMetadata + return ret + } + return *o.Metadata } -// GetMetadataOk returns a tuple with the Metadata field value +// GetMetadataOk returns a tuple with the Metadata 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 *Loadbalancer) GetMetadataOk() (*DatacenterElementMetadata, bool) { - if o == nil { + if o == nil || IsNil(o.Metadata) { return nil, false } - return o.Metadata, true } -// SetMetadata sets field value -func (o *Loadbalancer) SetMetadata(v DatacenterElementMetadata) { - - o.Metadata = &v - -} - // HasMetadata returns a boolean if a field has been set. func (o *Loadbalancer) HasMetadata() bool { - if o != nil && o.Metadata != nil { + if o != nil && !IsNil(o.Metadata) { return true } return false } +// SetMetadata gets a reference to the given DatacenterElementMetadata and assigns it to the Metadata field. +func (o *Loadbalancer) SetMetadata(v DatacenterElementMetadata) { + o.Metadata = &v +} + // GetProperties returns the Properties field value -// If the value is explicit nil, nil is returned -func (o *Loadbalancer) GetProperties() *LoadbalancerProperties { +func (o *Loadbalancer) GetProperties() LoadbalancerProperties { if o == nil { - return nil + var ret LoadbalancerProperties + return ret } return o.Properties - } // GetPropertiesOk returns a tuple with the Properties field value // 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 *Loadbalancer) GetPropertiesOk() (*LoadbalancerProperties, bool) { if o == nil { return nil, false } - - return o.Properties, true + return &o.Properties, true } // SetProperties sets field value func (o *Loadbalancer) SetProperties(v LoadbalancerProperties) { - - o.Properties = &v - -} - -// HasProperties returns a boolean if a field has been set. -func (o *Loadbalancer) HasProperties() bool { - if o != nil && o.Properties != nil { - return true - } - - return false + o.Properties = v } -// GetEntities returns the Entities field value -// If the value is explicit nil, nil is returned -func (o *Loadbalancer) GetEntities() *LoadbalancerEntities { - if o == nil { - return nil +// GetEntities returns the Entities field value if set, zero value otherwise. +func (o *Loadbalancer) GetEntities() LoadbalancerEntities { + if o == nil || IsNil(o.Entities) { + var ret LoadbalancerEntities + return ret } - - return o.Entities - + return *o.Entities } -// GetEntitiesOk returns a tuple with the Entities field value +// GetEntitiesOk returns a tuple with the Entities 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 *Loadbalancer) GetEntitiesOk() (*LoadbalancerEntities, bool) { - if o == nil { + if o == nil || IsNil(o.Entities) { return nil, false } - return o.Entities, true } -// SetEntities sets field value -func (o *Loadbalancer) SetEntities(v LoadbalancerEntities) { - - o.Entities = &v - -} - // HasEntities returns a boolean if a field has been set. func (o *Loadbalancer) HasEntities() bool { - if o != nil && o.Entities != nil { + if o != nil && !IsNil(o.Entities) { return true } return false } +// SetEntities gets a reference to the given LoadbalancerEntities and assigns it to the Entities field. +func (o *Loadbalancer) SetEntities(v LoadbalancerEntities) { + o.Entities = &v +} + func (o Loadbalancer) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Loadbalancer) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Metadata != nil { + if !IsNil(o.Metadata) { toSerialize["metadata"] = o.Metadata } - - if o.Properties != nil { - toSerialize["properties"] = o.Properties - } - - if o.Entities != nil { + toSerialize["properties"] = o.Properties + if !IsNil(o.Entities) { toSerialize["entities"] = o.Entities } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableLoadbalancer struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_loadbalancer_entities.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_loadbalancer_entities.go similarity index 78% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_loadbalancer_entities.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_loadbalancer_entities.go index 7b1525fc2..1a69899fa 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_loadbalancer_entities.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_loadbalancer_entities.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the LoadbalancerEntities type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &LoadbalancerEntities{} + // LoadbalancerEntities struct for LoadbalancerEntities type LoadbalancerEntities struct { Balancednics *BalancedNics `json:"balancednics,omitempty"` @@ -37,51 +40,52 @@ func NewLoadbalancerEntitiesWithDefaults() *LoadbalancerEntities { return &this } -// GetBalancednics returns the Balancednics field value -// If the value is explicit nil, nil is returned -func (o *LoadbalancerEntities) GetBalancednics() *BalancedNics { - if o == nil { - return nil +// GetBalancednics returns the Balancednics field value if set, zero value otherwise. +func (o *LoadbalancerEntities) GetBalancednics() BalancedNics { + if o == nil || IsNil(o.Balancednics) { + var ret BalancedNics + return ret } - - return o.Balancednics - + return *o.Balancednics } -// GetBalancednicsOk returns a tuple with the Balancednics field value +// GetBalancednicsOk returns a tuple with the Balancednics 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 *LoadbalancerEntities) GetBalancednicsOk() (*BalancedNics, bool) { - if o == nil { + if o == nil || IsNil(o.Balancednics) { return nil, false } - return o.Balancednics, true } -// SetBalancednics sets field value -func (o *LoadbalancerEntities) SetBalancednics(v BalancedNics) { - - o.Balancednics = &v - -} - // HasBalancednics returns a boolean if a field has been set. func (o *LoadbalancerEntities) HasBalancednics() bool { - if o != nil && o.Balancednics != nil { + if o != nil && !IsNil(o.Balancednics) { return true } return false } +// SetBalancednics gets a reference to the given BalancedNics and assigns it to the Balancednics field. +func (o *LoadbalancerEntities) SetBalancednics(v BalancedNics) { + o.Balancednics = &v +} + func (o LoadbalancerEntities) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o LoadbalancerEntities) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Balancednics != nil { + if !IsNil(o.Balancednics) { toSerialize["balancednics"] = o.Balancednics } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableLoadbalancerEntities struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_loadbalancer_properties.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_loadbalancer_properties.go similarity index 67% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_loadbalancer_properties.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_loadbalancer_properties.go index 408e4c936..e695a9ce8 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_loadbalancer_properties.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_loadbalancer_properties.go @@ -14,13 +14,15 @@ import ( "encoding/json" ) +// checks if the LoadbalancerProperties type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &LoadbalancerProperties{} + // LoadbalancerProperties struct for LoadbalancerProperties type LoadbalancerProperties struct { // The name of the resource. Name *string `json:"name,omitempty"` // IPv4 address of the loadbalancer. All attached NICs will inherit this IP. Leaving value null will assign IP automatically. - // to set this field to `nil` in order to be marshalled, the explicit nil address `Nilstring` can be used, or the setter `SetIpNil` - Ip *string `json:"ip,omitempty"` + Ip NullableString `json:"ip,omitempty"` // Indicates if the loadbalancer will reserve an IP using DHCP. Dhcp *bool `json:"dhcp,omitempty"` } @@ -43,141 +45,133 @@ func NewLoadbalancerPropertiesWithDefaults() *LoadbalancerProperties { return &this } -// GetName returns the Name field value -// If the value is explicit nil, nil is returned -func (o *LoadbalancerProperties) GetName() *string { - if o == nil { - return nil +// GetName returns the Name field value if set, zero value otherwise. +func (o *LoadbalancerProperties) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret } - - return o.Name - + return *o.Name } -// GetNameOk returns a tuple with the Name field value +// GetNameOk returns a tuple with the Name 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 *LoadbalancerProperties) GetNameOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Name) { return nil, false } - return o.Name, true } -// SetName sets field value -func (o *LoadbalancerProperties) SetName(v string) { - - o.Name = &v - -} - // HasName returns a boolean if a field has been set. func (o *LoadbalancerProperties) HasName() bool { - if o != nil && o.Name != nil { + if o != nil && !IsNil(o.Name) { return true } return false } -// GetIp returns the Ip field value -// If the value is explicit nil, nil is returned -func (o *LoadbalancerProperties) GetIp() *string { - if o == nil { - return nil - } - - return o.Ip +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *LoadbalancerProperties) SetName(v string) { + o.Name = &v +} +// GetIp returns the Ip field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *LoadbalancerProperties) GetIp() string { + if o == nil || IsNil(o.Ip.Get()) { + var ret string + return ret + } + return *o.Ip.Get() } -// GetIpOk returns a tuple with the Ip field value +// GetIpOk returns a tuple with the Ip 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 *LoadbalancerProperties) GetIpOk() (*string, bool) { if o == nil { return nil, false } - - return o.Ip, true -} - -// SetIp sets field value -func (o *LoadbalancerProperties) SetIp(v string) { - - o.Ip = &v - -} - -// sets Ip to the explicit address that will be encoded as nil when marshaled -func (o *LoadbalancerProperties) SetIpNil() { - o.Ip = &Nilstring + return o.Ip.Get(), o.Ip.IsSet() } // HasIp returns a boolean if a field has been set. func (o *LoadbalancerProperties) HasIp() bool { - if o != nil && o.Ip != nil { + if o != nil && o.Ip.IsSet() { return true } return false } -// GetDhcp returns the Dhcp field value -// If the value is explicit nil, nil is returned -func (o *LoadbalancerProperties) GetDhcp() *bool { - if o == nil { - return nil - } +// SetIp gets a reference to the given NullableString and assigns it to the Ip field. +func (o *LoadbalancerProperties) SetIp(v string) { + o.Ip.Set(&v) +} - return o.Dhcp +// SetIpNil sets the value for Ip to be an explicit nil +func (o *LoadbalancerProperties) SetIpNil() { + o.Ip.Set(nil) +} +// UnsetIp ensures that no value is present for Ip, not even an explicit nil +func (o *LoadbalancerProperties) UnsetIp() { + o.Ip.Unset() } -// GetDhcpOk returns a tuple with the Dhcp field value +// GetDhcp returns the Dhcp field value if set, zero value otherwise. +func (o *LoadbalancerProperties) GetDhcp() bool { + if o == nil || IsNil(o.Dhcp) { + var ret bool + return ret + } + return *o.Dhcp +} + +// GetDhcpOk returns a tuple with the Dhcp 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 *LoadbalancerProperties) GetDhcpOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.Dhcp) { return nil, false } - return o.Dhcp, true } -// SetDhcp sets field value -func (o *LoadbalancerProperties) SetDhcp(v bool) { - - o.Dhcp = &v - -} - // HasDhcp returns a boolean if a field has been set. func (o *LoadbalancerProperties) HasDhcp() bool { - if o != nil && o.Dhcp != nil { + if o != nil && !IsNil(o.Dhcp) { return true } return false } +// SetDhcp gets a reference to the given bool and assigns it to the Dhcp field. +func (o *LoadbalancerProperties) SetDhcp(v bool) { + o.Dhcp = &v +} + func (o LoadbalancerProperties) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o LoadbalancerProperties) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Name != nil { + if !IsNil(o.Name) { toSerialize["name"] = o.Name } - - if o.Ip == &Nilstring { - toSerialize["ip"] = nil - } else if o.Ip != nil { - toSerialize["ip"] = o.Ip + if o.Ip.IsSet() { + toSerialize["ip"] = o.Ip.Get() } - if o.Dhcp != nil { + if !IsNil(o.Dhcp) { toSerialize["dhcp"] = o.Dhcp } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableLoadbalancerProperties struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_loadbalancers.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_loadbalancers.go similarity index 60% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_loadbalancers.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_loadbalancers.go index 67cc3d56b..d7ace3168 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_loadbalancers.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_loadbalancers.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the Loadbalancers type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Loadbalancers{} + // Loadbalancers struct for Loadbalancers type Loadbalancers struct { // The resource's unique identifier. @@ -23,7 +26,7 @@ type Loadbalancers struct { // URL to the object representation (absolute path). Href *string `json:"href,omitempty"` // Array of items in the collection. - Items *[]Loadbalancer `json:"items,omitempty"` + Items []Loadbalancer `json:"items,omitempty"` // The offset (if specified in the request). Offset *float32 `json:"offset,omitempty"` // The limit (if specified in the request). @@ -49,303 +52,262 @@ func NewLoadbalancersWithDefaults() *Loadbalancers { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *Loadbalancers) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *Loadbalancers) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *Loadbalancers) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *Loadbalancers) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *Loadbalancers) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *Loadbalancers) GetType() *Type { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Loadbalancers) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *Loadbalancers) GetType() Type { + if o == nil || IsNil(o.Type) { + var ret Type + return ret + } + return *o.Type } -// GetTypeOk returns a tuple with the Type field value +// GetTypeOk returns a tuple with the Type 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 *Loadbalancers) GetTypeOk() (*Type, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *Loadbalancers) SetType(v Type) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *Loadbalancers) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *Loadbalancers) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given Type and assigns it to the Type field. +func (o *Loadbalancers) SetType(v Type) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *Loadbalancers) 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 +// GetHrefOk returns a tuple with the Href 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 *Loadbalancers) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *Loadbalancers) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *Loadbalancers) HasHref() bool { - if o != nil && o.Href != nil { + if o != nil && !IsNil(o.Href) { return true } return false } -// GetItems returns the Items field value -// If the value is explicit nil, nil is returned -func (o *Loadbalancers) GetItems() *[]Loadbalancer { - if o == nil { - return nil - } +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *Loadbalancers) SetHref(v string) { + o.Href = &v +} +// GetItems returns the Items field value if set, zero value otherwise. +func (o *Loadbalancers) GetItems() []Loadbalancer { + if o == nil || IsNil(o.Items) { + var ret []Loadbalancer + return ret + } return o.Items - } -// GetItemsOk returns a tuple with the Items field value +// GetItemsOk returns a tuple with the Items 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 *Loadbalancers) GetItemsOk() (*[]Loadbalancer, bool) { - if o == nil { +func (o *Loadbalancers) GetItemsOk() ([]Loadbalancer, bool) { + if o == nil || IsNil(o.Items) { return nil, false } - return o.Items, true } -// SetItems sets field value -func (o *Loadbalancers) SetItems(v []Loadbalancer) { - - o.Items = &v - -} - // HasItems returns a boolean if a field has been set. func (o *Loadbalancers) HasItems() bool { - if o != nil && o.Items != nil { + if o != nil && !IsNil(o.Items) { return true } return false } -// GetOffset returns the Offset field value -// If the value is explicit nil, nil is returned -func (o *Loadbalancers) GetOffset() *float32 { - if o == nil { - return nil - } - - return o.Offset +// SetItems gets a reference to the given []Loadbalancer and assigns it to the Items field. +func (o *Loadbalancers) SetItems(v []Loadbalancer) { + o.Items = v +} +// GetOffset returns the Offset field value if set, zero value otherwise. +func (o *Loadbalancers) GetOffset() float32 { + if o == nil || IsNil(o.Offset) { + var ret float32 + return ret + } + return *o.Offset } -// GetOffsetOk returns a tuple with the Offset field value +// GetOffsetOk returns a tuple with the Offset 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 *Loadbalancers) GetOffsetOk() (*float32, bool) { - if o == nil { + if o == nil || IsNil(o.Offset) { return nil, false } - return o.Offset, true } -// SetOffset sets field value -func (o *Loadbalancers) SetOffset(v float32) { - - o.Offset = &v - -} - // HasOffset returns a boolean if a field has been set. func (o *Loadbalancers) HasOffset() bool { - if o != nil && o.Offset != nil { + if o != nil && !IsNil(o.Offset) { return true } return false } -// GetLimit returns the Limit field value -// If the value is explicit nil, nil is returned -func (o *Loadbalancers) GetLimit() *float32 { - if o == nil { - return nil - } - - return o.Limit +// SetOffset gets a reference to the given float32 and assigns it to the Offset field. +func (o *Loadbalancers) SetOffset(v float32) { + o.Offset = &v +} +// GetLimit returns the Limit field value if set, zero value otherwise. +func (o *Loadbalancers) GetLimit() float32 { + if o == nil || IsNil(o.Limit) { + var ret float32 + return ret + } + return *o.Limit } -// GetLimitOk returns a tuple with the Limit field value +// GetLimitOk returns a tuple with the Limit 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 *Loadbalancers) GetLimitOk() (*float32, bool) { - if o == nil { + if o == nil || IsNil(o.Limit) { return nil, false } - return o.Limit, true } -// SetLimit sets field value -func (o *Loadbalancers) SetLimit(v float32) { - - o.Limit = &v - -} - // HasLimit returns a boolean if a field has been set. func (o *Loadbalancers) HasLimit() bool { - if o != nil && o.Limit != nil { + if o != nil && !IsNil(o.Limit) { return true } return false } -// GetLinks returns the Links field value -// If the value is explicit nil, nil is returned -func (o *Loadbalancers) GetLinks() *PaginationLinks { - if o == nil { - return nil - } - - return o.Links +// SetLimit gets a reference to the given float32 and assigns it to the Limit field. +func (o *Loadbalancers) SetLimit(v float32) { + o.Limit = &v +} +// GetLinks returns the Links field value if set, zero value otherwise. +func (o *Loadbalancers) GetLinks() PaginationLinks { + if o == nil || IsNil(o.Links) { + var ret PaginationLinks + return ret + } + return *o.Links } -// GetLinksOk returns a tuple with the Links field value +// GetLinksOk returns a tuple with the Links 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 *Loadbalancers) GetLinksOk() (*PaginationLinks, bool) { - if o == nil { + if o == nil || IsNil(o.Links) { return nil, false } - return o.Links, true } -// SetLinks sets field value -func (o *Loadbalancers) SetLinks(v PaginationLinks) { - - o.Links = &v - -} - // HasLinks returns a boolean if a field has been set. func (o *Loadbalancers) HasLinks() bool { - if o != nil && o.Links != nil { + if o != nil && !IsNil(o.Links) { return true } return false } +// SetLinks gets a reference to the given PaginationLinks and assigns it to the Links field. +func (o *Loadbalancers) SetLinks(v PaginationLinks) { + o.Links = &v +} + func (o Loadbalancers) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Loadbalancers) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Items != nil { + if !IsNil(o.Items) { toSerialize["items"] = o.Items } - - if o.Offset != nil { + if !IsNil(o.Offset) { toSerialize["offset"] = o.Offset } - - if o.Limit != nil { + if !IsNil(o.Limit) { toSerialize["limit"] = o.Limit } - - if o.Links != nil { + if !IsNil(o.Links) { toSerialize["_links"] = o.Links } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableLoadbalancers struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_location.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_location.go similarity index 65% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_location.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_location.go index cb8d597e1..3566db3f9 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_location.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_location.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the Location type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Location{} + // Location struct for Location type Location struct { // The resource's unique identifier. @@ -23,7 +26,7 @@ type Location struct { // URL to the object representation (absolute path). Href *string `json:"href,omitempty"` Metadata *DatacenterElementMetadata `json:"metadata,omitempty"` - Properties *LocationProperties `json:"properties"` + Properties LocationProperties `json:"properties"` } // NewLocation instantiates a new Location object @@ -33,7 +36,7 @@ type Location struct { func NewLocation(properties LocationProperties) *Location { this := Location{} - this.Properties = &properties + this.Properties = properties return &this } @@ -46,219 +49,182 @@ func NewLocationWithDefaults() *Location { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *Location) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *Location) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *Location) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *Location) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *Location) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *Location) GetType() *Type { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Location) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *Location) GetType() Type { + if o == nil || IsNil(o.Type) { + var ret Type + return ret + } + return *o.Type } -// GetTypeOk returns a tuple with the Type field value +// GetTypeOk returns a tuple with the Type 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 *Location) GetTypeOk() (*Type, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *Location) SetType(v Type) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *Location) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *Location) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given Type and assigns it to the Type field. +func (o *Location) SetType(v Type) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *Location) 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 +// GetHrefOk returns a tuple with the Href 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 *Location) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *Location) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *Location) HasHref() bool { - if o != nil && o.Href != nil { + if o != nil && !IsNil(o.Href) { return true } return false } -// GetMetadata returns the Metadata field value -// If the value is explicit nil, nil is returned -func (o *Location) GetMetadata() *DatacenterElementMetadata { - if o == nil { - return nil - } - - return o.Metadata +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *Location) SetHref(v string) { + o.Href = &v +} +// GetMetadata returns the Metadata field value if set, zero value otherwise. +func (o *Location) GetMetadata() DatacenterElementMetadata { + if o == nil || IsNil(o.Metadata) { + var ret DatacenterElementMetadata + return ret + } + return *o.Metadata } -// GetMetadataOk returns a tuple with the Metadata field value +// GetMetadataOk returns a tuple with the Metadata 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 *Location) GetMetadataOk() (*DatacenterElementMetadata, bool) { - if o == nil { + if o == nil || IsNil(o.Metadata) { return nil, false } - return o.Metadata, true } -// SetMetadata sets field value -func (o *Location) SetMetadata(v DatacenterElementMetadata) { - - o.Metadata = &v - -} - // HasMetadata returns a boolean if a field has been set. func (o *Location) HasMetadata() bool { - if o != nil && o.Metadata != nil { + if o != nil && !IsNil(o.Metadata) { return true } return false } +// SetMetadata gets a reference to the given DatacenterElementMetadata and assigns it to the Metadata field. +func (o *Location) SetMetadata(v DatacenterElementMetadata) { + o.Metadata = &v +} + // GetProperties returns the Properties field value -// If the value is explicit nil, nil is returned -func (o *Location) GetProperties() *LocationProperties { +func (o *Location) GetProperties() LocationProperties { if o == nil { - return nil + var ret LocationProperties + return ret } return o.Properties - } // GetPropertiesOk returns a tuple with the Properties field value // 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 *Location) GetPropertiesOk() (*LocationProperties, bool) { if o == nil { return nil, false } - - return o.Properties, true + return &o.Properties, true } // SetProperties sets field value func (o *Location) SetProperties(v LocationProperties) { - - o.Properties = &v - + o.Properties = v } -// HasProperties returns a boolean if a field has been set. -func (o *Location) HasProperties() bool { - if o != nil && o.Properties != nil { - return true +func (o Location) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } - - return false + return json.Marshal(toSerialize) } -func (o Location) MarshalJSON() ([]byte, error) { +func (o Location) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Metadata != nil { + if !IsNil(o.Metadata) { toSerialize["metadata"] = o.Metadata } - - if o.Properties != nil { - toSerialize["properties"] = o.Properties - } - - return json.Marshal(toSerialize) + toSerialize["properties"] = o.Properties + return toSerialize, nil } type NullableLocation struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_location_properties.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_location_properties.go similarity index 61% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_location_properties.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_location_properties.go index c529fcb20..5cf302a45 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_location_properties.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_location_properties.go @@ -14,16 +14,19 @@ import ( "encoding/json" ) +// checks if the LocationProperties type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &LocationProperties{} + // LocationProperties struct for LocationProperties type LocationProperties struct { // The location name. Name *string `json:"name,omitempty"` // A list of available features in the location. - Features *[]string `json:"features,omitempty"` + Features []string `json:"features,omitempty"` // A list of image aliases available in the location. - ImageAliases *[]string `json:"imageAliases,omitempty"` + ImageAliases []string `json:"imageAliases,omitempty"` // A list of available CPU types and related resources available in the location. - CpuArchitecture *[]CpuArchitectureProperties `json:"cpuArchitecture,omitempty"` + CpuArchitecture []CpuArchitectureProperties `json:"cpuArchitecture,omitempty"` } // NewLocationProperties instantiates a new LocationProperties object @@ -44,177 +47,157 @@ func NewLocationPropertiesWithDefaults() *LocationProperties { return &this } -// GetName returns the Name field value -// If the value is explicit nil, nil is returned -func (o *LocationProperties) GetName() *string { - if o == nil { - return nil +// GetName returns the Name field value if set, zero value otherwise. +func (o *LocationProperties) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret } - - return o.Name - + return *o.Name } -// GetNameOk returns a tuple with the Name field value +// GetNameOk returns a tuple with the Name 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 *LocationProperties) GetNameOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Name) { return nil, false } - return o.Name, true } -// SetName sets field value -func (o *LocationProperties) SetName(v string) { - - o.Name = &v - -} - // HasName returns a boolean if a field has been set. func (o *LocationProperties) HasName() bool { - if o != nil && o.Name != nil { + if o != nil && !IsNil(o.Name) { return true } return false } -// GetFeatures returns the Features field value -// If the value is explicit nil, nil is returned -func (o *LocationProperties) GetFeatures() *[]string { - if o == nil { - return nil - } +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *LocationProperties) SetName(v string) { + o.Name = &v +} +// GetFeatures returns the Features field value if set, zero value otherwise. +func (o *LocationProperties) 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 +// GetFeaturesOk returns a tuple with the Features 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 *LocationProperties) GetFeaturesOk() (*[]string, bool) { - if o == nil { +func (o *LocationProperties) GetFeaturesOk() ([]string, bool) { + if o == nil || IsNil(o.Features) { return nil, false } - return o.Features, true } -// SetFeatures sets field value -func (o *LocationProperties) SetFeatures(v []string) { - - o.Features = &v - -} - // HasFeatures returns a boolean if a field has been set. func (o *LocationProperties) HasFeatures() bool { - if o != nil && o.Features != nil { + if o != nil && !IsNil(o.Features) { return true } return false } -// GetImageAliases returns the ImageAliases field value -// If the value is explicit nil, nil is returned -func (o *LocationProperties) GetImageAliases() *[]string { - if o == nil { - return nil - } +// SetFeatures gets a reference to the given []string and assigns it to the Features field. +func (o *LocationProperties) SetFeatures(v []string) { + o.Features = v +} +// GetImageAliases returns the ImageAliases field value if set, zero value otherwise. +func (o *LocationProperties) GetImageAliases() []string { + if o == nil || IsNil(o.ImageAliases) { + var ret []string + return ret + } return o.ImageAliases - } -// GetImageAliasesOk returns a tuple with the ImageAliases field value +// GetImageAliasesOk returns a tuple with the ImageAliases 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 *LocationProperties) GetImageAliasesOk() (*[]string, bool) { - if o == nil { +func (o *LocationProperties) GetImageAliasesOk() ([]string, bool) { + if o == nil || IsNil(o.ImageAliases) { return nil, false } - return o.ImageAliases, true } -// SetImageAliases sets field value -func (o *LocationProperties) SetImageAliases(v []string) { - - o.ImageAliases = &v - -} - // HasImageAliases returns a boolean if a field has been set. func (o *LocationProperties) HasImageAliases() bool { - if o != nil && o.ImageAliases != nil { + if o != nil && !IsNil(o.ImageAliases) { return true } return false } -// GetCpuArchitecture returns the CpuArchitecture field value -// If the value is explicit nil, nil is returned -func (o *LocationProperties) GetCpuArchitecture() *[]CpuArchitectureProperties { - if o == nil { - return nil - } +// SetImageAliases gets a reference to the given []string and assigns it to the ImageAliases field. +func (o *LocationProperties) SetImageAliases(v []string) { + o.ImageAliases = v +} +// GetCpuArchitecture returns the CpuArchitecture field value if set, zero value otherwise. +func (o *LocationProperties) GetCpuArchitecture() []CpuArchitectureProperties { + if o == nil || IsNil(o.CpuArchitecture) { + var ret []CpuArchitectureProperties + return ret + } return o.CpuArchitecture - } -// GetCpuArchitectureOk returns a tuple with the CpuArchitecture field value +// GetCpuArchitectureOk returns a tuple with the CpuArchitecture 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 *LocationProperties) GetCpuArchitectureOk() (*[]CpuArchitectureProperties, bool) { - if o == nil { +func (o *LocationProperties) GetCpuArchitectureOk() ([]CpuArchitectureProperties, bool) { + if o == nil || IsNil(o.CpuArchitecture) { return nil, false } - return o.CpuArchitecture, true } -// SetCpuArchitecture sets field value -func (o *LocationProperties) SetCpuArchitecture(v []CpuArchitectureProperties) { - - o.CpuArchitecture = &v - -} - // HasCpuArchitecture returns a boolean if a field has been set. func (o *LocationProperties) HasCpuArchitecture() bool { - if o != nil && o.CpuArchitecture != nil { + if o != nil && !IsNil(o.CpuArchitecture) { return true } return false } +// SetCpuArchitecture gets a reference to the given []CpuArchitectureProperties and assigns it to the CpuArchitecture field. +func (o *LocationProperties) SetCpuArchitecture(v []CpuArchitectureProperties) { + o.CpuArchitecture = v +} + func (o LocationProperties) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o LocationProperties) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Name != nil { + if !IsNil(o.Name) { toSerialize["name"] = o.Name } - - if o.Features != nil { + if !IsNil(o.Features) { toSerialize["features"] = o.Features } - - if o.ImageAliases != nil { + if !IsNil(o.ImageAliases) { toSerialize["imageAliases"] = o.ImageAliases } - - if o.CpuArchitecture != nil { + if !IsNil(o.CpuArchitecture) { toSerialize["cpuArchitecture"] = o.CpuArchitecture } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableLocationProperties struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_locations.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_locations.go similarity index 64% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_locations.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_locations.go index bffdcbcb7..e147a34a1 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_locations.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_locations.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the Locations type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Locations{} + // Locations struct for Locations type Locations struct { // The resource's unique identifier. @@ -23,7 +26,7 @@ type Locations struct { // URL to the object representation (absolute path). Href *string `json:"href,omitempty"` // Array of items in the collection. - Items *[]Location `json:"items,omitempty"` + Items []Location `json:"items,omitempty"` } // NewLocations instantiates a new Locations object @@ -44,177 +47,157 @@ func NewLocationsWithDefaults() *Locations { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *Locations) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *Locations) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *Locations) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *Locations) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *Locations) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *Locations) GetType() *Type { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Locations) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *Locations) GetType() Type { + if o == nil || IsNil(o.Type) { + var ret Type + return ret + } + return *o.Type } -// GetTypeOk returns a tuple with the Type field value +// GetTypeOk returns a tuple with the Type 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 *Locations) GetTypeOk() (*Type, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *Locations) SetType(v Type) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *Locations) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *Locations) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given Type and assigns it to the Type field. +func (o *Locations) SetType(v Type) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *Locations) 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 +// GetHrefOk returns a tuple with the Href 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 *Locations) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *Locations) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *Locations) HasHref() bool { - if o != nil && o.Href != nil { + if o != nil && !IsNil(o.Href) { return true } return false } -// GetItems returns the Items field value -// If the value is explicit nil, nil is returned -func (o *Locations) GetItems() *[]Location { - if o == nil { - return nil - } +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *Locations) SetHref(v string) { + o.Href = &v +} +// GetItems returns the Items field value if set, zero value otherwise. +func (o *Locations) GetItems() []Location { + if o == nil || IsNil(o.Items) { + var ret []Location + return ret + } return o.Items - } -// GetItemsOk returns a tuple with the Items field value +// GetItemsOk returns a tuple with the Items 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 *Locations) GetItemsOk() (*[]Location, bool) { - if o == nil { +func (o *Locations) GetItemsOk() ([]Location, bool) { + if o == nil || IsNil(o.Items) { return nil, false } - return o.Items, true } -// SetItems sets field value -func (o *Locations) SetItems(v []Location) { - - o.Items = &v - -} - // HasItems returns a boolean if a field has been set. func (o *Locations) HasItems() bool { - if o != nil && o.Items != nil { + if o != nil && !IsNil(o.Items) { return true } return false } +// SetItems gets a reference to the given []Location and assigns it to the Items field. +func (o *Locations) SetItems(v []Location) { + o.Items = v +} + func (o Locations) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Locations) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Items != nil { + if !IsNil(o.Items) { toSerialize["items"] = o.Items } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableLocations struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_nat_gateway.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_nat_gateway.go similarity index 63% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_nat_gateway.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_nat_gateway.go index cff935523..ed0af2003 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_nat_gateway.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_nat_gateway.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the NatGateway type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NatGateway{} + // NatGateway struct for NatGateway type NatGateway struct { // The resource's unique identifier. @@ -23,7 +26,7 @@ type NatGateway struct { // URL to the object representation (absolute path). Href *string `json:"href,omitempty"` Metadata *DatacenterElementMetadata `json:"metadata,omitempty"` - Properties *NatGatewayProperties `json:"properties"` + Properties NatGatewayProperties `json:"properties"` Entities *NatGatewayEntities `json:"entities,omitempty"` } @@ -34,7 +37,7 @@ type NatGateway struct { func NewNatGateway(properties NatGatewayProperties) *NatGateway { this := NatGateway{} - this.Properties = &properties + this.Properties = properties return &this } @@ -47,261 +50,217 @@ func NewNatGatewayWithDefaults() *NatGateway { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *NatGateway) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *NatGateway) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *NatGateway) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *NatGateway) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *NatGateway) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *NatGateway) GetType() *Type { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *NatGateway) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *NatGateway) GetType() Type { + if o == nil || IsNil(o.Type) { + var ret Type + return ret + } + return *o.Type } -// GetTypeOk returns a tuple with the Type field value +// GetTypeOk returns a tuple with the Type 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 *NatGateway) GetTypeOk() (*Type, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *NatGateway) SetType(v Type) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *NatGateway) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *NatGateway) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given Type and assigns it to the Type field. +func (o *NatGateway) SetType(v Type) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *NatGateway) 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 +// GetHrefOk returns a tuple with the Href 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 *NatGateway) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *NatGateway) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *NatGateway) HasHref() bool { - if o != nil && o.Href != nil { + if o != nil && !IsNil(o.Href) { return true } return false } -// GetMetadata returns the Metadata field value -// If the value is explicit nil, nil is returned -func (o *NatGateway) GetMetadata() *DatacenterElementMetadata { - if o == nil { - return nil - } - - return o.Metadata +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *NatGateway) SetHref(v string) { + o.Href = &v +} +// GetMetadata returns the Metadata field value if set, zero value otherwise. +func (o *NatGateway) GetMetadata() DatacenterElementMetadata { + if o == nil || IsNil(o.Metadata) { + var ret DatacenterElementMetadata + return ret + } + return *o.Metadata } -// GetMetadataOk returns a tuple with the Metadata field value +// GetMetadataOk returns a tuple with the Metadata 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 *NatGateway) GetMetadataOk() (*DatacenterElementMetadata, bool) { - if o == nil { + if o == nil || IsNil(o.Metadata) { return nil, false } - return o.Metadata, true } -// SetMetadata sets field value -func (o *NatGateway) SetMetadata(v DatacenterElementMetadata) { - - o.Metadata = &v - -} - // HasMetadata returns a boolean if a field has been set. func (o *NatGateway) HasMetadata() bool { - if o != nil && o.Metadata != nil { + if o != nil && !IsNil(o.Metadata) { return true } return false } +// SetMetadata gets a reference to the given DatacenterElementMetadata and assigns it to the Metadata field. +func (o *NatGateway) SetMetadata(v DatacenterElementMetadata) { + o.Metadata = &v +} + // GetProperties returns the Properties field value -// If the value is explicit nil, nil is returned -func (o *NatGateway) GetProperties() *NatGatewayProperties { +func (o *NatGateway) GetProperties() NatGatewayProperties { if o == nil { - return nil + var ret NatGatewayProperties + return ret } return o.Properties - } // GetPropertiesOk returns a tuple with the Properties field value // 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 *NatGateway) GetPropertiesOk() (*NatGatewayProperties, bool) { if o == nil { return nil, false } - - return o.Properties, true + return &o.Properties, true } // SetProperties sets field value func (o *NatGateway) SetProperties(v NatGatewayProperties) { - - o.Properties = &v - -} - -// HasProperties returns a boolean if a field has been set. -func (o *NatGateway) HasProperties() bool { - if o != nil && o.Properties != nil { - return true - } - - return false + o.Properties = v } -// GetEntities returns the Entities field value -// If the value is explicit nil, nil is returned -func (o *NatGateway) GetEntities() *NatGatewayEntities { - if o == nil { - return nil +// GetEntities returns the Entities field value if set, zero value otherwise. +func (o *NatGateway) GetEntities() NatGatewayEntities { + if o == nil || IsNil(o.Entities) { + var ret NatGatewayEntities + return ret } - - return o.Entities - + return *o.Entities } -// GetEntitiesOk returns a tuple with the Entities field value +// GetEntitiesOk returns a tuple with the Entities 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 *NatGateway) GetEntitiesOk() (*NatGatewayEntities, bool) { - if o == nil { + if o == nil || IsNil(o.Entities) { return nil, false } - return o.Entities, true } -// SetEntities sets field value -func (o *NatGateway) SetEntities(v NatGatewayEntities) { - - o.Entities = &v - -} - // HasEntities returns a boolean if a field has been set. func (o *NatGateway) HasEntities() bool { - if o != nil && o.Entities != nil { + if o != nil && !IsNil(o.Entities) { return true } return false } +// SetEntities gets a reference to the given NatGatewayEntities and assigns it to the Entities field. +func (o *NatGateway) SetEntities(v NatGatewayEntities) { + o.Entities = &v +} + func (o NatGateway) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o NatGateway) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Metadata != nil { + if !IsNil(o.Metadata) { toSerialize["metadata"] = o.Metadata } - - if o.Properties != nil { - toSerialize["properties"] = o.Properties - } - - if o.Entities != nil { + toSerialize["properties"] = o.Properties + if !IsNil(o.Entities) { toSerialize["entities"] = o.Entities } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableNatGateway struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_nat_gateway_entities.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_nat_gateway_entities.go similarity index 72% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_nat_gateway_entities.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_nat_gateway_entities.go index d9cef1840..eebd9cd4d 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_nat_gateway_entities.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_nat_gateway_entities.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the NatGatewayEntities type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NatGatewayEntities{} + // NatGatewayEntities struct for NatGatewayEntities type NatGatewayEntities struct { Rules *NatGatewayRules `json:"rules,omitempty"` @@ -38,93 +41,87 @@ func NewNatGatewayEntitiesWithDefaults() *NatGatewayEntities { return &this } -// GetRules returns the Rules field value -// If the value is explicit nil, nil is returned -func (o *NatGatewayEntities) GetRules() *NatGatewayRules { - if o == nil { - return nil +// GetRules returns the Rules field value if set, zero value otherwise. +func (o *NatGatewayEntities) GetRules() NatGatewayRules { + if o == nil || IsNil(o.Rules) { + var ret NatGatewayRules + return ret } - - return o.Rules - + return *o.Rules } -// GetRulesOk returns a tuple with the Rules field value +// GetRulesOk returns a tuple with the Rules 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 *NatGatewayEntities) GetRulesOk() (*NatGatewayRules, bool) { - if o == nil { + if o == nil || IsNil(o.Rules) { return nil, false } - return o.Rules, true } -// SetRules sets field value -func (o *NatGatewayEntities) SetRules(v NatGatewayRules) { - - o.Rules = &v - -} - // HasRules returns a boolean if a field has been set. func (o *NatGatewayEntities) HasRules() bool { - if o != nil && o.Rules != nil { + if o != nil && !IsNil(o.Rules) { return true } return false } -// GetFlowlogs returns the Flowlogs field value -// If the value is explicit nil, nil is returned -func (o *NatGatewayEntities) GetFlowlogs() *FlowLogs { - if o == nil { - return nil - } - - return o.Flowlogs +// SetRules gets a reference to the given NatGatewayRules and assigns it to the Rules field. +func (o *NatGatewayEntities) SetRules(v NatGatewayRules) { + o.Rules = &v +} +// GetFlowlogs returns the Flowlogs field value if set, zero value otherwise. +func (o *NatGatewayEntities) GetFlowlogs() FlowLogs { + if o == nil || IsNil(o.Flowlogs) { + var ret FlowLogs + return ret + } + return *o.Flowlogs } -// GetFlowlogsOk returns a tuple with the Flowlogs field value +// GetFlowlogsOk returns a tuple with the Flowlogs 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 *NatGatewayEntities) GetFlowlogsOk() (*FlowLogs, bool) { - if o == nil { + if o == nil || IsNil(o.Flowlogs) { return nil, false } - return o.Flowlogs, true } -// SetFlowlogs sets field value -func (o *NatGatewayEntities) SetFlowlogs(v FlowLogs) { - - o.Flowlogs = &v - -} - // HasFlowlogs returns a boolean if a field has been set. func (o *NatGatewayEntities) HasFlowlogs() bool { - if o != nil && o.Flowlogs != nil { + if o != nil && !IsNil(o.Flowlogs) { return true } return false } +// SetFlowlogs gets a reference to the given FlowLogs and assigns it to the Flowlogs field. +func (o *NatGatewayEntities) SetFlowlogs(v FlowLogs) { + o.Flowlogs = &v +} + func (o NatGatewayEntities) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o NatGatewayEntities) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Rules != nil { + if !IsNil(o.Rules) { toSerialize["rules"] = o.Rules } - - if o.Flowlogs != nil { + if !IsNil(o.Flowlogs) { toSerialize["flowlogs"] = o.Flowlogs } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableNatGatewayEntities struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_nat_gateway_lan_properties.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_nat_gateway_lan_properties.go similarity index 76% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_nat_gateway_lan_properties.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_nat_gateway_lan_properties.go index 4e3c03d70..ac9019afa 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_nat_gateway_lan_properties.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_nat_gateway_lan_properties.go @@ -14,12 +14,15 @@ import ( "encoding/json" ) +// checks if the NatGatewayLanProperties type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NatGatewayLanProperties{} + // NatGatewayLanProperties struct for NatGatewayLanProperties type NatGatewayLanProperties struct { // Id for the LAN connected to the NAT Gateway - Id *int32 `json:"id"` + Id int32 `json:"id"` // Collection of gateway IP addresses of the NAT Gateway. Will be auto-generated if not provided. Should ideally be an IP belonging to the same subnet as the LAN - GatewayIps *[]string `json:"gatewayIps,omitempty"` + GatewayIps []string `json:"gatewayIps,omitempty"` } // NewNatGatewayLanProperties instantiates a new NatGatewayLanProperties object @@ -29,7 +32,7 @@ type NatGatewayLanProperties struct { func NewNatGatewayLanProperties(id int32) *NatGatewayLanProperties { this := NatGatewayLanProperties{} - this.Id = &id + this.Id = id return &this } @@ -43,92 +46,76 @@ func NewNatGatewayLanPropertiesWithDefaults() *NatGatewayLanProperties { } // GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *NatGatewayLanProperties) GetId() *int32 { +func (o *NatGatewayLanProperties) GetId() int32 { if o == nil { - return nil + var ret int32 + 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. -// NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *NatGatewayLanProperties) GetIdOk() (*int32, bool) { if o == nil { return nil, false } - - return o.Id, true + return &o.Id, true } // SetId sets field value func (o *NatGatewayLanProperties) SetId(v int32) { - - o.Id = &v - + o.Id = v } -// HasId returns a boolean if a field has been set. -func (o *NatGatewayLanProperties) HasId() bool { - if o != nil && o.Id != nil { - return true +// GetGatewayIps returns the GatewayIps field value if set, zero value otherwise. +func (o *NatGatewayLanProperties) GetGatewayIps() []string { + if o == nil || IsNil(o.GatewayIps) { + var ret []string + return ret } - - return false -} - -// GetGatewayIps returns the GatewayIps field value -// If the value is explicit nil, nil is returned -func (o *NatGatewayLanProperties) GetGatewayIps() *[]string { - if o == nil { - return nil - } - return o.GatewayIps - } -// GetGatewayIpsOk returns a tuple with the GatewayIps field value +// GetGatewayIpsOk returns a tuple with the GatewayIps 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 *NatGatewayLanProperties) GetGatewayIpsOk() (*[]string, bool) { - if o == nil { +func (o *NatGatewayLanProperties) GetGatewayIpsOk() ([]string, bool) { + if o == nil || IsNil(o.GatewayIps) { return nil, false } - return o.GatewayIps, true } -// SetGatewayIps sets field value -func (o *NatGatewayLanProperties) SetGatewayIps(v []string) { - - o.GatewayIps = &v - -} - // HasGatewayIps returns a boolean if a field has been set. func (o *NatGatewayLanProperties) HasGatewayIps() bool { - if o != nil && o.GatewayIps != nil { + if o != nil && !IsNil(o.GatewayIps) { return true } return false } +// SetGatewayIps gets a reference to the given []string and assigns it to the GatewayIps field. +func (o *NatGatewayLanProperties) SetGatewayIps(v []string) { + o.GatewayIps = v +} + func (o NatGatewayLanProperties) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.Id != nil { - toSerialize["id"] = o.Id + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } + return json.Marshal(toSerialize) +} - if o.GatewayIps != nil { +func (o NatGatewayLanProperties) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["id"] = o.Id + if !IsNil(o.GatewayIps) { toSerialize["gatewayIps"] = o.GatewayIps } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableNatGatewayLanProperties struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_nat_gateway_properties.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_nat_gateway_properties.go similarity index 70% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_nat_gateway_properties.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_nat_gateway_properties.go index 881413835..b9de197fb 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_nat_gateway_properties.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_nat_gateway_properties.go @@ -14,14 +14,17 @@ import ( "encoding/json" ) +// checks if the NatGatewayProperties type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NatGatewayProperties{} + // NatGatewayProperties struct for NatGatewayProperties type NatGatewayProperties struct { // Name of the NAT Gateway. - Name *string `json:"name"` + Name string `json:"name"` // Collection of public IP addresses of the NAT Gateway. Should be customer reserved IP addresses in that location. - PublicIps *[]string `json:"publicIps"` + PublicIps []string `json:"publicIps"` // Collection of LANs connected to the NAT Gateway. IPs must contain a valid subnet mask. If no IP is provided, the system will generate an IP with /24 subnet. - Lans *[]NatGatewayLanProperties `json:"lans,omitempty"` + Lans []NatGatewayLanProperties `json:"lans,omitempty"` } // NewNatGatewayProperties instantiates a new NatGatewayProperties object @@ -31,8 +34,8 @@ type NatGatewayProperties struct { func NewNatGatewayProperties(name string, publicIps []string) *NatGatewayProperties { this := NatGatewayProperties{} - this.Name = &name - this.PublicIps = &publicIps + this.Name = name + this.PublicIps = publicIps return &this } @@ -46,134 +49,101 @@ func NewNatGatewayPropertiesWithDefaults() *NatGatewayProperties { } // GetName returns the Name field value -// If the value is explicit nil, nil is returned -func (o *NatGatewayProperties) GetName() *string { +func (o *NatGatewayProperties) GetName() string { if o == nil { - return 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. -// NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *NatGatewayProperties) GetNameOk() (*string, bool) { if o == nil { return nil, false } - - return o.Name, true + return &o.Name, true } // SetName sets field value func (o *NatGatewayProperties) SetName(v string) { - - o.Name = &v - -} - -// HasName returns a boolean if a field has been set. -func (o *NatGatewayProperties) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false + o.Name = v } // GetPublicIps returns the PublicIps field value -// If the value is explicit nil, nil is returned -func (o *NatGatewayProperties) GetPublicIps() *[]string { +func (o *NatGatewayProperties) GetPublicIps() []string { if o == nil { - return nil + var ret []string + return ret } return o.PublicIps - } // GetPublicIpsOk returns a tuple with the PublicIps field value // 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 *NatGatewayProperties) GetPublicIpsOk() (*[]string, bool) { +func (o *NatGatewayProperties) GetPublicIpsOk() ([]string, bool) { if o == nil { return nil, false } - return o.PublicIps, true } // SetPublicIps sets field value func (o *NatGatewayProperties) SetPublicIps(v []string) { - - o.PublicIps = &v - -} - -// HasPublicIps returns a boolean if a field has been set. -func (o *NatGatewayProperties) HasPublicIps() bool { - if o != nil && o.PublicIps != nil { - return true - } - - return false + o.PublicIps = v } -// GetLans returns the Lans field value -// If the value is explicit nil, nil is returned -func (o *NatGatewayProperties) GetLans() *[]NatGatewayLanProperties { - if o == nil { - return nil +// GetLans returns the Lans field value if set, zero value otherwise. +func (o *NatGatewayProperties) GetLans() []NatGatewayLanProperties { + if o == nil || IsNil(o.Lans) { + var ret []NatGatewayLanProperties + return ret } - return o.Lans - } -// GetLansOk returns a tuple with the Lans field value +// GetLansOk returns a tuple with the Lans 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 *NatGatewayProperties) GetLansOk() (*[]NatGatewayLanProperties, bool) { - if o == nil { +func (o *NatGatewayProperties) GetLansOk() ([]NatGatewayLanProperties, bool) { + if o == nil || IsNil(o.Lans) { return nil, false } - return o.Lans, true } -// SetLans sets field value -func (o *NatGatewayProperties) SetLans(v []NatGatewayLanProperties) { - - o.Lans = &v - -} - // HasLans returns a boolean if a field has been set. func (o *NatGatewayProperties) HasLans() bool { - if o != nil && o.Lans != nil { + if o != nil && !IsNil(o.Lans) { return true } return false } -func (o NatGatewayProperties) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.Name != nil { - toSerialize["name"] = o.Name - } +// SetLans gets a reference to the given []NatGatewayLanProperties and assigns it to the Lans field. +func (o *NatGatewayProperties) SetLans(v []NatGatewayLanProperties) { + o.Lans = v +} - if o.PublicIps != nil { - toSerialize["publicIps"] = o.PublicIps +func (o NatGatewayProperties) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } + return json.Marshal(toSerialize) +} - if o.Lans != nil { +func (o NatGatewayProperties) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["name"] = o.Name + toSerialize["publicIps"] = o.PublicIps + if !IsNil(o.Lans) { toSerialize["lans"] = o.Lans } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableNatGatewayProperties struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_nat_gateway_put.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_nat_gateway_put.go similarity index 68% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_nat_gateway_put.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_nat_gateway_put.go index cf0954d94..d153fd896 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_nat_gateway_put.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_nat_gateway_put.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the NatGatewayPut type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NatGatewayPut{} + // NatGatewayPut struct for NatGatewayPut type NatGatewayPut struct { // The resource's unique identifier. @@ -21,8 +24,8 @@ type NatGatewayPut struct { // The type of object that has been created. Type *Type `json:"type,omitempty"` // URL to the object representation (absolute path). - Href *string `json:"href,omitempty"` - Properties *NatGatewayProperties `json:"properties"` + Href *string `json:"href,omitempty"` + Properties NatGatewayProperties `json:"properties"` } // NewNatGatewayPut instantiates a new NatGatewayPut object @@ -32,7 +35,7 @@ type NatGatewayPut struct { func NewNatGatewayPut(properties NatGatewayProperties) *NatGatewayPut { this := NatGatewayPut{} - this.Properties = &properties + this.Properties = properties return &this } @@ -45,177 +48,147 @@ func NewNatGatewayPutWithDefaults() *NatGatewayPut { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *NatGatewayPut) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *NatGatewayPut) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *NatGatewayPut) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *NatGatewayPut) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *NatGatewayPut) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *NatGatewayPut) GetType() *Type { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *NatGatewayPut) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *NatGatewayPut) GetType() Type { + if o == nil || IsNil(o.Type) { + var ret Type + return ret + } + return *o.Type } -// GetTypeOk returns a tuple with the Type field value +// GetTypeOk returns a tuple with the Type 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 *NatGatewayPut) GetTypeOk() (*Type, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *NatGatewayPut) SetType(v Type) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *NatGatewayPut) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *NatGatewayPut) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given Type and assigns it to the Type field. +func (o *NatGatewayPut) SetType(v Type) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *NatGatewayPut) 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 +// GetHrefOk returns a tuple with the Href 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 *NatGatewayPut) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *NatGatewayPut) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *NatGatewayPut) HasHref() bool { - if o != nil && o.Href != nil { + 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 *NatGatewayPut) SetHref(v string) { + o.Href = &v +} + // GetProperties returns the Properties field value -// If the value is explicit nil, nil is returned -func (o *NatGatewayPut) GetProperties() *NatGatewayProperties { +func (o *NatGatewayPut) GetProperties() NatGatewayProperties { if o == nil { - return nil + var ret NatGatewayProperties + return ret } return o.Properties - } // GetPropertiesOk returns a tuple with the Properties field value // 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 *NatGatewayPut) GetPropertiesOk() (*NatGatewayProperties, bool) { if o == nil { return nil, false } - - return o.Properties, true + return &o.Properties, true } // SetProperties sets field value func (o *NatGatewayPut) SetProperties(v NatGatewayProperties) { - - o.Properties = &v - + o.Properties = v } -// HasProperties returns a boolean if a field has been set. -func (o *NatGatewayPut) HasProperties() bool { - if o != nil && o.Properties != nil { - return true +func (o NatGatewayPut) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } - - return false + return json.Marshal(toSerialize) } -func (o NatGatewayPut) MarshalJSON() ([]byte, error) { +func (o NatGatewayPut) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Properties != nil { - toSerialize["properties"] = o.Properties - } - - return json.Marshal(toSerialize) + toSerialize["properties"] = o.Properties + return toSerialize, nil } type NullableNatGatewayPut struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_nat_gateway_rule.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_nat_gateway_rule.go similarity index 66% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_nat_gateway_rule.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_nat_gateway_rule.go index 996abf31e..5a6c8b9b6 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_nat_gateway_rule.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_nat_gateway_rule.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the NatGatewayRule type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NatGatewayRule{} + // NatGatewayRule struct for NatGatewayRule type NatGatewayRule struct { // The resource's unique identifier. @@ -23,7 +26,7 @@ type NatGatewayRule struct { // URL to the object representation (absolute path). Href *string `json:"href,omitempty"` Metadata *DatacenterElementMetadata `json:"metadata,omitempty"` - Properties *NatGatewayRuleProperties `json:"properties"` + Properties NatGatewayRuleProperties `json:"properties"` } // NewNatGatewayRule instantiates a new NatGatewayRule object @@ -33,7 +36,7 @@ type NatGatewayRule struct { func NewNatGatewayRule(properties NatGatewayRuleProperties) *NatGatewayRule { this := NatGatewayRule{} - this.Properties = &properties + this.Properties = properties return &this } @@ -46,219 +49,182 @@ func NewNatGatewayRuleWithDefaults() *NatGatewayRule { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *NatGatewayRule) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *NatGatewayRule) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *NatGatewayRule) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *NatGatewayRule) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *NatGatewayRule) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *NatGatewayRule) GetType() *Type { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *NatGatewayRule) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *NatGatewayRule) GetType() Type { + if o == nil || IsNil(o.Type) { + var ret Type + return ret + } + return *o.Type } -// GetTypeOk returns a tuple with the Type field value +// GetTypeOk returns a tuple with the Type 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 *NatGatewayRule) GetTypeOk() (*Type, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *NatGatewayRule) SetType(v Type) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *NatGatewayRule) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *NatGatewayRule) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given Type and assigns it to the Type field. +func (o *NatGatewayRule) SetType(v Type) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *NatGatewayRule) 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 +// GetHrefOk returns a tuple with the Href 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 *NatGatewayRule) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *NatGatewayRule) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *NatGatewayRule) HasHref() bool { - if o != nil && o.Href != nil { + if o != nil && !IsNil(o.Href) { return true } return false } -// GetMetadata returns the Metadata field value -// If the value is explicit nil, nil is returned -func (o *NatGatewayRule) GetMetadata() *DatacenterElementMetadata { - if o == nil { - return nil - } - - return o.Metadata +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *NatGatewayRule) SetHref(v string) { + o.Href = &v +} +// GetMetadata returns the Metadata field value if set, zero value otherwise. +func (o *NatGatewayRule) GetMetadata() DatacenterElementMetadata { + if o == nil || IsNil(o.Metadata) { + var ret DatacenterElementMetadata + return ret + } + return *o.Metadata } -// GetMetadataOk returns a tuple with the Metadata field value +// GetMetadataOk returns a tuple with the Metadata 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 *NatGatewayRule) GetMetadataOk() (*DatacenterElementMetadata, bool) { - if o == nil { + if o == nil || IsNil(o.Metadata) { return nil, false } - return o.Metadata, true } -// SetMetadata sets field value -func (o *NatGatewayRule) SetMetadata(v DatacenterElementMetadata) { - - o.Metadata = &v - -} - // HasMetadata returns a boolean if a field has been set. func (o *NatGatewayRule) HasMetadata() bool { - if o != nil && o.Metadata != nil { + if o != nil && !IsNil(o.Metadata) { return true } return false } +// SetMetadata gets a reference to the given DatacenterElementMetadata and assigns it to the Metadata field. +func (o *NatGatewayRule) SetMetadata(v DatacenterElementMetadata) { + o.Metadata = &v +} + // GetProperties returns the Properties field value -// If the value is explicit nil, nil is returned -func (o *NatGatewayRule) GetProperties() *NatGatewayRuleProperties { +func (o *NatGatewayRule) GetProperties() NatGatewayRuleProperties { if o == nil { - return nil + var ret NatGatewayRuleProperties + return ret } return o.Properties - } // GetPropertiesOk returns a tuple with the Properties field value // 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 *NatGatewayRule) GetPropertiesOk() (*NatGatewayRuleProperties, bool) { if o == nil { return nil, false } - - return o.Properties, true + return &o.Properties, true } // SetProperties sets field value func (o *NatGatewayRule) SetProperties(v NatGatewayRuleProperties) { - - o.Properties = &v - + o.Properties = v } -// HasProperties returns a boolean if a field has been set. -func (o *NatGatewayRule) HasProperties() bool { - if o != nil && o.Properties != nil { - return true +func (o NatGatewayRule) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } - - return false + return json.Marshal(toSerialize) } -func (o NatGatewayRule) MarshalJSON() ([]byte, error) { +func (o NatGatewayRule) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Metadata != nil { + if !IsNil(o.Metadata) { toSerialize["metadata"] = o.Metadata } - - if o.Properties != nil { - toSerialize["properties"] = o.Properties - } - - return json.Marshal(toSerialize) + toSerialize["properties"] = o.Properties + return toSerialize, nil } type NullableNatGatewayRule struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_nat_gateway_rule_properties.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_nat_gateway_rule_properties.go similarity index 66% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_nat_gateway_rule_properties.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_nat_gateway_rule_properties.go index 47c51be6d..57ac6d519 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_nat_gateway_rule_properties.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_nat_gateway_rule_properties.go @@ -14,18 +14,21 @@ import ( "encoding/json" ) +// checks if the NatGatewayRuleProperties type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NatGatewayRuleProperties{} + // NatGatewayRuleProperties struct for NatGatewayRuleProperties type NatGatewayRuleProperties struct { // The name of the NAT Gateway rule. - Name *string `json:"name"` + Name string `json:"name"` // Type of the NAT Gateway rule. Type *NatGatewayRuleType `json:"type,omitempty"` // Protocol of the NAT Gateway rule. Defaults to ALL. If protocol is 'ICMP' then targetPortRange start and end cannot be set. Protocol *NatGatewayRuleProtocol `json:"protocol,omitempty"` // Source subnet of the NAT Gateway rule. For SNAT rules it specifies which packets this translation rule applies to based on the packets source IP address. - SourceSubnet *string `json:"sourceSubnet"` + SourceSubnet string `json:"sourceSubnet"` // Public IP address of the NAT Gateway rule. Specifies the address used for masking outgoing packets source address field. Should be one of the customer reserved IP address already configured on the NAT Gateway resource - PublicIp *string `json:"publicIp"` + PublicIp string `json:"publicIp"` // Target or destination subnet of the NAT Gateway rule. For SNAT rules it specifies which packets this translation rule applies to based on the packets destination IP address. If none is provided, rule will match any address. TargetSubnet *string `json:"targetSubnet,omitempty"` TargetPortRange *TargetPortRange `json:"targetPortRange,omitempty"` @@ -38,9 +41,9 @@ type NatGatewayRuleProperties struct { func NewNatGatewayRuleProperties(name string, sourceSubnet string, publicIp string) *NatGatewayRuleProperties { this := NatGatewayRuleProperties{} - this.Name = &name - this.SourceSubnet = &sourceSubnet - this.PublicIp = &publicIp + this.Name = name + this.SourceSubnet = sourceSubnet + this.PublicIp = publicIp return &this } @@ -54,302 +57,231 @@ func NewNatGatewayRulePropertiesWithDefaults() *NatGatewayRuleProperties { } // GetName returns the Name field value -// If the value is explicit nil, nil is returned -func (o *NatGatewayRuleProperties) GetName() *string { +func (o *NatGatewayRuleProperties) GetName() string { if o == nil { - return 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. -// NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *NatGatewayRuleProperties) GetNameOk() (*string, bool) { if o == nil { return nil, false } - - return o.Name, true + return &o.Name, true } // SetName sets field value func (o *NatGatewayRuleProperties) SetName(v string) { - - o.Name = &v - + o.Name = v } -// HasName returns a boolean if a field has been set. -func (o *NatGatewayRuleProperties) HasName() bool { - if o != nil && o.Name != nil { - return true +// GetType returns the Type field value if set, zero value otherwise. +func (o *NatGatewayRuleProperties) GetType() NatGatewayRuleType { + if o == nil || IsNil(o.Type) { + var ret NatGatewayRuleType + return ret } - - return false -} - -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *NatGatewayRuleProperties) GetType() *NatGatewayRuleType { - if o == nil { - return nil - } - - return o.Type - + return *o.Type } -// GetTypeOk returns a tuple with the Type field value +// GetTypeOk returns a tuple with the Type 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 *NatGatewayRuleProperties) GetTypeOk() (*NatGatewayRuleType, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *NatGatewayRuleProperties) SetType(v NatGatewayRuleType) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *NatGatewayRuleProperties) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetProtocol returns the Protocol field value -// If the value is explicit nil, nil is returned -func (o *NatGatewayRuleProperties) GetProtocol() *NatGatewayRuleProtocol { - if o == nil { - return nil - } - - return o.Protocol +// SetType gets a reference to the given NatGatewayRuleType and assigns it to the Type field. +func (o *NatGatewayRuleProperties) SetType(v NatGatewayRuleType) { + o.Type = &v +} +// GetProtocol returns the Protocol field value if set, zero value otherwise. +func (o *NatGatewayRuleProperties) GetProtocol() NatGatewayRuleProtocol { + if o == nil || IsNil(o.Protocol) { + var ret NatGatewayRuleProtocol + return ret + } + return *o.Protocol } -// GetProtocolOk returns a tuple with the Protocol field value +// GetProtocolOk returns a tuple with the Protocol 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 *NatGatewayRuleProperties) GetProtocolOk() (*NatGatewayRuleProtocol, bool) { - if o == nil { + if o == nil || IsNil(o.Protocol) { return nil, false } - return o.Protocol, true } -// SetProtocol sets field value -func (o *NatGatewayRuleProperties) SetProtocol(v NatGatewayRuleProtocol) { - - o.Protocol = &v - -} - // HasProtocol returns a boolean if a field has been set. func (o *NatGatewayRuleProperties) HasProtocol() bool { - if o != nil && o.Protocol != nil { + if o != nil && !IsNil(o.Protocol) { return true } return false } +// SetProtocol gets a reference to the given NatGatewayRuleProtocol and assigns it to the Protocol field. +func (o *NatGatewayRuleProperties) SetProtocol(v NatGatewayRuleProtocol) { + o.Protocol = &v +} + // GetSourceSubnet returns the SourceSubnet field value -// If the value is explicit nil, nil is returned -func (o *NatGatewayRuleProperties) GetSourceSubnet() *string { +func (o *NatGatewayRuleProperties) GetSourceSubnet() string { if o == nil { - return nil + var ret string + return ret } return o.SourceSubnet - } // GetSourceSubnetOk returns a tuple with the SourceSubnet field value // 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 *NatGatewayRuleProperties) GetSourceSubnetOk() (*string, bool) { if o == nil { return nil, false } - - return o.SourceSubnet, true + return &o.SourceSubnet, true } // SetSourceSubnet sets field value func (o *NatGatewayRuleProperties) SetSourceSubnet(v string) { - - o.SourceSubnet = &v - -} - -// HasSourceSubnet returns a boolean if a field has been set. -func (o *NatGatewayRuleProperties) HasSourceSubnet() bool { - if o != nil && o.SourceSubnet != nil { - return true - } - - return false + o.SourceSubnet = v } // GetPublicIp returns the PublicIp field value -// If the value is explicit nil, nil is returned -func (o *NatGatewayRuleProperties) GetPublicIp() *string { +func (o *NatGatewayRuleProperties) GetPublicIp() string { if o == nil { - return nil + var ret string + return ret } return o.PublicIp - } // GetPublicIpOk returns a tuple with the PublicIp field value // 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 *NatGatewayRuleProperties) GetPublicIpOk() (*string, bool) { if o == nil { return nil, false } - - return o.PublicIp, true + return &o.PublicIp, true } // SetPublicIp sets field value func (o *NatGatewayRuleProperties) SetPublicIp(v string) { - - o.PublicIp = &v - + o.PublicIp = v } -// HasPublicIp returns a boolean if a field has been set. -func (o *NatGatewayRuleProperties) HasPublicIp() bool { - if o != nil && o.PublicIp != nil { - return true +// GetTargetSubnet returns the TargetSubnet field value if set, zero value otherwise. +func (o *NatGatewayRuleProperties) GetTargetSubnet() string { + if o == nil || IsNil(o.TargetSubnet) { + var ret string + return ret } - - return false + return *o.TargetSubnet } -// GetTargetSubnet returns the TargetSubnet field value -// If the value is explicit nil, nil is returned -func (o *NatGatewayRuleProperties) GetTargetSubnet() *string { - if o == nil { - return nil - } - - return o.TargetSubnet - -} - -// GetTargetSubnetOk returns a tuple with the TargetSubnet field value +// GetTargetSubnetOk returns a tuple with the TargetSubnet 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 *NatGatewayRuleProperties) GetTargetSubnetOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.TargetSubnet) { return nil, false } - return o.TargetSubnet, true } -// SetTargetSubnet sets field value -func (o *NatGatewayRuleProperties) SetTargetSubnet(v string) { - - o.TargetSubnet = &v - -} - // HasTargetSubnet returns a boolean if a field has been set. func (o *NatGatewayRuleProperties) HasTargetSubnet() bool { - if o != nil && o.TargetSubnet != nil { + if o != nil && !IsNil(o.TargetSubnet) { return true } return false } -// GetTargetPortRange returns the TargetPortRange field value -// If the value is explicit nil, nil is returned -func (o *NatGatewayRuleProperties) GetTargetPortRange() *TargetPortRange { - if o == nil { - return nil - } - - return o.TargetPortRange +// SetTargetSubnet gets a reference to the given string and assigns it to the TargetSubnet field. +func (o *NatGatewayRuleProperties) SetTargetSubnet(v string) { + o.TargetSubnet = &v +} +// GetTargetPortRange returns the TargetPortRange field value if set, zero value otherwise. +func (o *NatGatewayRuleProperties) GetTargetPortRange() TargetPortRange { + if o == nil || IsNil(o.TargetPortRange) { + var ret TargetPortRange + return ret + } + return *o.TargetPortRange } -// GetTargetPortRangeOk returns a tuple with the TargetPortRange field value +// GetTargetPortRangeOk returns a tuple with the TargetPortRange 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 *NatGatewayRuleProperties) GetTargetPortRangeOk() (*TargetPortRange, bool) { - if o == nil { + if o == nil || IsNil(o.TargetPortRange) { return nil, false } - return o.TargetPortRange, true } -// SetTargetPortRange sets field value -func (o *NatGatewayRuleProperties) SetTargetPortRange(v TargetPortRange) { - - o.TargetPortRange = &v - -} - // HasTargetPortRange returns a boolean if a field has been set. func (o *NatGatewayRuleProperties) HasTargetPortRange() bool { - if o != nil && o.TargetPortRange != nil { + if o != nil && !IsNil(o.TargetPortRange) { return true } return false } +// SetTargetPortRange gets a reference to the given TargetPortRange and assigns it to the TargetPortRange field. +func (o *NatGatewayRuleProperties) SetTargetPortRange(v TargetPortRange) { + o.TargetPortRange = &v +} + func (o NatGatewayRuleProperties) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.Name != nil { - toSerialize["name"] = o.Name + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } + return json.Marshal(toSerialize) +} - if o.Type != nil { +func (o NatGatewayRuleProperties) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["name"] = o.Name + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Protocol != nil { + if !IsNil(o.Protocol) { toSerialize["protocol"] = o.Protocol } - - if o.SourceSubnet != nil { - toSerialize["sourceSubnet"] = o.SourceSubnet - } - - if o.PublicIp != nil { - toSerialize["publicIp"] = o.PublicIp - } - - if o.TargetSubnet != nil { + toSerialize["sourceSubnet"] = o.SourceSubnet + toSerialize["publicIp"] = o.PublicIp + if !IsNil(o.TargetSubnet) { toSerialize["targetSubnet"] = o.TargetSubnet } - - if o.TargetPortRange != nil { + if !IsNil(o.TargetPortRange) { toSerialize["targetPortRange"] = o.TargetPortRange } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableNatGatewayRuleProperties struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_nat_gateway_rule_protocol.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_nat_gateway_rule_protocol.go similarity index 99% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_nat_gateway_rule_protocol.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_nat_gateway_rule_protocol.go index b76366b32..4be9fec20 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_nat_gateway_rule_protocol.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_nat_gateway_rule_protocol.go @@ -12,6 +12,7 @@ package ionoscloud import ( "encoding/json" + "fmt" ) diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_nat_gateway_rule_put.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_nat_gateway_rule_put.go similarity index 68% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_nat_gateway_rule_put.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_nat_gateway_rule_put.go index 32457b0d2..64c90599b 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_nat_gateway_rule_put.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_nat_gateway_rule_put.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the NatGatewayRulePut type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NatGatewayRulePut{} + // NatGatewayRulePut struct for NatGatewayRulePut type NatGatewayRulePut struct { // The resource's unique identifier. @@ -21,8 +24,8 @@ type NatGatewayRulePut struct { // The type of object that has been created. Type *Type `json:"type,omitempty"` // URL to the object representation (absolute path). - Href *string `json:"href,omitempty"` - Properties *NatGatewayRuleProperties `json:"properties"` + Href *string `json:"href,omitempty"` + Properties NatGatewayRuleProperties `json:"properties"` } // NewNatGatewayRulePut instantiates a new NatGatewayRulePut object @@ -32,7 +35,7 @@ type NatGatewayRulePut struct { func NewNatGatewayRulePut(properties NatGatewayRuleProperties) *NatGatewayRulePut { this := NatGatewayRulePut{} - this.Properties = &properties + this.Properties = properties return &this } @@ -45,177 +48,147 @@ func NewNatGatewayRulePutWithDefaults() *NatGatewayRulePut { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *NatGatewayRulePut) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *NatGatewayRulePut) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *NatGatewayRulePut) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *NatGatewayRulePut) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *NatGatewayRulePut) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *NatGatewayRulePut) GetType() *Type { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *NatGatewayRulePut) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *NatGatewayRulePut) GetType() Type { + if o == nil || IsNil(o.Type) { + var ret Type + return ret + } + return *o.Type } -// GetTypeOk returns a tuple with the Type field value +// GetTypeOk returns a tuple with the Type 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 *NatGatewayRulePut) GetTypeOk() (*Type, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *NatGatewayRulePut) SetType(v Type) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *NatGatewayRulePut) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *NatGatewayRulePut) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given Type and assigns it to the Type field. +func (o *NatGatewayRulePut) SetType(v Type) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *NatGatewayRulePut) 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 +// GetHrefOk returns a tuple with the Href 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 *NatGatewayRulePut) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *NatGatewayRulePut) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *NatGatewayRulePut) HasHref() bool { - if o != nil && o.Href != nil { + 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 *NatGatewayRulePut) SetHref(v string) { + o.Href = &v +} + // GetProperties returns the Properties field value -// If the value is explicit nil, nil is returned -func (o *NatGatewayRulePut) GetProperties() *NatGatewayRuleProperties { +func (o *NatGatewayRulePut) GetProperties() NatGatewayRuleProperties { if o == nil { - return nil + var ret NatGatewayRuleProperties + return ret } return o.Properties - } // GetPropertiesOk returns a tuple with the Properties field value // 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 *NatGatewayRulePut) GetPropertiesOk() (*NatGatewayRuleProperties, bool) { if o == nil { return nil, false } - - return o.Properties, true + return &o.Properties, true } // SetProperties sets field value func (o *NatGatewayRulePut) SetProperties(v NatGatewayRuleProperties) { - - o.Properties = &v - + o.Properties = v } -// HasProperties returns a boolean if a field has been set. -func (o *NatGatewayRulePut) HasProperties() bool { - if o != nil && o.Properties != nil { - return true +func (o NatGatewayRulePut) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } - - return false + return json.Marshal(toSerialize) } -func (o NatGatewayRulePut) MarshalJSON() ([]byte, error) { +func (o NatGatewayRulePut) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Properties != nil { - toSerialize["properties"] = o.Properties - } - - return json.Marshal(toSerialize) + toSerialize["properties"] = o.Properties + return toSerialize, nil } type NullableNatGatewayRulePut struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_nat_gateway_rule_type.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_nat_gateway_rule_type.go similarity index 99% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_nat_gateway_rule_type.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_nat_gateway_rule_type.go index ae6f27a89..89b39765e 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_nat_gateway_rule_type.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_nat_gateway_rule_type.go @@ -12,6 +12,7 @@ package ionoscloud import ( "encoding/json" + "fmt" ) diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_nat_gateway_rules.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_nat_gateway_rules.go similarity index 65% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_nat_gateway_rules.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_nat_gateway_rules.go index 08a92ccca..8279eb0e5 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_nat_gateway_rules.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_nat_gateway_rules.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the NatGatewayRules type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NatGatewayRules{} + // NatGatewayRules struct for NatGatewayRules type NatGatewayRules struct { // The resource's unique identifier. @@ -23,7 +26,7 @@ type NatGatewayRules struct { // URL to the object representation (absolute path). Href *string `json:"href,omitempty"` // Array of items in the collection. - Items *[]NatGatewayRule `json:"items,omitempty"` + Items []NatGatewayRule `json:"items,omitempty"` } // NewNatGatewayRules instantiates a new NatGatewayRules object @@ -44,177 +47,157 @@ func NewNatGatewayRulesWithDefaults() *NatGatewayRules { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *NatGatewayRules) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *NatGatewayRules) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *NatGatewayRules) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *NatGatewayRules) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *NatGatewayRules) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *NatGatewayRules) GetType() *Type { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *NatGatewayRules) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *NatGatewayRules) GetType() Type { + if o == nil || IsNil(o.Type) { + var ret Type + return ret + } + return *o.Type } -// GetTypeOk returns a tuple with the Type field value +// GetTypeOk returns a tuple with the Type 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 *NatGatewayRules) GetTypeOk() (*Type, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *NatGatewayRules) SetType(v Type) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *NatGatewayRules) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *NatGatewayRules) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given Type and assigns it to the Type field. +func (o *NatGatewayRules) SetType(v Type) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *NatGatewayRules) 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 +// GetHrefOk returns a tuple with the Href 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 *NatGatewayRules) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *NatGatewayRules) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *NatGatewayRules) HasHref() bool { - if o != nil && o.Href != nil { + if o != nil && !IsNil(o.Href) { return true } return false } -// GetItems returns the Items field value -// If the value is explicit nil, nil is returned -func (o *NatGatewayRules) GetItems() *[]NatGatewayRule { - if o == nil { - return nil - } +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *NatGatewayRules) SetHref(v string) { + o.Href = &v +} +// GetItems returns the Items field value if set, zero value otherwise. +func (o *NatGatewayRules) GetItems() []NatGatewayRule { + if o == nil || IsNil(o.Items) { + var ret []NatGatewayRule + return ret + } return o.Items - } -// GetItemsOk returns a tuple with the Items field value +// GetItemsOk returns a tuple with the Items 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 *NatGatewayRules) GetItemsOk() (*[]NatGatewayRule, bool) { - if o == nil { +func (o *NatGatewayRules) GetItemsOk() ([]NatGatewayRule, bool) { + if o == nil || IsNil(o.Items) { return nil, false } - return o.Items, true } -// SetItems sets field value -func (o *NatGatewayRules) SetItems(v []NatGatewayRule) { - - o.Items = &v - -} - // HasItems returns a boolean if a field has been set. func (o *NatGatewayRules) HasItems() bool { - if o != nil && o.Items != nil { + if o != nil && !IsNil(o.Items) { return true } return false } +// SetItems gets a reference to the given []NatGatewayRule and assigns it to the Items field. +func (o *NatGatewayRules) SetItems(v []NatGatewayRule) { + o.Items = v +} + func (o NatGatewayRules) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o NatGatewayRules) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Items != nil { + if !IsNil(o.Items) { toSerialize["items"] = o.Items } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableNatGatewayRules struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_nat_gateways.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_nat_gateways.go similarity index 60% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_nat_gateways.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_nat_gateways.go index 5ca18aac4..90398ec3c 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_nat_gateways.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_nat_gateways.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the NatGateways type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NatGateways{} + // NatGateways struct for NatGateways type NatGateways struct { // The resource's unique identifier. @@ -23,7 +26,7 @@ type NatGateways struct { // URL to the object representation (absolute path). Href *string `json:"href,omitempty"` // Array of items in the collection. - Items *[]NatGateway `json:"items,omitempty"` + Items []NatGateway `json:"items,omitempty"` // The offset (if specified in the request). Offset *float32 `json:"offset,omitempty"` // The limit (if specified in the request). @@ -49,303 +52,262 @@ func NewNatGatewaysWithDefaults() *NatGateways { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *NatGateways) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *NatGateways) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *NatGateways) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *NatGateways) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *NatGateways) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *NatGateways) GetType() *Type { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *NatGateways) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *NatGateways) GetType() Type { + if o == nil || IsNil(o.Type) { + var ret Type + return ret + } + return *o.Type } -// GetTypeOk returns a tuple with the Type field value +// GetTypeOk returns a tuple with the Type 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 *NatGateways) GetTypeOk() (*Type, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *NatGateways) SetType(v Type) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *NatGateways) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *NatGateways) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given Type and assigns it to the Type field. +func (o *NatGateways) SetType(v Type) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *NatGateways) 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 +// GetHrefOk returns a tuple with the Href 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 *NatGateways) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *NatGateways) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *NatGateways) HasHref() bool { - if o != nil && o.Href != nil { + if o != nil && !IsNil(o.Href) { return true } return false } -// GetItems returns the Items field value -// If the value is explicit nil, nil is returned -func (o *NatGateways) GetItems() *[]NatGateway { - if o == nil { - return nil - } +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *NatGateways) SetHref(v string) { + o.Href = &v +} +// GetItems returns the Items field value if set, zero value otherwise. +func (o *NatGateways) GetItems() []NatGateway { + if o == nil || IsNil(o.Items) { + var ret []NatGateway + return ret + } return o.Items - } -// GetItemsOk returns a tuple with the Items field value +// GetItemsOk returns a tuple with the Items 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 *NatGateways) GetItemsOk() (*[]NatGateway, bool) { - if o == nil { +func (o *NatGateways) GetItemsOk() ([]NatGateway, bool) { + if o == nil || IsNil(o.Items) { return nil, false } - return o.Items, true } -// SetItems sets field value -func (o *NatGateways) SetItems(v []NatGateway) { - - o.Items = &v - -} - // HasItems returns a boolean if a field has been set. func (o *NatGateways) HasItems() bool { - if o != nil && o.Items != nil { + if o != nil && !IsNil(o.Items) { return true } return false } -// GetOffset returns the Offset field value -// If the value is explicit nil, nil is returned -func (o *NatGateways) GetOffset() *float32 { - if o == nil { - return nil - } - - return o.Offset +// SetItems gets a reference to the given []NatGateway and assigns it to the Items field. +func (o *NatGateways) SetItems(v []NatGateway) { + o.Items = v +} +// GetOffset returns the Offset field value if set, zero value otherwise. +func (o *NatGateways) GetOffset() float32 { + if o == nil || IsNil(o.Offset) { + var ret float32 + return ret + } + return *o.Offset } -// GetOffsetOk returns a tuple with the Offset field value +// GetOffsetOk returns a tuple with the Offset 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 *NatGateways) GetOffsetOk() (*float32, bool) { - if o == nil { + if o == nil || IsNil(o.Offset) { return nil, false } - return o.Offset, true } -// SetOffset sets field value -func (o *NatGateways) SetOffset(v float32) { - - o.Offset = &v - -} - // HasOffset returns a boolean if a field has been set. func (o *NatGateways) HasOffset() bool { - if o != nil && o.Offset != nil { + if o != nil && !IsNil(o.Offset) { return true } return false } -// GetLimit returns the Limit field value -// If the value is explicit nil, nil is returned -func (o *NatGateways) GetLimit() *float32 { - if o == nil { - return nil - } - - return o.Limit +// SetOffset gets a reference to the given float32 and assigns it to the Offset field. +func (o *NatGateways) SetOffset(v float32) { + o.Offset = &v +} +// GetLimit returns the Limit field value if set, zero value otherwise. +func (o *NatGateways) GetLimit() float32 { + if o == nil || IsNil(o.Limit) { + var ret float32 + return ret + } + return *o.Limit } -// GetLimitOk returns a tuple with the Limit field value +// GetLimitOk returns a tuple with the Limit 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 *NatGateways) GetLimitOk() (*float32, bool) { - if o == nil { + if o == nil || IsNil(o.Limit) { return nil, false } - return o.Limit, true } -// SetLimit sets field value -func (o *NatGateways) SetLimit(v float32) { - - o.Limit = &v - -} - // HasLimit returns a boolean if a field has been set. func (o *NatGateways) HasLimit() bool { - if o != nil && o.Limit != nil { + if o != nil && !IsNil(o.Limit) { return true } return false } -// GetLinks returns the Links field value -// If the value is explicit nil, nil is returned -func (o *NatGateways) GetLinks() *PaginationLinks { - if o == nil { - return nil - } - - return o.Links +// SetLimit gets a reference to the given float32 and assigns it to the Limit field. +func (o *NatGateways) SetLimit(v float32) { + o.Limit = &v +} +// GetLinks returns the Links field value if set, zero value otherwise. +func (o *NatGateways) GetLinks() PaginationLinks { + if o == nil || IsNil(o.Links) { + var ret PaginationLinks + return ret + } + return *o.Links } -// GetLinksOk returns a tuple with the Links field value +// GetLinksOk returns a tuple with the Links 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 *NatGateways) GetLinksOk() (*PaginationLinks, bool) { - if o == nil { + if o == nil || IsNil(o.Links) { return nil, false } - return o.Links, true } -// SetLinks sets field value -func (o *NatGateways) SetLinks(v PaginationLinks) { - - o.Links = &v - -} - // HasLinks returns a boolean if a field has been set. func (o *NatGateways) HasLinks() bool { - if o != nil && o.Links != nil { + if o != nil && !IsNil(o.Links) { return true } return false } +// SetLinks gets a reference to the given PaginationLinks and assigns it to the Links field. +func (o *NatGateways) SetLinks(v PaginationLinks) { + o.Links = &v +} + func (o NatGateways) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o NatGateways) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Items != nil { + if !IsNil(o.Items) { toSerialize["items"] = o.Items } - - if o.Offset != nil { + if !IsNil(o.Offset) { toSerialize["offset"] = o.Offset } - - if o.Limit != nil { + if !IsNil(o.Limit) { toSerialize["limit"] = o.Limit } - - if o.Links != nil { + if !IsNil(o.Links) { toSerialize["_links"] = o.Links } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableNatGateways struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_network_load_balancer.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_network_load_balancer.go similarity index 61% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_network_load_balancer.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_network_load_balancer.go index 65679bab5..0e62c4e6d 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_network_load_balancer.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_network_load_balancer.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the NetworkLoadBalancer type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NetworkLoadBalancer{} + // NetworkLoadBalancer struct for NetworkLoadBalancer type NetworkLoadBalancer struct { // The resource's unique identifier. @@ -21,10 +24,10 @@ type NetworkLoadBalancer struct { // The type of object that has been created. Type *Type `json:"type,omitempty"` // URL to the object representation (absolute path). - Href *string `json:"href,omitempty"` - Metadata *DatacenterElementMetadata `json:"metadata,omitempty"` - Properties *NetworkLoadBalancerProperties `json:"properties"` - Entities *NetworkLoadBalancerEntities `json:"entities,omitempty"` + Href *string `json:"href,omitempty"` + Metadata *DatacenterElementMetadata `json:"metadata,omitempty"` + Properties NetworkLoadBalancerProperties `json:"properties"` + Entities *NetworkLoadBalancerEntities `json:"entities,omitempty"` } // NewNetworkLoadBalancer instantiates a new NetworkLoadBalancer object @@ -34,7 +37,7 @@ type NetworkLoadBalancer struct { func NewNetworkLoadBalancer(properties NetworkLoadBalancerProperties) *NetworkLoadBalancer { this := NetworkLoadBalancer{} - this.Properties = &properties + this.Properties = properties return &this } @@ -47,261 +50,217 @@ func NewNetworkLoadBalancerWithDefaults() *NetworkLoadBalancer { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *NetworkLoadBalancer) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *NetworkLoadBalancer) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *NetworkLoadBalancer) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *NetworkLoadBalancer) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *NetworkLoadBalancer) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *NetworkLoadBalancer) GetType() *Type { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *NetworkLoadBalancer) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *NetworkLoadBalancer) GetType() Type { + if o == nil || IsNil(o.Type) { + var ret Type + return ret + } + return *o.Type } -// GetTypeOk returns a tuple with the Type field value +// GetTypeOk returns a tuple with the Type 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 *NetworkLoadBalancer) GetTypeOk() (*Type, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *NetworkLoadBalancer) SetType(v Type) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *NetworkLoadBalancer) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *NetworkLoadBalancer) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given Type and assigns it to the Type field. +func (o *NetworkLoadBalancer) SetType(v Type) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *NetworkLoadBalancer) 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 +// GetHrefOk returns a tuple with the Href 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 *NetworkLoadBalancer) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *NetworkLoadBalancer) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *NetworkLoadBalancer) HasHref() bool { - if o != nil && o.Href != nil { + if o != nil && !IsNil(o.Href) { return true } return false } -// GetMetadata returns the Metadata field value -// If the value is explicit nil, nil is returned -func (o *NetworkLoadBalancer) GetMetadata() *DatacenterElementMetadata { - if o == nil { - return nil - } - - return o.Metadata +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *NetworkLoadBalancer) SetHref(v string) { + o.Href = &v +} +// GetMetadata returns the Metadata field value if set, zero value otherwise. +func (o *NetworkLoadBalancer) GetMetadata() DatacenterElementMetadata { + if o == nil || IsNil(o.Metadata) { + var ret DatacenterElementMetadata + return ret + } + return *o.Metadata } -// GetMetadataOk returns a tuple with the Metadata field value +// GetMetadataOk returns a tuple with the Metadata 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 *NetworkLoadBalancer) GetMetadataOk() (*DatacenterElementMetadata, bool) { - if o == nil { + if o == nil || IsNil(o.Metadata) { return nil, false } - return o.Metadata, true } -// SetMetadata sets field value -func (o *NetworkLoadBalancer) SetMetadata(v DatacenterElementMetadata) { - - o.Metadata = &v - -} - // HasMetadata returns a boolean if a field has been set. func (o *NetworkLoadBalancer) HasMetadata() bool { - if o != nil && o.Metadata != nil { + if o != nil && !IsNil(o.Metadata) { return true } return false } +// SetMetadata gets a reference to the given DatacenterElementMetadata and assigns it to the Metadata field. +func (o *NetworkLoadBalancer) SetMetadata(v DatacenterElementMetadata) { + o.Metadata = &v +} + // GetProperties returns the Properties field value -// If the value is explicit nil, nil is returned -func (o *NetworkLoadBalancer) GetProperties() *NetworkLoadBalancerProperties { +func (o *NetworkLoadBalancer) GetProperties() NetworkLoadBalancerProperties { if o == nil { - return nil + var ret NetworkLoadBalancerProperties + return ret } return o.Properties - } // GetPropertiesOk returns a tuple with the Properties field value // 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 *NetworkLoadBalancer) GetPropertiesOk() (*NetworkLoadBalancerProperties, bool) { if o == nil { return nil, false } - - return o.Properties, true + return &o.Properties, true } // SetProperties sets field value func (o *NetworkLoadBalancer) SetProperties(v NetworkLoadBalancerProperties) { - - o.Properties = &v - -} - -// HasProperties returns a boolean if a field has been set. -func (o *NetworkLoadBalancer) HasProperties() bool { - if o != nil && o.Properties != nil { - return true - } - - return false + o.Properties = v } -// GetEntities returns the Entities field value -// If the value is explicit nil, nil is returned -func (o *NetworkLoadBalancer) GetEntities() *NetworkLoadBalancerEntities { - if o == nil { - return nil +// GetEntities returns the Entities field value if set, zero value otherwise. +func (o *NetworkLoadBalancer) GetEntities() NetworkLoadBalancerEntities { + if o == nil || IsNil(o.Entities) { + var ret NetworkLoadBalancerEntities + return ret } - - return o.Entities - + return *o.Entities } -// GetEntitiesOk returns a tuple with the Entities field value +// GetEntitiesOk returns a tuple with the Entities 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 *NetworkLoadBalancer) GetEntitiesOk() (*NetworkLoadBalancerEntities, bool) { - if o == nil { + if o == nil || IsNil(o.Entities) { return nil, false } - return o.Entities, true } -// SetEntities sets field value -func (o *NetworkLoadBalancer) SetEntities(v NetworkLoadBalancerEntities) { - - o.Entities = &v - -} - // HasEntities returns a boolean if a field has been set. func (o *NetworkLoadBalancer) HasEntities() bool { - if o != nil && o.Entities != nil { + if o != nil && !IsNil(o.Entities) { return true } return false } +// SetEntities gets a reference to the given NetworkLoadBalancerEntities and assigns it to the Entities field. +func (o *NetworkLoadBalancer) SetEntities(v NetworkLoadBalancerEntities) { + o.Entities = &v +} + func (o NetworkLoadBalancer) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o NetworkLoadBalancer) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Metadata != nil { + if !IsNil(o.Metadata) { toSerialize["metadata"] = o.Metadata } - - if o.Properties != nil { - toSerialize["properties"] = o.Properties - } - - if o.Entities != nil { + toSerialize["properties"] = o.Properties + if !IsNil(o.Entities) { toSerialize["entities"] = o.Entities } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableNetworkLoadBalancer struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_network_load_balancer_entities.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_network_load_balancer_entities.go similarity index 72% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_network_load_balancer_entities.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_network_load_balancer_entities.go index 876550227..070cd857d 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_network_load_balancer_entities.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_network_load_balancer_entities.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the NetworkLoadBalancerEntities type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NetworkLoadBalancerEntities{} + // NetworkLoadBalancerEntities struct for NetworkLoadBalancerEntities type NetworkLoadBalancerEntities struct { Flowlogs *FlowLogs `json:"flowlogs,omitempty"` @@ -38,93 +41,87 @@ func NewNetworkLoadBalancerEntitiesWithDefaults() *NetworkLoadBalancerEntities { return &this } -// GetFlowlogs returns the Flowlogs field value -// If the value is explicit nil, nil is returned -func (o *NetworkLoadBalancerEntities) GetFlowlogs() *FlowLogs { - if o == nil { - return nil +// GetFlowlogs returns the Flowlogs field value if set, zero value otherwise. +func (o *NetworkLoadBalancerEntities) GetFlowlogs() FlowLogs { + if o == nil || IsNil(o.Flowlogs) { + var ret FlowLogs + return ret } - - return o.Flowlogs - + return *o.Flowlogs } -// GetFlowlogsOk returns a tuple with the Flowlogs field value +// GetFlowlogsOk returns a tuple with the Flowlogs 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 *NetworkLoadBalancerEntities) GetFlowlogsOk() (*FlowLogs, bool) { - if o == nil { + if o == nil || IsNil(o.Flowlogs) { return nil, false } - return o.Flowlogs, true } -// SetFlowlogs sets field value -func (o *NetworkLoadBalancerEntities) SetFlowlogs(v FlowLogs) { - - o.Flowlogs = &v - -} - // HasFlowlogs returns a boolean if a field has been set. func (o *NetworkLoadBalancerEntities) HasFlowlogs() bool { - if o != nil && o.Flowlogs != nil { + if o != nil && !IsNil(o.Flowlogs) { return true } return false } -// GetForwardingrules returns the Forwardingrules field value -// If the value is explicit nil, nil is returned -func (o *NetworkLoadBalancerEntities) GetForwardingrules() *NetworkLoadBalancerForwardingRules { - if o == nil { - return nil - } - - return o.Forwardingrules +// SetFlowlogs gets a reference to the given FlowLogs and assigns it to the Flowlogs field. +func (o *NetworkLoadBalancerEntities) SetFlowlogs(v FlowLogs) { + o.Flowlogs = &v +} +// GetForwardingrules returns the Forwardingrules field value if set, zero value otherwise. +func (o *NetworkLoadBalancerEntities) GetForwardingrules() NetworkLoadBalancerForwardingRules { + if o == nil || IsNil(o.Forwardingrules) { + var ret NetworkLoadBalancerForwardingRules + return ret + } + return *o.Forwardingrules } -// GetForwardingrulesOk returns a tuple with the Forwardingrules field value +// GetForwardingrulesOk returns a tuple with the Forwardingrules 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 *NetworkLoadBalancerEntities) GetForwardingrulesOk() (*NetworkLoadBalancerForwardingRules, bool) { - if o == nil { + if o == nil || IsNil(o.Forwardingrules) { return nil, false } - return o.Forwardingrules, true } -// SetForwardingrules sets field value -func (o *NetworkLoadBalancerEntities) SetForwardingrules(v NetworkLoadBalancerForwardingRules) { - - o.Forwardingrules = &v - -} - // HasForwardingrules returns a boolean if a field has been set. func (o *NetworkLoadBalancerEntities) HasForwardingrules() bool { - if o != nil && o.Forwardingrules != nil { + if o != nil && !IsNil(o.Forwardingrules) { return true } return false } +// SetForwardingrules gets a reference to the given NetworkLoadBalancerForwardingRules and assigns it to the Forwardingrules field. +func (o *NetworkLoadBalancerEntities) SetForwardingrules(v NetworkLoadBalancerForwardingRules) { + o.Forwardingrules = &v +} + func (o NetworkLoadBalancerEntities) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o NetworkLoadBalancerEntities) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Flowlogs != nil { + if !IsNil(o.Flowlogs) { toSerialize["flowlogs"] = o.Flowlogs } - - if o.Forwardingrules != nil { + if !IsNil(o.Forwardingrules) { toSerialize["forwardingrules"] = o.Forwardingrules } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableNetworkLoadBalancerEntities struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_network_load_balancer_forwarding_rule.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_network_load_balancer_forwarding_rule.go similarity index 66% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_network_load_balancer_forwarding_rule.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_network_load_balancer_forwarding_rule.go index b171b7d47..24f3055ac 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_network_load_balancer_forwarding_rule.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_network_load_balancer_forwarding_rule.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the NetworkLoadBalancerForwardingRule type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NetworkLoadBalancerForwardingRule{} + // NetworkLoadBalancerForwardingRule struct for NetworkLoadBalancerForwardingRule type NetworkLoadBalancerForwardingRule struct { // The resource's unique identifier. @@ -21,9 +24,9 @@ type NetworkLoadBalancerForwardingRule struct { // The type of object that has been created. Type *Type `json:"type,omitempty"` // URL to the object representation (absolute path). - Href *string `json:"href,omitempty"` - Metadata *DatacenterElementMetadata `json:"metadata,omitempty"` - Properties *NetworkLoadBalancerForwardingRuleProperties `json:"properties"` + Href *string `json:"href,omitempty"` + Metadata *DatacenterElementMetadata `json:"metadata,omitempty"` + Properties NetworkLoadBalancerForwardingRuleProperties `json:"properties"` } // NewNetworkLoadBalancerForwardingRule instantiates a new NetworkLoadBalancerForwardingRule object @@ -33,7 +36,7 @@ type NetworkLoadBalancerForwardingRule struct { func NewNetworkLoadBalancerForwardingRule(properties NetworkLoadBalancerForwardingRuleProperties) *NetworkLoadBalancerForwardingRule { this := NetworkLoadBalancerForwardingRule{} - this.Properties = &properties + this.Properties = properties return &this } @@ -46,219 +49,182 @@ func NewNetworkLoadBalancerForwardingRuleWithDefaults() *NetworkLoadBalancerForw return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *NetworkLoadBalancerForwardingRule) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *NetworkLoadBalancerForwardingRule) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *NetworkLoadBalancerForwardingRule) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *NetworkLoadBalancerForwardingRule) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *NetworkLoadBalancerForwardingRule) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *NetworkLoadBalancerForwardingRule) GetType() *Type { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *NetworkLoadBalancerForwardingRule) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *NetworkLoadBalancerForwardingRule) GetType() Type { + if o == nil || IsNil(o.Type) { + var ret Type + return ret + } + return *o.Type } -// GetTypeOk returns a tuple with the Type field value +// GetTypeOk returns a tuple with the Type 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 *NetworkLoadBalancerForwardingRule) GetTypeOk() (*Type, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *NetworkLoadBalancerForwardingRule) SetType(v Type) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *NetworkLoadBalancerForwardingRule) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *NetworkLoadBalancerForwardingRule) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given Type and assigns it to the Type field. +func (o *NetworkLoadBalancerForwardingRule) SetType(v Type) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *NetworkLoadBalancerForwardingRule) 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 +// GetHrefOk returns a tuple with the Href 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 *NetworkLoadBalancerForwardingRule) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *NetworkLoadBalancerForwardingRule) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *NetworkLoadBalancerForwardingRule) HasHref() bool { - if o != nil && o.Href != nil { + if o != nil && !IsNil(o.Href) { return true } return false } -// GetMetadata returns the Metadata field value -// If the value is explicit nil, nil is returned -func (o *NetworkLoadBalancerForwardingRule) GetMetadata() *DatacenterElementMetadata { - if o == nil { - return nil - } - - return o.Metadata +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *NetworkLoadBalancerForwardingRule) SetHref(v string) { + o.Href = &v +} +// GetMetadata returns the Metadata field value if set, zero value otherwise. +func (o *NetworkLoadBalancerForwardingRule) GetMetadata() DatacenterElementMetadata { + if o == nil || IsNil(o.Metadata) { + var ret DatacenterElementMetadata + return ret + } + return *o.Metadata } -// GetMetadataOk returns a tuple with the Metadata field value +// GetMetadataOk returns a tuple with the Metadata 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 *NetworkLoadBalancerForwardingRule) GetMetadataOk() (*DatacenterElementMetadata, bool) { - if o == nil { + if o == nil || IsNil(o.Metadata) { return nil, false } - return o.Metadata, true } -// SetMetadata sets field value -func (o *NetworkLoadBalancerForwardingRule) SetMetadata(v DatacenterElementMetadata) { - - o.Metadata = &v - -} - // HasMetadata returns a boolean if a field has been set. func (o *NetworkLoadBalancerForwardingRule) HasMetadata() bool { - if o != nil && o.Metadata != nil { + if o != nil && !IsNil(o.Metadata) { return true } return false } +// SetMetadata gets a reference to the given DatacenterElementMetadata and assigns it to the Metadata field. +func (o *NetworkLoadBalancerForwardingRule) SetMetadata(v DatacenterElementMetadata) { + o.Metadata = &v +} + // GetProperties returns the Properties field value -// If the value is explicit nil, nil is returned -func (o *NetworkLoadBalancerForwardingRule) GetProperties() *NetworkLoadBalancerForwardingRuleProperties { +func (o *NetworkLoadBalancerForwardingRule) GetProperties() NetworkLoadBalancerForwardingRuleProperties { if o == nil { - return nil + var ret NetworkLoadBalancerForwardingRuleProperties + return ret } return o.Properties - } // GetPropertiesOk returns a tuple with the Properties field value // 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 *NetworkLoadBalancerForwardingRule) GetPropertiesOk() (*NetworkLoadBalancerForwardingRuleProperties, bool) { if o == nil { return nil, false } - - return o.Properties, true + return &o.Properties, true } // SetProperties sets field value func (o *NetworkLoadBalancerForwardingRule) SetProperties(v NetworkLoadBalancerForwardingRuleProperties) { - - o.Properties = &v - + o.Properties = v } -// HasProperties returns a boolean if a field has been set. -func (o *NetworkLoadBalancerForwardingRule) HasProperties() bool { - if o != nil && o.Properties != nil { - return true +func (o NetworkLoadBalancerForwardingRule) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } - - return false + return json.Marshal(toSerialize) } -func (o NetworkLoadBalancerForwardingRule) MarshalJSON() ([]byte, error) { +func (o NetworkLoadBalancerForwardingRule) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Metadata != nil { + if !IsNil(o.Metadata) { toSerialize["metadata"] = o.Metadata } - - if o.Properties != nil { - toSerialize["properties"] = o.Properties - } - - return json.Marshal(toSerialize) + toSerialize["properties"] = o.Properties + return toSerialize, nil } type NullableNetworkLoadBalancerForwardingRule struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_network_load_balancer_forwarding_rule_health_check.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_network_load_balancer_forwarding_rule_health_check.go similarity index 74% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_network_load_balancer_forwarding_rule_health_check.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_network_load_balancer_forwarding_rule_health_check.go index d793b4e56..083b243aa 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_network_load_balancer_forwarding_rule_health_check.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_network_load_balancer_forwarding_rule_health_check.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the NetworkLoadBalancerForwardingRuleHealthCheck type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NetworkLoadBalancerForwardingRuleHealthCheck{} + // NetworkLoadBalancerForwardingRuleHealthCheck struct for NetworkLoadBalancerForwardingRuleHealthCheck type NetworkLoadBalancerForwardingRuleHealthCheck struct { // The maximum time in milliseconds to wait for the client to acknowledge or send data; default is 50,000 (50 seconds). @@ -44,177 +47,157 @@ func NewNetworkLoadBalancerForwardingRuleHealthCheckWithDefaults() *NetworkLoadB return &this } -// GetClientTimeout returns the ClientTimeout field value -// If the value is explicit nil, nil is returned -func (o *NetworkLoadBalancerForwardingRuleHealthCheck) GetClientTimeout() *int32 { - if o == nil { - return nil +// GetClientTimeout returns the ClientTimeout field value if set, zero value otherwise. +func (o *NetworkLoadBalancerForwardingRuleHealthCheck) GetClientTimeout() int32 { + if o == nil || IsNil(o.ClientTimeout) { + var ret int32 + return ret } - - return o.ClientTimeout - + return *o.ClientTimeout } -// GetClientTimeoutOk returns a tuple with the ClientTimeout field value +// GetClientTimeoutOk returns a tuple with the ClientTimeout 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 *NetworkLoadBalancerForwardingRuleHealthCheck) GetClientTimeoutOk() (*int32, bool) { - if o == nil { + if o == nil || IsNil(o.ClientTimeout) { return nil, false } - return o.ClientTimeout, true } -// SetClientTimeout sets field value -func (o *NetworkLoadBalancerForwardingRuleHealthCheck) SetClientTimeout(v int32) { - - o.ClientTimeout = &v - -} - // HasClientTimeout returns a boolean if a field has been set. func (o *NetworkLoadBalancerForwardingRuleHealthCheck) HasClientTimeout() bool { - if o != nil && o.ClientTimeout != nil { + if o != nil && !IsNil(o.ClientTimeout) { return true } return false } -// GetConnectTimeout returns the ConnectTimeout field value -// If the value is explicit nil, nil is returned -func (o *NetworkLoadBalancerForwardingRuleHealthCheck) GetConnectTimeout() *int32 { - if o == nil { - return nil - } - - return o.ConnectTimeout +// SetClientTimeout gets a reference to the given int32 and assigns it to the ClientTimeout field. +func (o *NetworkLoadBalancerForwardingRuleHealthCheck) SetClientTimeout(v int32) { + o.ClientTimeout = &v +} +// GetConnectTimeout returns the ConnectTimeout field value if set, zero value otherwise. +func (o *NetworkLoadBalancerForwardingRuleHealthCheck) GetConnectTimeout() int32 { + if o == nil || IsNil(o.ConnectTimeout) { + var ret int32 + return ret + } + return *o.ConnectTimeout } -// GetConnectTimeoutOk returns a tuple with the ConnectTimeout field value +// GetConnectTimeoutOk returns a tuple with the ConnectTimeout 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 *NetworkLoadBalancerForwardingRuleHealthCheck) GetConnectTimeoutOk() (*int32, bool) { - if o == nil { + if o == nil || IsNil(o.ConnectTimeout) { return nil, false } - return o.ConnectTimeout, true } -// SetConnectTimeout sets field value -func (o *NetworkLoadBalancerForwardingRuleHealthCheck) SetConnectTimeout(v int32) { - - o.ConnectTimeout = &v - -} - // HasConnectTimeout returns a boolean if a field has been set. func (o *NetworkLoadBalancerForwardingRuleHealthCheck) HasConnectTimeout() bool { - if o != nil && o.ConnectTimeout != nil { + if o != nil && !IsNil(o.ConnectTimeout) { return true } return false } -// GetTargetTimeout returns the TargetTimeout field value -// If the value is explicit nil, nil is returned -func (o *NetworkLoadBalancerForwardingRuleHealthCheck) GetTargetTimeout() *int32 { - if o == nil { - return nil - } - - return o.TargetTimeout +// SetConnectTimeout gets a reference to the given int32 and assigns it to the ConnectTimeout field. +func (o *NetworkLoadBalancerForwardingRuleHealthCheck) SetConnectTimeout(v int32) { + o.ConnectTimeout = &v +} +// GetTargetTimeout returns the TargetTimeout field value if set, zero value otherwise. +func (o *NetworkLoadBalancerForwardingRuleHealthCheck) GetTargetTimeout() int32 { + if o == nil || IsNil(o.TargetTimeout) { + var ret int32 + return ret + } + return *o.TargetTimeout } -// GetTargetTimeoutOk returns a tuple with the TargetTimeout field value +// GetTargetTimeoutOk returns a tuple with the TargetTimeout 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 *NetworkLoadBalancerForwardingRuleHealthCheck) GetTargetTimeoutOk() (*int32, bool) { - if o == nil { + if o == nil || IsNil(o.TargetTimeout) { return nil, false } - return o.TargetTimeout, true } -// SetTargetTimeout sets field value -func (o *NetworkLoadBalancerForwardingRuleHealthCheck) SetTargetTimeout(v int32) { - - o.TargetTimeout = &v - -} - // HasTargetTimeout returns a boolean if a field has been set. func (o *NetworkLoadBalancerForwardingRuleHealthCheck) HasTargetTimeout() bool { - if o != nil && o.TargetTimeout != nil { + if o != nil && !IsNil(o.TargetTimeout) { return true } return false } -// GetRetries returns the Retries field value -// If the value is explicit nil, nil is returned -func (o *NetworkLoadBalancerForwardingRuleHealthCheck) GetRetries() *int32 { - if o == nil { - return nil - } - - return o.Retries +// SetTargetTimeout gets a reference to the given int32 and assigns it to the TargetTimeout field. +func (o *NetworkLoadBalancerForwardingRuleHealthCheck) SetTargetTimeout(v int32) { + o.TargetTimeout = &v +} +// GetRetries returns the Retries field value if set, zero value otherwise. +func (o *NetworkLoadBalancerForwardingRuleHealthCheck) GetRetries() int32 { + if o == nil || IsNil(o.Retries) { + var ret int32 + return ret + } + return *o.Retries } -// GetRetriesOk returns a tuple with the Retries field value +// GetRetriesOk returns a tuple with the Retries 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 *NetworkLoadBalancerForwardingRuleHealthCheck) GetRetriesOk() (*int32, bool) { - if o == nil { + if o == nil || IsNil(o.Retries) { return nil, false } - return o.Retries, true } -// SetRetries sets field value -func (o *NetworkLoadBalancerForwardingRuleHealthCheck) SetRetries(v int32) { - - o.Retries = &v - -} - // HasRetries returns a boolean if a field has been set. func (o *NetworkLoadBalancerForwardingRuleHealthCheck) HasRetries() bool { - if o != nil && o.Retries != nil { + if o != nil && !IsNil(o.Retries) { return true } return false } +// SetRetries gets a reference to the given int32 and assigns it to the Retries field. +func (o *NetworkLoadBalancerForwardingRuleHealthCheck) SetRetries(v int32) { + o.Retries = &v +} + func (o NetworkLoadBalancerForwardingRuleHealthCheck) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o NetworkLoadBalancerForwardingRuleHealthCheck) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.ClientTimeout != nil { + if !IsNil(o.ClientTimeout) { toSerialize["clientTimeout"] = o.ClientTimeout } - - if o.ConnectTimeout != nil { + if !IsNil(o.ConnectTimeout) { toSerialize["connectTimeout"] = o.ConnectTimeout } - - if o.TargetTimeout != nil { + if !IsNil(o.TargetTimeout) { toSerialize["targetTimeout"] = o.TargetTimeout } - - if o.Retries != nil { + if !IsNil(o.Retries) { toSerialize["retries"] = o.Retries } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableNetworkLoadBalancerForwardingRuleHealthCheck struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_network_load_balancer_forwarding_rule_properties.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_network_load_balancer_forwarding_rule_properties.go similarity index 66% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_network_load_balancer_forwarding_rule_properties.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_network_load_balancer_forwarding_rule_properties.go index 9ecd9569b..36fc309e3 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_network_load_balancer_forwarding_rule_properties.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_network_load_balancer_forwarding_rule_properties.go @@ -14,21 +14,24 @@ import ( "encoding/json" ) +// checks if the NetworkLoadBalancerForwardingRuleProperties type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NetworkLoadBalancerForwardingRuleProperties{} + // NetworkLoadBalancerForwardingRuleProperties struct for NetworkLoadBalancerForwardingRuleProperties type NetworkLoadBalancerForwardingRuleProperties struct { // The name of the Network Load Balancer forwarding rule. - Name *string `json:"name"` + Name string `json:"name"` // Balancing algorithm - Algorithm *string `json:"algorithm"` + Algorithm string `json:"algorithm"` // Balancing protocol - Protocol *string `json:"protocol"` + Protocol string `json:"protocol"` // Listening (inbound) IP. - ListenerIp *string `json:"listenerIp"` + ListenerIp string `json:"listenerIp"` // Listening (inbound) port number; valid range is 1 to 65535. - ListenerPort *int32 `json:"listenerPort"` + ListenerPort int32 `json:"listenerPort"` HealthCheck *NetworkLoadBalancerForwardingRuleHealthCheck `json:"healthCheck,omitempty"` // Array of items in the collection. - Targets *[]NetworkLoadBalancerForwardingRuleTarget `json:"targets"` + Targets []NetworkLoadBalancerForwardingRuleTarget `json:"targets"` } // NewNetworkLoadBalancerForwardingRuleProperties instantiates a new NetworkLoadBalancerForwardingRuleProperties object @@ -38,12 +41,12 @@ type NetworkLoadBalancerForwardingRuleProperties struct { func NewNetworkLoadBalancerForwardingRuleProperties(name string, algorithm string, protocol string, listenerIp string, listenerPort int32, targets []NetworkLoadBalancerForwardingRuleTarget) *NetworkLoadBalancerForwardingRuleProperties { this := NetworkLoadBalancerForwardingRuleProperties{} - this.Name = &name - this.Algorithm = &algorithm - this.Protocol = &protocol - this.ListenerIp = &listenerIp - this.ListenerPort = &listenerPort - this.Targets = &targets + this.Name = name + this.Algorithm = algorithm + this.Protocol = protocol + this.ListenerIp = listenerIp + this.ListenerPort = listenerPort + this.Targets = targets return &this } @@ -57,302 +60,201 @@ func NewNetworkLoadBalancerForwardingRulePropertiesWithDefaults() *NetworkLoadBa } // GetName returns the Name field value -// If the value is explicit nil, nil is returned -func (o *NetworkLoadBalancerForwardingRuleProperties) GetName() *string { +func (o *NetworkLoadBalancerForwardingRuleProperties) GetName() string { if o == nil { - return 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. -// NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *NetworkLoadBalancerForwardingRuleProperties) GetNameOk() (*string, bool) { if o == nil { return nil, false } - - return o.Name, true + return &o.Name, true } // SetName sets field value func (o *NetworkLoadBalancerForwardingRuleProperties) SetName(v string) { - - o.Name = &v - -} - -// HasName returns a boolean if a field has been set. -func (o *NetworkLoadBalancerForwardingRuleProperties) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false + o.Name = v } // GetAlgorithm returns the Algorithm field value -// If the value is explicit nil, nil is returned -func (o *NetworkLoadBalancerForwardingRuleProperties) GetAlgorithm() *string { +func (o *NetworkLoadBalancerForwardingRuleProperties) GetAlgorithm() string { if o == nil { - return nil + var ret string + return ret } return o.Algorithm - } // GetAlgorithmOk returns a tuple with the Algorithm field value // 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 *NetworkLoadBalancerForwardingRuleProperties) GetAlgorithmOk() (*string, bool) { if o == nil { return nil, false } - - return o.Algorithm, true + return &o.Algorithm, true } // SetAlgorithm sets field value func (o *NetworkLoadBalancerForwardingRuleProperties) SetAlgorithm(v string) { - - o.Algorithm = &v - -} - -// HasAlgorithm returns a boolean if a field has been set. -func (o *NetworkLoadBalancerForwardingRuleProperties) HasAlgorithm() bool { - if o != nil && o.Algorithm != nil { - return true - } - - return false + o.Algorithm = v } // GetProtocol returns the Protocol field value -// If the value is explicit nil, nil is returned -func (o *NetworkLoadBalancerForwardingRuleProperties) GetProtocol() *string { +func (o *NetworkLoadBalancerForwardingRuleProperties) GetProtocol() string { if o == nil { - return nil + var ret string + return ret } return o.Protocol - } // GetProtocolOk returns a tuple with the Protocol field value // 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 *NetworkLoadBalancerForwardingRuleProperties) GetProtocolOk() (*string, bool) { if o == nil { return nil, false } - - return o.Protocol, true + return &o.Protocol, true } // SetProtocol sets field value func (o *NetworkLoadBalancerForwardingRuleProperties) SetProtocol(v string) { - - o.Protocol = &v - -} - -// HasProtocol returns a boolean if a field has been set. -func (o *NetworkLoadBalancerForwardingRuleProperties) HasProtocol() bool { - if o != nil && o.Protocol != nil { - return true - } - - return false + o.Protocol = v } // GetListenerIp returns the ListenerIp field value -// If the value is explicit nil, nil is returned -func (o *NetworkLoadBalancerForwardingRuleProperties) GetListenerIp() *string { +func (o *NetworkLoadBalancerForwardingRuleProperties) GetListenerIp() string { if o == nil { - return nil + var ret string + return ret } return o.ListenerIp - } // GetListenerIpOk returns a tuple with the ListenerIp field value // 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 *NetworkLoadBalancerForwardingRuleProperties) GetListenerIpOk() (*string, bool) { if o == nil { return nil, false } - - return o.ListenerIp, true + return &o.ListenerIp, true } // SetListenerIp sets field value func (o *NetworkLoadBalancerForwardingRuleProperties) SetListenerIp(v string) { - - o.ListenerIp = &v - -} - -// HasListenerIp returns a boolean if a field has been set. -func (o *NetworkLoadBalancerForwardingRuleProperties) HasListenerIp() bool { - if o != nil && o.ListenerIp != nil { - return true - } - - return false + o.ListenerIp = v } // GetListenerPort returns the ListenerPort field value -// If the value is explicit nil, nil is returned -func (o *NetworkLoadBalancerForwardingRuleProperties) GetListenerPort() *int32 { +func (o *NetworkLoadBalancerForwardingRuleProperties) GetListenerPort() int32 { if o == nil { - return nil + var ret int32 + return ret } return o.ListenerPort - } // GetListenerPortOk returns a tuple with the ListenerPort field value // 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 *NetworkLoadBalancerForwardingRuleProperties) GetListenerPortOk() (*int32, bool) { if o == nil { return nil, false } - - return o.ListenerPort, true + return &o.ListenerPort, true } // SetListenerPort sets field value func (o *NetworkLoadBalancerForwardingRuleProperties) SetListenerPort(v int32) { - - o.ListenerPort = &v - + o.ListenerPort = v } -// HasListenerPort returns a boolean if a field has been set. -func (o *NetworkLoadBalancerForwardingRuleProperties) HasListenerPort() bool { - if o != nil && o.ListenerPort != nil { - return true - } - - return false -} - -// GetHealthCheck returns the HealthCheck field value -// If the value is explicit nil, nil is returned -func (o *NetworkLoadBalancerForwardingRuleProperties) GetHealthCheck() *NetworkLoadBalancerForwardingRuleHealthCheck { - if o == nil { - return nil +// GetHealthCheck returns the HealthCheck field value if set, zero value otherwise. +func (o *NetworkLoadBalancerForwardingRuleProperties) GetHealthCheck() NetworkLoadBalancerForwardingRuleHealthCheck { + if o == nil || IsNil(o.HealthCheck) { + var ret NetworkLoadBalancerForwardingRuleHealthCheck + return ret } - - return o.HealthCheck - + return *o.HealthCheck } -// GetHealthCheckOk returns a tuple with the HealthCheck field value +// GetHealthCheckOk returns a tuple with the HealthCheck 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 *NetworkLoadBalancerForwardingRuleProperties) GetHealthCheckOk() (*NetworkLoadBalancerForwardingRuleHealthCheck, bool) { - if o == nil { + if o == nil || IsNil(o.HealthCheck) { return nil, false } - return o.HealthCheck, true } -// SetHealthCheck sets field value -func (o *NetworkLoadBalancerForwardingRuleProperties) SetHealthCheck(v NetworkLoadBalancerForwardingRuleHealthCheck) { - - o.HealthCheck = &v - -} - // HasHealthCheck returns a boolean if a field has been set. func (o *NetworkLoadBalancerForwardingRuleProperties) HasHealthCheck() bool { - if o != nil && o.HealthCheck != nil { + if o != nil && !IsNil(o.HealthCheck) { return true } return false } +// SetHealthCheck gets a reference to the given NetworkLoadBalancerForwardingRuleHealthCheck and assigns it to the HealthCheck field. +func (o *NetworkLoadBalancerForwardingRuleProperties) SetHealthCheck(v NetworkLoadBalancerForwardingRuleHealthCheck) { + o.HealthCheck = &v +} + // GetTargets returns the Targets field value -// If the value is explicit nil, nil is returned -func (o *NetworkLoadBalancerForwardingRuleProperties) GetTargets() *[]NetworkLoadBalancerForwardingRuleTarget { +func (o *NetworkLoadBalancerForwardingRuleProperties) GetTargets() []NetworkLoadBalancerForwardingRuleTarget { if o == nil { - return nil + var ret []NetworkLoadBalancerForwardingRuleTarget + return ret } return o.Targets - } // GetTargetsOk returns a tuple with the Targets field value // 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 *NetworkLoadBalancerForwardingRuleProperties) GetTargetsOk() (*[]NetworkLoadBalancerForwardingRuleTarget, bool) { +func (o *NetworkLoadBalancerForwardingRuleProperties) GetTargetsOk() ([]NetworkLoadBalancerForwardingRuleTarget, bool) { if o == nil { return nil, false } - return o.Targets, true } // SetTargets sets field value func (o *NetworkLoadBalancerForwardingRuleProperties) SetTargets(v []NetworkLoadBalancerForwardingRuleTarget) { - - o.Targets = &v - + o.Targets = v } -// HasTargets returns a boolean if a field has been set. -func (o *NetworkLoadBalancerForwardingRuleProperties) HasTargets() bool { - if o != nil && o.Targets != nil { - return true +func (o NetworkLoadBalancerForwardingRuleProperties) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } - - return false + return json.Marshal(toSerialize) } -func (o NetworkLoadBalancerForwardingRuleProperties) MarshalJSON() ([]byte, error) { +func (o NetworkLoadBalancerForwardingRuleProperties) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Name != nil { - toSerialize["name"] = o.Name - } - - if o.Algorithm != nil { - toSerialize["algorithm"] = o.Algorithm - } - - if o.Protocol != nil { - toSerialize["protocol"] = o.Protocol - } - - if o.ListenerIp != nil { - toSerialize["listenerIp"] = o.ListenerIp - } - - if o.ListenerPort != nil { - toSerialize["listenerPort"] = o.ListenerPort - } - - if o.HealthCheck != nil { + toSerialize["name"] = o.Name + toSerialize["algorithm"] = o.Algorithm + toSerialize["protocol"] = o.Protocol + toSerialize["listenerIp"] = o.ListenerIp + toSerialize["listenerPort"] = o.ListenerPort + if !IsNil(o.HealthCheck) { toSerialize["healthCheck"] = o.HealthCheck } - - if o.Targets != nil { - toSerialize["targets"] = o.Targets - } - - return json.Marshal(toSerialize) + toSerialize["targets"] = o.Targets + return toSerialize, nil } type NullableNetworkLoadBalancerForwardingRuleProperties struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_network_load_balancer_forwarding_rule_put.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_network_load_balancer_forwarding_rule_put.go similarity index 69% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_network_load_balancer_forwarding_rule_put.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_network_load_balancer_forwarding_rule_put.go index f13c0901c..f89610370 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_network_load_balancer_forwarding_rule_put.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_network_load_balancer_forwarding_rule_put.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the NetworkLoadBalancerForwardingRulePut type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NetworkLoadBalancerForwardingRulePut{} + // NetworkLoadBalancerForwardingRulePut struct for NetworkLoadBalancerForwardingRulePut type NetworkLoadBalancerForwardingRulePut struct { // The resource's unique identifier. @@ -21,8 +24,8 @@ type NetworkLoadBalancerForwardingRulePut struct { // The type of object that has been created. Type *Type `json:"type,omitempty"` // URL to the object representation (absolute path). - Href *string `json:"href,omitempty"` - Properties *NetworkLoadBalancerForwardingRuleProperties `json:"properties"` + Href *string `json:"href,omitempty"` + Properties NetworkLoadBalancerForwardingRuleProperties `json:"properties"` } // NewNetworkLoadBalancerForwardingRulePut instantiates a new NetworkLoadBalancerForwardingRulePut object @@ -32,7 +35,7 @@ type NetworkLoadBalancerForwardingRulePut struct { func NewNetworkLoadBalancerForwardingRulePut(properties NetworkLoadBalancerForwardingRuleProperties) *NetworkLoadBalancerForwardingRulePut { this := NetworkLoadBalancerForwardingRulePut{} - this.Properties = &properties + this.Properties = properties return &this } @@ -45,177 +48,147 @@ func NewNetworkLoadBalancerForwardingRulePutWithDefaults() *NetworkLoadBalancerF return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *NetworkLoadBalancerForwardingRulePut) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *NetworkLoadBalancerForwardingRulePut) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *NetworkLoadBalancerForwardingRulePut) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *NetworkLoadBalancerForwardingRulePut) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *NetworkLoadBalancerForwardingRulePut) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *NetworkLoadBalancerForwardingRulePut) GetType() *Type { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *NetworkLoadBalancerForwardingRulePut) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *NetworkLoadBalancerForwardingRulePut) GetType() Type { + if o == nil || IsNil(o.Type) { + var ret Type + return ret + } + return *o.Type } -// GetTypeOk returns a tuple with the Type field value +// GetTypeOk returns a tuple with the Type 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 *NetworkLoadBalancerForwardingRulePut) GetTypeOk() (*Type, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *NetworkLoadBalancerForwardingRulePut) SetType(v Type) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *NetworkLoadBalancerForwardingRulePut) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *NetworkLoadBalancerForwardingRulePut) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given Type and assigns it to the Type field. +func (o *NetworkLoadBalancerForwardingRulePut) SetType(v Type) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *NetworkLoadBalancerForwardingRulePut) 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 +// GetHrefOk returns a tuple with the Href 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 *NetworkLoadBalancerForwardingRulePut) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *NetworkLoadBalancerForwardingRulePut) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *NetworkLoadBalancerForwardingRulePut) HasHref() bool { - if o != nil && o.Href != nil { + 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 *NetworkLoadBalancerForwardingRulePut) SetHref(v string) { + o.Href = &v +} + // GetProperties returns the Properties field value -// If the value is explicit nil, nil is returned -func (o *NetworkLoadBalancerForwardingRulePut) GetProperties() *NetworkLoadBalancerForwardingRuleProperties { +func (o *NetworkLoadBalancerForwardingRulePut) GetProperties() NetworkLoadBalancerForwardingRuleProperties { if o == nil { - return nil + var ret NetworkLoadBalancerForwardingRuleProperties + return ret } return o.Properties - } // GetPropertiesOk returns a tuple with the Properties field value // 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 *NetworkLoadBalancerForwardingRulePut) GetPropertiesOk() (*NetworkLoadBalancerForwardingRuleProperties, bool) { if o == nil { return nil, false } - - return o.Properties, true + return &o.Properties, true } // SetProperties sets field value func (o *NetworkLoadBalancerForwardingRulePut) SetProperties(v NetworkLoadBalancerForwardingRuleProperties) { - - o.Properties = &v - + o.Properties = v } -// HasProperties returns a boolean if a field has been set. -func (o *NetworkLoadBalancerForwardingRulePut) HasProperties() bool { - if o != nil && o.Properties != nil { - return true +func (o NetworkLoadBalancerForwardingRulePut) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } - - return false + return json.Marshal(toSerialize) } -func (o NetworkLoadBalancerForwardingRulePut) MarshalJSON() ([]byte, error) { +func (o NetworkLoadBalancerForwardingRulePut) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Properties != nil { - toSerialize["properties"] = o.Properties - } - - return json.Marshal(toSerialize) + toSerialize["properties"] = o.Properties + return toSerialize, nil } type NullableNetworkLoadBalancerForwardingRulePut struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_network_load_balancer_forwarding_rule_target.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_network_load_balancer_forwarding_rule_target.go similarity index 73% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_network_load_balancer_forwarding_rule_target.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_network_load_balancer_forwarding_rule_target.go index e34f43293..cd362c59d 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_network_load_balancer_forwarding_rule_target.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_network_load_balancer_forwarding_rule_target.go @@ -14,14 +14,17 @@ import ( "encoding/json" ) +// checks if the NetworkLoadBalancerForwardingRuleTarget type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NetworkLoadBalancerForwardingRuleTarget{} + // NetworkLoadBalancerForwardingRuleTarget struct for NetworkLoadBalancerForwardingRuleTarget type NetworkLoadBalancerForwardingRuleTarget struct { // The IP of the balanced target VM. - Ip *string `json:"ip"` + Ip string `json:"ip"` // The port of the balanced target service; valid range is 1 to 65535. - Port *int32 `json:"port"` + Port int32 `json:"port"` // Traffic is distributed in proportion to target weight, relative to the combined weight of all targets. A target with higher weight receives a greater share of traffic. Valid range is 0 to 256 and default is 1. Targets with weight of 0 do not participate in load balancing but still accept persistent connections. It is best to assign weights in the middle of the range to leave room for later adjustments. - Weight *int32 `json:"weight"` + Weight int32 `json:"weight"` // Proxy protocol version. ProxyProtocol *string `json:"proxyProtocol,omitempty"` HealthCheck *NetworkLoadBalancerForwardingRuleTargetHealthCheck `json:"healthCheck,omitempty"` @@ -34,9 +37,9 @@ type NetworkLoadBalancerForwardingRuleTarget struct { func NewNetworkLoadBalancerForwardingRuleTarget(ip string, port int32, weight int32) *NetworkLoadBalancerForwardingRuleTarget { this := NetworkLoadBalancerForwardingRuleTarget{} - this.Ip = &ip - this.Port = &port - this.Weight = &weight + this.Ip = ip + this.Port = port + this.Weight = weight var proxyProtocol string = "none" this.ProxyProtocol = &proxyProtocol @@ -54,218 +57,161 @@ func NewNetworkLoadBalancerForwardingRuleTargetWithDefaults() *NetworkLoadBalanc } // GetIp returns the Ip field value -// If the value is explicit nil, nil is returned -func (o *NetworkLoadBalancerForwardingRuleTarget) GetIp() *string { +func (o *NetworkLoadBalancerForwardingRuleTarget) GetIp() string { if o == nil { - return nil + var ret string + return ret } return o.Ip - } // GetIpOk returns a tuple with the Ip field value // 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 *NetworkLoadBalancerForwardingRuleTarget) GetIpOk() (*string, bool) { if o == nil { return nil, false } - - return o.Ip, true + return &o.Ip, true } // SetIp sets field value func (o *NetworkLoadBalancerForwardingRuleTarget) SetIp(v string) { - - o.Ip = &v - -} - -// HasIp returns a boolean if a field has been set. -func (o *NetworkLoadBalancerForwardingRuleTarget) HasIp() bool { - if o != nil && o.Ip != nil { - return true - } - - return false + o.Ip = v } // GetPort returns the Port field value -// If the value is explicit nil, nil is returned -func (o *NetworkLoadBalancerForwardingRuleTarget) GetPort() *int32 { +func (o *NetworkLoadBalancerForwardingRuleTarget) GetPort() int32 { if o == nil { - return nil + var ret int32 + return ret } return o.Port - } // GetPortOk returns a tuple with the Port field value // 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 *NetworkLoadBalancerForwardingRuleTarget) GetPortOk() (*int32, bool) { if o == nil { return nil, false } - - return o.Port, true + return &o.Port, true } // SetPort sets field value func (o *NetworkLoadBalancerForwardingRuleTarget) SetPort(v int32) { - - o.Port = &v - -} - -// HasPort returns a boolean if a field has been set. -func (o *NetworkLoadBalancerForwardingRuleTarget) HasPort() bool { - if o != nil && o.Port != nil { - return true - } - - return false + o.Port = v } // GetWeight returns the Weight field value -// If the value is explicit nil, nil is returned -func (o *NetworkLoadBalancerForwardingRuleTarget) GetWeight() *int32 { +func (o *NetworkLoadBalancerForwardingRuleTarget) GetWeight() int32 { if o == nil { - return 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. -// NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *NetworkLoadBalancerForwardingRuleTarget) GetWeightOk() (*int32, bool) { if o == nil { return nil, false } - - return o.Weight, true + return &o.Weight, true } // SetWeight sets field value func (o *NetworkLoadBalancerForwardingRuleTarget) SetWeight(v int32) { - - o.Weight = &v - -} - -// HasWeight returns a boolean if a field has been set. -func (o *NetworkLoadBalancerForwardingRuleTarget) HasWeight() bool { - if o != nil && o.Weight != nil { - return true - } - - return false + o.Weight = v } -// GetProxyProtocol returns the ProxyProtocol field value -// If the value is explicit nil, nil is returned -func (o *NetworkLoadBalancerForwardingRuleTarget) GetProxyProtocol() *string { - if o == nil { - return nil +// GetProxyProtocol returns the ProxyProtocol field value if set, zero value otherwise. +func (o *NetworkLoadBalancerForwardingRuleTarget) GetProxyProtocol() string { + if o == nil || IsNil(o.ProxyProtocol) { + var ret string + return ret } - - return o.ProxyProtocol - + return *o.ProxyProtocol } -// GetProxyProtocolOk returns a tuple with the ProxyProtocol field value +// GetProxyProtocolOk returns a tuple with the ProxyProtocol 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 *NetworkLoadBalancerForwardingRuleTarget) GetProxyProtocolOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.ProxyProtocol) { return nil, false } - return o.ProxyProtocol, true } -// SetProxyProtocol sets field value -func (o *NetworkLoadBalancerForwardingRuleTarget) SetProxyProtocol(v string) { - - o.ProxyProtocol = &v - -} - // HasProxyProtocol returns a boolean if a field has been set. func (o *NetworkLoadBalancerForwardingRuleTarget) HasProxyProtocol() bool { - if o != nil && o.ProxyProtocol != nil { + if o != nil && !IsNil(o.ProxyProtocol) { return true } return false } -// GetHealthCheck returns the HealthCheck field value -// If the value is explicit nil, nil is returned -func (o *NetworkLoadBalancerForwardingRuleTarget) GetHealthCheck() *NetworkLoadBalancerForwardingRuleTargetHealthCheck { - if o == nil { - return nil - } - - return o.HealthCheck +// SetProxyProtocol gets a reference to the given string and assigns it to the ProxyProtocol field. +func (o *NetworkLoadBalancerForwardingRuleTarget) SetProxyProtocol(v string) { + o.ProxyProtocol = &v +} +// GetHealthCheck returns the HealthCheck field value if set, zero value otherwise. +func (o *NetworkLoadBalancerForwardingRuleTarget) GetHealthCheck() NetworkLoadBalancerForwardingRuleTargetHealthCheck { + if o == nil || IsNil(o.HealthCheck) { + var ret NetworkLoadBalancerForwardingRuleTargetHealthCheck + return ret + } + return *o.HealthCheck } -// GetHealthCheckOk returns a tuple with the HealthCheck field value +// GetHealthCheckOk returns a tuple with the HealthCheck 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 *NetworkLoadBalancerForwardingRuleTarget) GetHealthCheckOk() (*NetworkLoadBalancerForwardingRuleTargetHealthCheck, bool) { - if o == nil { + if o == nil || IsNil(o.HealthCheck) { return nil, false } - return o.HealthCheck, true } -// SetHealthCheck sets field value -func (o *NetworkLoadBalancerForwardingRuleTarget) SetHealthCheck(v NetworkLoadBalancerForwardingRuleTargetHealthCheck) { - - o.HealthCheck = &v - -} - // HasHealthCheck returns a boolean if a field has been set. func (o *NetworkLoadBalancerForwardingRuleTarget) HasHealthCheck() bool { - if o != nil && o.HealthCheck != nil { + if o != nil && !IsNil(o.HealthCheck) { return true } return false } -func (o NetworkLoadBalancerForwardingRuleTarget) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.Ip != nil { - toSerialize["ip"] = o.Ip - } - - if o.Port != nil { - toSerialize["port"] = o.Port - } +// SetHealthCheck gets a reference to the given NetworkLoadBalancerForwardingRuleTargetHealthCheck and assigns it to the HealthCheck field. +func (o *NetworkLoadBalancerForwardingRuleTarget) SetHealthCheck(v NetworkLoadBalancerForwardingRuleTargetHealthCheck) { + o.HealthCheck = &v +} - if o.Weight != nil { - toSerialize["weight"] = o.Weight +func (o NetworkLoadBalancerForwardingRuleTarget) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } + return json.Marshal(toSerialize) +} - if o.ProxyProtocol != nil { +func (o NetworkLoadBalancerForwardingRuleTarget) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["ip"] = o.Ip + toSerialize["port"] = o.Port + toSerialize["weight"] = o.Weight + if !IsNil(o.ProxyProtocol) { toSerialize["proxyProtocol"] = o.ProxyProtocol } - - if o.HealthCheck != nil { + if !IsNil(o.HealthCheck) { toSerialize["healthCheck"] = o.HealthCheck } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableNetworkLoadBalancerForwardingRuleTarget struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_network_load_balancer_forwarding_rule_target_health_check.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_network_load_balancer_forwarding_rule_target_health_check.go similarity index 77% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_network_load_balancer_forwarding_rule_target_health_check.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_network_load_balancer_forwarding_rule_target_health_check.go index 116d2e4df..80eabf7d4 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_network_load_balancer_forwarding_rule_target_health_check.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_network_load_balancer_forwarding_rule_target_health_check.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the NetworkLoadBalancerForwardingRuleTargetHealthCheck type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NetworkLoadBalancerForwardingRuleTargetHealthCheck{} + // NetworkLoadBalancerForwardingRuleTargetHealthCheck struct for NetworkLoadBalancerForwardingRuleTargetHealthCheck type NetworkLoadBalancerForwardingRuleTargetHealthCheck struct { // Makes the target available only if it accepts periodic health check TCP connection attempts; when turned off, the target is considered always available. The health check only consists of a connection attempt to the address and port of the target. @@ -42,135 +45,122 @@ func NewNetworkLoadBalancerForwardingRuleTargetHealthCheckWithDefaults() *Networ return &this } -// GetCheck returns the Check field value -// If the value is explicit nil, nil is returned -func (o *NetworkLoadBalancerForwardingRuleTargetHealthCheck) GetCheck() *bool { - if o == nil { - return nil +// GetCheck returns the Check field value if set, zero value otherwise. +func (o *NetworkLoadBalancerForwardingRuleTargetHealthCheck) GetCheck() bool { + if o == nil || IsNil(o.Check) { + var ret bool + return ret } - - return o.Check - + return *o.Check } -// GetCheckOk returns a tuple with the Check field value +// GetCheckOk returns a tuple with the Check 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 *NetworkLoadBalancerForwardingRuleTargetHealthCheck) GetCheckOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.Check) { return nil, false } - return o.Check, true } -// SetCheck sets field value -func (o *NetworkLoadBalancerForwardingRuleTargetHealthCheck) SetCheck(v bool) { - - o.Check = &v - -} - // HasCheck returns a boolean if a field has been set. func (o *NetworkLoadBalancerForwardingRuleTargetHealthCheck) HasCheck() bool { - if o != nil && o.Check != nil { + if o != nil && !IsNil(o.Check) { return true } return false } -// GetCheckInterval returns the CheckInterval field value -// If the value is explicit nil, nil is returned -func (o *NetworkLoadBalancerForwardingRuleTargetHealthCheck) GetCheckInterval() *int32 { - if o == nil { - return nil - } - - return o.CheckInterval +// SetCheck gets a reference to the given bool and assigns it to the Check field. +func (o *NetworkLoadBalancerForwardingRuleTargetHealthCheck) SetCheck(v bool) { + o.Check = &v +} +// GetCheckInterval returns the CheckInterval field value if set, zero value otherwise. +func (o *NetworkLoadBalancerForwardingRuleTargetHealthCheck) GetCheckInterval() int32 { + if o == nil || IsNil(o.CheckInterval) { + var ret int32 + return ret + } + return *o.CheckInterval } -// GetCheckIntervalOk returns a tuple with the CheckInterval field value +// GetCheckIntervalOk returns a tuple with the CheckInterval 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 *NetworkLoadBalancerForwardingRuleTargetHealthCheck) GetCheckIntervalOk() (*int32, bool) { - if o == nil { + if o == nil || IsNil(o.CheckInterval) { return nil, false } - return o.CheckInterval, true } -// SetCheckInterval sets field value -func (o *NetworkLoadBalancerForwardingRuleTargetHealthCheck) SetCheckInterval(v int32) { - - o.CheckInterval = &v - -} - // HasCheckInterval returns a boolean if a field has been set. func (o *NetworkLoadBalancerForwardingRuleTargetHealthCheck) HasCheckInterval() bool { - if o != nil && o.CheckInterval != nil { + if o != nil && !IsNil(o.CheckInterval) { return true } return false } -// GetMaintenance returns the Maintenance field value -// If the value is explicit nil, nil is returned -func (o *NetworkLoadBalancerForwardingRuleTargetHealthCheck) GetMaintenance() *bool { - if o == nil { - return nil - } - - return o.Maintenance +// SetCheckInterval gets a reference to the given int32 and assigns it to the CheckInterval field. +func (o *NetworkLoadBalancerForwardingRuleTargetHealthCheck) SetCheckInterval(v int32) { + o.CheckInterval = &v +} +// GetMaintenance returns the Maintenance field value if set, zero value otherwise. +func (o *NetworkLoadBalancerForwardingRuleTargetHealthCheck) GetMaintenance() bool { + if o == nil || IsNil(o.Maintenance) { + var ret bool + return ret + } + return *o.Maintenance } -// GetMaintenanceOk returns a tuple with the Maintenance field value +// GetMaintenanceOk returns a tuple with the Maintenance 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 *NetworkLoadBalancerForwardingRuleTargetHealthCheck) GetMaintenanceOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.Maintenance) { return nil, false } - return o.Maintenance, true } -// SetMaintenance sets field value -func (o *NetworkLoadBalancerForwardingRuleTargetHealthCheck) SetMaintenance(v bool) { - - o.Maintenance = &v - -} - // HasMaintenance returns a boolean if a field has been set. func (o *NetworkLoadBalancerForwardingRuleTargetHealthCheck) HasMaintenance() bool { - if o != nil && o.Maintenance != nil { + if o != nil && !IsNil(o.Maintenance) { return true } return false } +// SetMaintenance gets a reference to the given bool and assigns it to the Maintenance field. +func (o *NetworkLoadBalancerForwardingRuleTargetHealthCheck) SetMaintenance(v bool) { + o.Maintenance = &v +} + func (o NetworkLoadBalancerForwardingRuleTargetHealthCheck) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o NetworkLoadBalancerForwardingRuleTargetHealthCheck) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Check != nil { + if !IsNil(o.Check) { toSerialize["check"] = o.Check } - - if o.CheckInterval != nil { + if !IsNil(o.CheckInterval) { toSerialize["checkInterval"] = o.CheckInterval } - - if o.Maintenance != nil { + if !IsNil(o.Maintenance) { toSerialize["maintenance"] = o.Maintenance } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableNetworkLoadBalancerForwardingRuleTargetHealthCheck struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_network_load_balancer_forwarding_rules.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_network_load_balancer_forwarding_rules.go similarity index 62% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_network_load_balancer_forwarding_rules.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_network_load_balancer_forwarding_rules.go index ae3989cba..b8832c736 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_network_load_balancer_forwarding_rules.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_network_load_balancer_forwarding_rules.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the NetworkLoadBalancerForwardingRules type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NetworkLoadBalancerForwardingRules{} + // NetworkLoadBalancerForwardingRules struct for NetworkLoadBalancerForwardingRules type NetworkLoadBalancerForwardingRules struct { // The resource's unique identifier. @@ -23,7 +26,7 @@ type NetworkLoadBalancerForwardingRules struct { // URL to the object representation (absolute path). Href *string `json:"href,omitempty"` // Array of items in the collection. - Items *[]NetworkLoadBalancerForwardingRule `json:"items,omitempty"` + Items []NetworkLoadBalancerForwardingRule `json:"items,omitempty"` // The offset (if specified in the request). Offset *float32 `json:"offset,omitempty"` // The limit (if specified in the request). @@ -49,303 +52,262 @@ func NewNetworkLoadBalancerForwardingRulesWithDefaults() *NetworkLoadBalancerFor return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *NetworkLoadBalancerForwardingRules) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *NetworkLoadBalancerForwardingRules) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *NetworkLoadBalancerForwardingRules) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *NetworkLoadBalancerForwardingRules) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *NetworkLoadBalancerForwardingRules) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *NetworkLoadBalancerForwardingRules) GetType() *Type { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *NetworkLoadBalancerForwardingRules) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *NetworkLoadBalancerForwardingRules) GetType() Type { + if o == nil || IsNil(o.Type) { + var ret Type + return ret + } + return *o.Type } -// GetTypeOk returns a tuple with the Type field value +// GetTypeOk returns a tuple with the Type 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 *NetworkLoadBalancerForwardingRules) GetTypeOk() (*Type, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *NetworkLoadBalancerForwardingRules) SetType(v Type) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *NetworkLoadBalancerForwardingRules) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *NetworkLoadBalancerForwardingRules) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given Type and assigns it to the Type field. +func (o *NetworkLoadBalancerForwardingRules) SetType(v Type) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *NetworkLoadBalancerForwardingRules) 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 +// GetHrefOk returns a tuple with the Href 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 *NetworkLoadBalancerForwardingRules) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *NetworkLoadBalancerForwardingRules) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *NetworkLoadBalancerForwardingRules) HasHref() bool { - if o != nil && o.Href != nil { + if o != nil && !IsNil(o.Href) { return true } return false } -// GetItems returns the Items field value -// If the value is explicit nil, nil is returned -func (o *NetworkLoadBalancerForwardingRules) GetItems() *[]NetworkLoadBalancerForwardingRule { - if o == nil { - return nil - } +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *NetworkLoadBalancerForwardingRules) SetHref(v string) { + o.Href = &v +} +// GetItems returns the Items field value if set, zero value otherwise. +func (o *NetworkLoadBalancerForwardingRules) GetItems() []NetworkLoadBalancerForwardingRule { + if o == nil || IsNil(o.Items) { + var ret []NetworkLoadBalancerForwardingRule + return ret + } return o.Items - } -// GetItemsOk returns a tuple with the Items field value +// GetItemsOk returns a tuple with the Items 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 *NetworkLoadBalancerForwardingRules) GetItemsOk() (*[]NetworkLoadBalancerForwardingRule, bool) { - if o == nil { +func (o *NetworkLoadBalancerForwardingRules) GetItemsOk() ([]NetworkLoadBalancerForwardingRule, bool) { + if o == nil || IsNil(o.Items) { return nil, false } - return o.Items, true } -// SetItems sets field value -func (o *NetworkLoadBalancerForwardingRules) SetItems(v []NetworkLoadBalancerForwardingRule) { - - o.Items = &v - -} - // HasItems returns a boolean if a field has been set. func (o *NetworkLoadBalancerForwardingRules) HasItems() bool { - if o != nil && o.Items != nil { + if o != nil && !IsNil(o.Items) { return true } return false } -// GetOffset returns the Offset field value -// If the value is explicit nil, nil is returned -func (o *NetworkLoadBalancerForwardingRules) GetOffset() *float32 { - if o == nil { - return nil - } - - return o.Offset +// SetItems gets a reference to the given []NetworkLoadBalancerForwardingRule and assigns it to the Items field. +func (o *NetworkLoadBalancerForwardingRules) SetItems(v []NetworkLoadBalancerForwardingRule) { + o.Items = v +} +// GetOffset returns the Offset field value if set, zero value otherwise. +func (o *NetworkLoadBalancerForwardingRules) GetOffset() float32 { + if o == nil || IsNil(o.Offset) { + var ret float32 + return ret + } + return *o.Offset } -// GetOffsetOk returns a tuple with the Offset field value +// GetOffsetOk returns a tuple with the Offset 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 *NetworkLoadBalancerForwardingRules) GetOffsetOk() (*float32, bool) { - if o == nil { + if o == nil || IsNil(o.Offset) { return nil, false } - return o.Offset, true } -// SetOffset sets field value -func (o *NetworkLoadBalancerForwardingRules) SetOffset(v float32) { - - o.Offset = &v - -} - // HasOffset returns a boolean if a field has been set. func (o *NetworkLoadBalancerForwardingRules) HasOffset() bool { - if o != nil && o.Offset != nil { + if o != nil && !IsNil(o.Offset) { return true } return false } -// GetLimit returns the Limit field value -// If the value is explicit nil, nil is returned -func (o *NetworkLoadBalancerForwardingRules) GetLimit() *float32 { - if o == nil { - return nil - } - - return o.Limit +// SetOffset gets a reference to the given float32 and assigns it to the Offset field. +func (o *NetworkLoadBalancerForwardingRules) SetOffset(v float32) { + o.Offset = &v +} +// GetLimit returns the Limit field value if set, zero value otherwise. +func (o *NetworkLoadBalancerForwardingRules) GetLimit() float32 { + if o == nil || IsNil(o.Limit) { + var ret float32 + return ret + } + return *o.Limit } -// GetLimitOk returns a tuple with the Limit field value +// GetLimitOk returns a tuple with the Limit 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 *NetworkLoadBalancerForwardingRules) GetLimitOk() (*float32, bool) { - if o == nil { + if o == nil || IsNil(o.Limit) { return nil, false } - return o.Limit, true } -// SetLimit sets field value -func (o *NetworkLoadBalancerForwardingRules) SetLimit(v float32) { - - o.Limit = &v - -} - // HasLimit returns a boolean if a field has been set. func (o *NetworkLoadBalancerForwardingRules) HasLimit() bool { - if o != nil && o.Limit != nil { + if o != nil && !IsNil(o.Limit) { return true } return false } -// GetLinks returns the Links field value -// If the value is explicit nil, nil is returned -func (o *NetworkLoadBalancerForwardingRules) GetLinks() *PaginationLinks { - if o == nil { - return nil - } - - return o.Links +// SetLimit gets a reference to the given float32 and assigns it to the Limit field. +func (o *NetworkLoadBalancerForwardingRules) SetLimit(v float32) { + o.Limit = &v +} +// GetLinks returns the Links field value if set, zero value otherwise. +func (o *NetworkLoadBalancerForwardingRules) GetLinks() PaginationLinks { + if o == nil || IsNil(o.Links) { + var ret PaginationLinks + return ret + } + return *o.Links } -// GetLinksOk returns a tuple with the Links field value +// GetLinksOk returns a tuple with the Links 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 *NetworkLoadBalancerForwardingRules) GetLinksOk() (*PaginationLinks, bool) { - if o == nil { + if o == nil || IsNil(o.Links) { return nil, false } - return o.Links, true } -// SetLinks sets field value -func (o *NetworkLoadBalancerForwardingRules) SetLinks(v PaginationLinks) { - - o.Links = &v - -} - // HasLinks returns a boolean if a field has been set. func (o *NetworkLoadBalancerForwardingRules) HasLinks() bool { - if o != nil && o.Links != nil { + if o != nil && !IsNil(o.Links) { return true } return false } +// SetLinks gets a reference to the given PaginationLinks and assigns it to the Links field. +func (o *NetworkLoadBalancerForwardingRules) SetLinks(v PaginationLinks) { + o.Links = &v +} + func (o NetworkLoadBalancerForwardingRules) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o NetworkLoadBalancerForwardingRules) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Items != nil { + if !IsNil(o.Items) { toSerialize["items"] = o.Items } - - if o.Offset != nil { + if !IsNil(o.Offset) { toSerialize["offset"] = o.Offset } - - if o.Limit != nil { + if !IsNil(o.Limit) { toSerialize["limit"] = o.Limit } - - if o.Links != nil { + if !IsNil(o.Links) { toSerialize["_links"] = o.Links } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableNetworkLoadBalancerForwardingRules struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_network_load_balancer_properties.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_network_load_balancer_properties.go similarity index 64% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_network_load_balancer_properties.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_network_load_balancer_properties.go index feca35f64..f8763553e 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_network_load_balancer_properties.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_network_load_balancer_properties.go @@ -14,18 +14,21 @@ import ( "encoding/json" ) +// checks if the NetworkLoadBalancerProperties type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NetworkLoadBalancerProperties{} + // NetworkLoadBalancerProperties struct for NetworkLoadBalancerProperties type NetworkLoadBalancerProperties struct { // The name of the Network Load Balancer. - Name *string `json:"name"` + Name string `json:"name"` // ID of the listening LAN (inbound). - ListenerLan *int32 `json:"listenerLan"` + ListenerLan int32 `json:"listenerLan"` // Collection of the Network Load Balancer IP addresses. (Inbound and outbound) IPs of the listenerLan must be customer-reserved IPs for public Load Balancers, and private IPs for private Load Balancers. - Ips *[]string `json:"ips,omitempty"` + Ips []string `json:"ips,omitempty"` // ID of the balanced private target LAN (outbound). - TargetLan *int32 `json:"targetLan"` + TargetLan int32 `json:"targetLan"` // Collection of private IP addresses with subnet mask of the Network Load Balancer. IPs must contain a valid subnet mask. If no IP is provided, the system will generate an IP with /24 subnet. - LbPrivateIps *[]string `json:"lbPrivateIps,omitempty"` + LbPrivateIps []string `json:"lbPrivateIps,omitempty"` // Turn logging on and off for this product. Default value is 'false'. CentralLogging *bool `json:"centralLogging,omitempty"` // Specifies the format of the logs. @@ -39,9 +42,9 @@ type NetworkLoadBalancerProperties struct { func NewNetworkLoadBalancerProperties(name string, listenerLan int32, targetLan int32) *NetworkLoadBalancerProperties { this := NetworkLoadBalancerProperties{} - this.Name = &name - this.ListenerLan = &listenerLan - this.TargetLan = &targetLan + this.Name = name + this.ListenerLan = listenerLan + this.TargetLan = targetLan return &this } @@ -55,302 +58,231 @@ func NewNetworkLoadBalancerPropertiesWithDefaults() *NetworkLoadBalancerProperti } // GetName returns the Name field value -// If the value is explicit nil, nil is returned -func (o *NetworkLoadBalancerProperties) GetName() *string { +func (o *NetworkLoadBalancerProperties) GetName() string { if o == nil { - return 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. -// NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *NetworkLoadBalancerProperties) GetNameOk() (*string, bool) { if o == nil { return nil, false } - - return o.Name, true + return &o.Name, true } // SetName sets field value func (o *NetworkLoadBalancerProperties) SetName(v string) { - - o.Name = &v - -} - -// HasName returns a boolean if a field has been set. -func (o *NetworkLoadBalancerProperties) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false + o.Name = v } // GetListenerLan returns the ListenerLan field value -// If the value is explicit nil, nil is returned -func (o *NetworkLoadBalancerProperties) GetListenerLan() *int32 { +func (o *NetworkLoadBalancerProperties) GetListenerLan() int32 { if o == nil { - return nil + var ret int32 + return ret } return o.ListenerLan - } // GetListenerLanOk returns a tuple with the ListenerLan field value // 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 *NetworkLoadBalancerProperties) GetListenerLanOk() (*int32, bool) { if o == nil { return nil, false } - - return o.ListenerLan, true + return &o.ListenerLan, true } // SetListenerLan sets field value func (o *NetworkLoadBalancerProperties) SetListenerLan(v int32) { - - o.ListenerLan = &v - -} - -// HasListenerLan returns a boolean if a field has been set. -func (o *NetworkLoadBalancerProperties) HasListenerLan() bool { - if o != nil && o.ListenerLan != nil { - return true - } - - return false + o.ListenerLan = v } -// GetIps returns the Ips field value -// If the value is explicit nil, nil is returned -func (o *NetworkLoadBalancerProperties) GetIps() *[]string { - if o == nil { - return nil +// GetIps returns the Ips field value if set, zero value otherwise. +func (o *NetworkLoadBalancerProperties) GetIps() []string { + if o == nil || IsNil(o.Ips) { + var ret []string + return ret } - return o.Ips - } -// GetIpsOk returns a tuple with the Ips field value +// GetIpsOk returns a tuple with the Ips 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 *NetworkLoadBalancerProperties) GetIpsOk() (*[]string, bool) { - if o == nil { +func (o *NetworkLoadBalancerProperties) GetIpsOk() ([]string, bool) { + if o == nil || IsNil(o.Ips) { return nil, false } - return o.Ips, true } -// SetIps sets field value -func (o *NetworkLoadBalancerProperties) SetIps(v []string) { - - o.Ips = &v - -} - // HasIps returns a boolean if a field has been set. func (o *NetworkLoadBalancerProperties) HasIps() bool { - if o != nil && o.Ips != nil { + if o != nil && !IsNil(o.Ips) { return true } return false } +// SetIps gets a reference to the given []string and assigns it to the Ips field. +func (o *NetworkLoadBalancerProperties) SetIps(v []string) { + o.Ips = v +} + // GetTargetLan returns the TargetLan field value -// If the value is explicit nil, nil is returned -func (o *NetworkLoadBalancerProperties) GetTargetLan() *int32 { +func (o *NetworkLoadBalancerProperties) GetTargetLan() int32 { if o == nil { - return nil + var ret int32 + return ret } return o.TargetLan - } // GetTargetLanOk returns a tuple with the TargetLan field value // 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 *NetworkLoadBalancerProperties) GetTargetLanOk() (*int32, bool) { if o == nil { return nil, false } - - return o.TargetLan, true + return &o.TargetLan, true } // SetTargetLan sets field value func (o *NetworkLoadBalancerProperties) SetTargetLan(v int32) { - - o.TargetLan = &v - + o.TargetLan = v } -// HasTargetLan returns a boolean if a field has been set. -func (o *NetworkLoadBalancerProperties) HasTargetLan() bool { - if o != nil && o.TargetLan != nil { - return true - } - - return false -} - -// GetLbPrivateIps returns the LbPrivateIps field value -// If the value is explicit nil, nil is returned -func (o *NetworkLoadBalancerProperties) GetLbPrivateIps() *[]string { - if o == nil { - return nil +// GetLbPrivateIps returns the LbPrivateIps field value if set, zero value otherwise. +func (o *NetworkLoadBalancerProperties) GetLbPrivateIps() []string { + if o == nil || IsNil(o.LbPrivateIps) { + var ret []string + return ret } - return o.LbPrivateIps - } -// GetLbPrivateIpsOk returns a tuple with the LbPrivateIps field value +// GetLbPrivateIpsOk returns a tuple with the LbPrivateIps 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 *NetworkLoadBalancerProperties) GetLbPrivateIpsOk() (*[]string, bool) { - if o == nil { +func (o *NetworkLoadBalancerProperties) GetLbPrivateIpsOk() ([]string, bool) { + if o == nil || IsNil(o.LbPrivateIps) { return nil, false } - return o.LbPrivateIps, true } -// SetLbPrivateIps sets field value -func (o *NetworkLoadBalancerProperties) SetLbPrivateIps(v []string) { - - o.LbPrivateIps = &v - -} - // HasLbPrivateIps returns a boolean if a field has been set. func (o *NetworkLoadBalancerProperties) HasLbPrivateIps() bool { - if o != nil && o.LbPrivateIps != nil { + if o != nil && !IsNil(o.LbPrivateIps) { return true } return false } -// GetCentralLogging returns the CentralLogging field value -// If the value is explicit nil, nil is returned -func (o *NetworkLoadBalancerProperties) GetCentralLogging() *bool { - if o == nil { - return nil - } - - return o.CentralLogging +// SetLbPrivateIps gets a reference to the given []string and assigns it to the LbPrivateIps field. +func (o *NetworkLoadBalancerProperties) SetLbPrivateIps(v []string) { + o.LbPrivateIps = v +} +// GetCentralLogging returns the CentralLogging field value if set, zero value otherwise. +func (o *NetworkLoadBalancerProperties) GetCentralLogging() bool { + if o == nil || IsNil(o.CentralLogging) { + var ret bool + return ret + } + return *o.CentralLogging } -// GetCentralLoggingOk returns a tuple with the CentralLogging field value +// GetCentralLoggingOk returns a tuple with the CentralLogging 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 *NetworkLoadBalancerProperties) GetCentralLoggingOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.CentralLogging) { return nil, false } - return o.CentralLogging, true } -// SetCentralLogging sets field value -func (o *NetworkLoadBalancerProperties) SetCentralLogging(v bool) { - - o.CentralLogging = &v - -} - // HasCentralLogging returns a boolean if a field has been set. func (o *NetworkLoadBalancerProperties) HasCentralLogging() bool { - if o != nil && o.CentralLogging != nil { + if o != nil && !IsNil(o.CentralLogging) { return true } return false } -// GetLoggingFormat returns the LoggingFormat field value -// If the value is explicit nil, nil is returned -func (o *NetworkLoadBalancerProperties) GetLoggingFormat() *string { - if o == nil { - return nil - } - - return o.LoggingFormat +// SetCentralLogging gets a reference to the given bool and assigns it to the CentralLogging field. +func (o *NetworkLoadBalancerProperties) SetCentralLogging(v bool) { + o.CentralLogging = &v +} +// GetLoggingFormat returns the LoggingFormat field value if set, zero value otherwise. +func (o *NetworkLoadBalancerProperties) GetLoggingFormat() string { + if o == nil || IsNil(o.LoggingFormat) { + var ret string + return ret + } + return *o.LoggingFormat } -// GetLoggingFormatOk returns a tuple with the LoggingFormat field value +// GetLoggingFormatOk returns a tuple with the LoggingFormat 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 *NetworkLoadBalancerProperties) GetLoggingFormatOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.LoggingFormat) { return nil, false } - return o.LoggingFormat, true } -// SetLoggingFormat sets field value -func (o *NetworkLoadBalancerProperties) SetLoggingFormat(v string) { - - o.LoggingFormat = &v - -} - // HasLoggingFormat returns a boolean if a field has been set. func (o *NetworkLoadBalancerProperties) HasLoggingFormat() bool { - if o != nil && o.LoggingFormat != nil { + if o != nil && !IsNil(o.LoggingFormat) { return true } return false } -func (o NetworkLoadBalancerProperties) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.Name != nil { - toSerialize["name"] = o.Name - } +// SetLoggingFormat gets a reference to the given string and assigns it to the LoggingFormat field. +func (o *NetworkLoadBalancerProperties) SetLoggingFormat(v string) { + o.LoggingFormat = &v +} - if o.ListenerLan != nil { - toSerialize["listenerLan"] = o.ListenerLan +func (o NetworkLoadBalancerProperties) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } + return json.Marshal(toSerialize) +} - if o.Ips != nil { +func (o NetworkLoadBalancerProperties) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["name"] = o.Name + toSerialize["listenerLan"] = o.ListenerLan + if !IsNil(o.Ips) { toSerialize["ips"] = o.Ips } - - if o.TargetLan != nil { - toSerialize["targetLan"] = o.TargetLan - } - - if o.LbPrivateIps != nil { + toSerialize["targetLan"] = o.TargetLan + if !IsNil(o.LbPrivateIps) { toSerialize["lbPrivateIps"] = o.LbPrivateIps } - - if o.CentralLogging != nil { + if !IsNil(o.CentralLogging) { toSerialize["centralLogging"] = o.CentralLogging } - - if o.LoggingFormat != nil { + if !IsNil(o.LoggingFormat) { toSerialize["loggingFormat"] = o.LoggingFormat } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableNetworkLoadBalancerProperties struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_network_load_balancer_put.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_network_load_balancer_put.go similarity index 68% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_network_load_balancer_put.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_network_load_balancer_put.go index 95eed55a5..c9bddcc24 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_network_load_balancer_put.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_network_load_balancer_put.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the NetworkLoadBalancerPut type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NetworkLoadBalancerPut{} + // NetworkLoadBalancerPut struct for NetworkLoadBalancerPut type NetworkLoadBalancerPut struct { // The resource's unique identifier. @@ -21,8 +24,8 @@ type NetworkLoadBalancerPut struct { // The type of object that has been created. Type *Type `json:"type,omitempty"` // URL to the object representation (absolute path). - Href *string `json:"href,omitempty"` - Properties *NetworkLoadBalancerProperties `json:"properties"` + Href *string `json:"href,omitempty"` + Properties NetworkLoadBalancerProperties `json:"properties"` } // NewNetworkLoadBalancerPut instantiates a new NetworkLoadBalancerPut object @@ -32,7 +35,7 @@ type NetworkLoadBalancerPut struct { func NewNetworkLoadBalancerPut(properties NetworkLoadBalancerProperties) *NetworkLoadBalancerPut { this := NetworkLoadBalancerPut{} - this.Properties = &properties + this.Properties = properties return &this } @@ -45,177 +48,147 @@ func NewNetworkLoadBalancerPutWithDefaults() *NetworkLoadBalancerPut { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *NetworkLoadBalancerPut) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *NetworkLoadBalancerPut) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *NetworkLoadBalancerPut) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *NetworkLoadBalancerPut) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *NetworkLoadBalancerPut) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *NetworkLoadBalancerPut) GetType() *Type { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *NetworkLoadBalancerPut) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *NetworkLoadBalancerPut) GetType() Type { + if o == nil || IsNil(o.Type) { + var ret Type + return ret + } + return *o.Type } -// GetTypeOk returns a tuple with the Type field value +// GetTypeOk returns a tuple with the Type 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 *NetworkLoadBalancerPut) GetTypeOk() (*Type, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *NetworkLoadBalancerPut) SetType(v Type) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *NetworkLoadBalancerPut) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *NetworkLoadBalancerPut) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given Type and assigns it to the Type field. +func (o *NetworkLoadBalancerPut) SetType(v Type) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *NetworkLoadBalancerPut) 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 +// GetHrefOk returns a tuple with the Href 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 *NetworkLoadBalancerPut) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *NetworkLoadBalancerPut) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *NetworkLoadBalancerPut) HasHref() bool { - if o != nil && o.Href != nil { + 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 *NetworkLoadBalancerPut) SetHref(v string) { + o.Href = &v +} + // GetProperties returns the Properties field value -// If the value is explicit nil, nil is returned -func (o *NetworkLoadBalancerPut) GetProperties() *NetworkLoadBalancerProperties { +func (o *NetworkLoadBalancerPut) GetProperties() NetworkLoadBalancerProperties { if o == nil { - return nil + var ret NetworkLoadBalancerProperties + return ret } return o.Properties - } // GetPropertiesOk returns a tuple with the Properties field value // 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 *NetworkLoadBalancerPut) GetPropertiesOk() (*NetworkLoadBalancerProperties, bool) { if o == nil { return nil, false } - - return o.Properties, true + return &o.Properties, true } // SetProperties sets field value func (o *NetworkLoadBalancerPut) SetProperties(v NetworkLoadBalancerProperties) { - - o.Properties = &v - + o.Properties = v } -// HasProperties returns a boolean if a field has been set. -func (o *NetworkLoadBalancerPut) HasProperties() bool { - if o != nil && o.Properties != nil { - return true +func (o NetworkLoadBalancerPut) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } - - return false + return json.Marshal(toSerialize) } -func (o NetworkLoadBalancerPut) MarshalJSON() ([]byte, error) { +func (o NetworkLoadBalancerPut) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Properties != nil { - toSerialize["properties"] = o.Properties - } - - return json.Marshal(toSerialize) + toSerialize["properties"] = o.Properties + return toSerialize, nil } type NullableNetworkLoadBalancerPut struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_network_load_balancers.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_network_load_balancers.go similarity index 61% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_network_load_balancers.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_network_load_balancers.go index 17c9e2849..830ac629e 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_network_load_balancers.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_network_load_balancers.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the NetworkLoadBalancers type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NetworkLoadBalancers{} + // NetworkLoadBalancers struct for NetworkLoadBalancers type NetworkLoadBalancers struct { // The resource's unique identifier. @@ -23,7 +26,7 @@ type NetworkLoadBalancers struct { // URL to the object representation (absolute path). Href *string `json:"href,omitempty"` // Array of items in the collection. - Items *[]NetworkLoadBalancer `json:"items,omitempty"` + Items []NetworkLoadBalancer `json:"items,omitempty"` // The offset (if specified in the request). Offset *float32 `json:"offset,omitempty"` // The limit (if specified in the request). @@ -49,303 +52,262 @@ func NewNetworkLoadBalancersWithDefaults() *NetworkLoadBalancers { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *NetworkLoadBalancers) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *NetworkLoadBalancers) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *NetworkLoadBalancers) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *NetworkLoadBalancers) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *NetworkLoadBalancers) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *NetworkLoadBalancers) GetType() *Type { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *NetworkLoadBalancers) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *NetworkLoadBalancers) GetType() Type { + if o == nil || IsNil(o.Type) { + var ret Type + return ret + } + return *o.Type } -// GetTypeOk returns a tuple with the Type field value +// GetTypeOk returns a tuple with the Type 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 *NetworkLoadBalancers) GetTypeOk() (*Type, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *NetworkLoadBalancers) SetType(v Type) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *NetworkLoadBalancers) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *NetworkLoadBalancers) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given Type and assigns it to the Type field. +func (o *NetworkLoadBalancers) SetType(v Type) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *NetworkLoadBalancers) 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 +// GetHrefOk returns a tuple with the Href 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 *NetworkLoadBalancers) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *NetworkLoadBalancers) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *NetworkLoadBalancers) HasHref() bool { - if o != nil && o.Href != nil { + if o != nil && !IsNil(o.Href) { return true } return false } -// GetItems returns the Items field value -// If the value is explicit nil, nil is returned -func (o *NetworkLoadBalancers) GetItems() *[]NetworkLoadBalancer { - if o == nil { - return nil - } +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *NetworkLoadBalancers) SetHref(v string) { + o.Href = &v +} +// GetItems returns the Items field value if set, zero value otherwise. +func (o *NetworkLoadBalancers) GetItems() []NetworkLoadBalancer { + if o == nil || IsNil(o.Items) { + var ret []NetworkLoadBalancer + return ret + } return o.Items - } -// GetItemsOk returns a tuple with the Items field value +// GetItemsOk returns a tuple with the Items 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 *NetworkLoadBalancers) GetItemsOk() (*[]NetworkLoadBalancer, bool) { - if o == nil { +func (o *NetworkLoadBalancers) GetItemsOk() ([]NetworkLoadBalancer, bool) { + if o == nil || IsNil(o.Items) { return nil, false } - return o.Items, true } -// SetItems sets field value -func (o *NetworkLoadBalancers) SetItems(v []NetworkLoadBalancer) { - - o.Items = &v - -} - // HasItems returns a boolean if a field has been set. func (o *NetworkLoadBalancers) HasItems() bool { - if o != nil && o.Items != nil { + if o != nil && !IsNil(o.Items) { return true } return false } -// GetOffset returns the Offset field value -// If the value is explicit nil, nil is returned -func (o *NetworkLoadBalancers) GetOffset() *float32 { - if o == nil { - return nil - } - - return o.Offset +// SetItems gets a reference to the given []NetworkLoadBalancer and assigns it to the Items field. +func (o *NetworkLoadBalancers) SetItems(v []NetworkLoadBalancer) { + o.Items = v +} +// GetOffset returns the Offset field value if set, zero value otherwise. +func (o *NetworkLoadBalancers) GetOffset() float32 { + if o == nil || IsNil(o.Offset) { + var ret float32 + return ret + } + return *o.Offset } -// GetOffsetOk returns a tuple with the Offset field value +// GetOffsetOk returns a tuple with the Offset 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 *NetworkLoadBalancers) GetOffsetOk() (*float32, bool) { - if o == nil { + if o == nil || IsNil(o.Offset) { return nil, false } - return o.Offset, true } -// SetOffset sets field value -func (o *NetworkLoadBalancers) SetOffset(v float32) { - - o.Offset = &v - -} - // HasOffset returns a boolean if a field has been set. func (o *NetworkLoadBalancers) HasOffset() bool { - if o != nil && o.Offset != nil { + if o != nil && !IsNil(o.Offset) { return true } return false } -// GetLimit returns the Limit field value -// If the value is explicit nil, nil is returned -func (o *NetworkLoadBalancers) GetLimit() *float32 { - if o == nil { - return nil - } - - return o.Limit +// SetOffset gets a reference to the given float32 and assigns it to the Offset field. +func (o *NetworkLoadBalancers) SetOffset(v float32) { + o.Offset = &v +} +// GetLimit returns the Limit field value if set, zero value otherwise. +func (o *NetworkLoadBalancers) GetLimit() float32 { + if o == nil || IsNil(o.Limit) { + var ret float32 + return ret + } + return *o.Limit } -// GetLimitOk returns a tuple with the Limit field value +// GetLimitOk returns a tuple with the Limit 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 *NetworkLoadBalancers) GetLimitOk() (*float32, bool) { - if o == nil { + if o == nil || IsNil(o.Limit) { return nil, false } - return o.Limit, true } -// SetLimit sets field value -func (o *NetworkLoadBalancers) SetLimit(v float32) { - - o.Limit = &v - -} - // HasLimit returns a boolean if a field has been set. func (o *NetworkLoadBalancers) HasLimit() bool { - if o != nil && o.Limit != nil { + if o != nil && !IsNil(o.Limit) { return true } return false } -// GetLinks returns the Links field value -// If the value is explicit nil, nil is returned -func (o *NetworkLoadBalancers) GetLinks() *PaginationLinks { - if o == nil { - return nil - } - - return o.Links +// SetLimit gets a reference to the given float32 and assigns it to the Limit field. +func (o *NetworkLoadBalancers) SetLimit(v float32) { + o.Limit = &v +} +// GetLinks returns the Links field value if set, zero value otherwise. +func (o *NetworkLoadBalancers) GetLinks() PaginationLinks { + if o == nil || IsNil(o.Links) { + var ret PaginationLinks + return ret + } + return *o.Links } -// GetLinksOk returns a tuple with the Links field value +// GetLinksOk returns a tuple with the Links 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 *NetworkLoadBalancers) GetLinksOk() (*PaginationLinks, bool) { - if o == nil { + if o == nil || IsNil(o.Links) { return nil, false } - return o.Links, true } -// SetLinks sets field value -func (o *NetworkLoadBalancers) SetLinks(v PaginationLinks) { - - o.Links = &v - -} - // HasLinks returns a boolean if a field has been set. func (o *NetworkLoadBalancers) HasLinks() bool { - if o != nil && o.Links != nil { + if o != nil && !IsNil(o.Links) { return true } return false } +// SetLinks gets a reference to the given PaginationLinks and assigns it to the Links field. +func (o *NetworkLoadBalancers) SetLinks(v PaginationLinks) { + o.Links = &v +} + func (o NetworkLoadBalancers) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o NetworkLoadBalancers) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Items != nil { + if !IsNil(o.Items) { toSerialize["items"] = o.Items } - - if o.Offset != nil { + if !IsNil(o.Offset) { toSerialize["offset"] = o.Offset } - - if o.Limit != nil { + if !IsNil(o.Limit) { toSerialize["limit"] = o.Limit } - - if o.Links != nil { + if !IsNil(o.Links) { toSerialize["_links"] = o.Links } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableNetworkLoadBalancers struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_nic.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_nic.go similarity index 62% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_nic.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_nic.go index fd92a1926..3951a593f 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_nic.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_nic.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the Nic type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Nic{} + // Nic struct for Nic type Nic struct { // The resource's unique identifier. @@ -23,7 +26,7 @@ type Nic struct { // URL to the object representation (absolute path). Href *string `json:"href,omitempty"` Metadata *DatacenterElementMetadata `json:"metadata,omitempty"` - Properties *NicProperties `json:"properties"` + Properties NicProperties `json:"properties"` Entities *NicEntities `json:"entities,omitempty"` } @@ -34,7 +37,7 @@ type Nic struct { func NewNic(properties NicProperties) *Nic { this := Nic{} - this.Properties = &properties + this.Properties = properties return &this } @@ -47,261 +50,217 @@ func NewNicWithDefaults() *Nic { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *Nic) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *Nic) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *Nic) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *Nic) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *Nic) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *Nic) GetType() *Type { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Nic) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *Nic) GetType() Type { + if o == nil || IsNil(o.Type) { + var ret Type + return ret + } + return *o.Type } -// GetTypeOk returns a tuple with the Type field value +// GetTypeOk returns a tuple with the Type 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 *Nic) GetTypeOk() (*Type, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *Nic) SetType(v Type) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *Nic) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *Nic) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given Type and assigns it to the Type field. +func (o *Nic) SetType(v Type) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *Nic) 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 +// GetHrefOk returns a tuple with the Href 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 *Nic) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *Nic) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *Nic) HasHref() bool { - if o != nil && o.Href != nil { + if o != nil && !IsNil(o.Href) { return true } return false } -// GetMetadata returns the Metadata field value -// If the value is explicit nil, nil is returned -func (o *Nic) GetMetadata() *DatacenterElementMetadata { - if o == nil { - return nil - } - - return o.Metadata +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *Nic) SetHref(v string) { + o.Href = &v +} +// GetMetadata returns the Metadata field value if set, zero value otherwise. +func (o *Nic) GetMetadata() DatacenterElementMetadata { + if o == nil || IsNil(o.Metadata) { + var ret DatacenterElementMetadata + return ret + } + return *o.Metadata } -// GetMetadataOk returns a tuple with the Metadata field value +// GetMetadataOk returns a tuple with the Metadata 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 *Nic) GetMetadataOk() (*DatacenterElementMetadata, bool) { - if o == nil { + if o == nil || IsNil(o.Metadata) { return nil, false } - return o.Metadata, true } -// SetMetadata sets field value -func (o *Nic) SetMetadata(v DatacenterElementMetadata) { - - o.Metadata = &v - -} - // HasMetadata returns a boolean if a field has been set. func (o *Nic) HasMetadata() bool { - if o != nil && o.Metadata != nil { + if o != nil && !IsNil(o.Metadata) { return true } return false } +// SetMetadata gets a reference to the given DatacenterElementMetadata and assigns it to the Metadata field. +func (o *Nic) SetMetadata(v DatacenterElementMetadata) { + o.Metadata = &v +} + // GetProperties returns the Properties field value -// If the value is explicit nil, nil is returned -func (o *Nic) GetProperties() *NicProperties { +func (o *Nic) GetProperties() NicProperties { if o == nil { - return nil + var ret NicProperties + return ret } return o.Properties - } // GetPropertiesOk returns a tuple with the Properties field value // 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 *Nic) GetPropertiesOk() (*NicProperties, bool) { if o == nil { return nil, false } - - return o.Properties, true + return &o.Properties, true } // SetProperties sets field value func (o *Nic) SetProperties(v NicProperties) { - - o.Properties = &v - -} - -// HasProperties returns a boolean if a field has been set. -func (o *Nic) HasProperties() bool { - if o != nil && o.Properties != nil { - return true - } - - return false + o.Properties = v } -// GetEntities returns the Entities field value -// If the value is explicit nil, nil is returned -func (o *Nic) GetEntities() *NicEntities { - if o == nil { - return nil +// GetEntities returns the Entities field value if set, zero value otherwise. +func (o *Nic) GetEntities() NicEntities { + if o == nil || IsNil(o.Entities) { + var ret NicEntities + return ret } - - return o.Entities - + return *o.Entities } -// GetEntitiesOk returns a tuple with the Entities field value +// GetEntitiesOk returns a tuple with the Entities 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 *Nic) GetEntitiesOk() (*NicEntities, bool) { - if o == nil { + if o == nil || IsNil(o.Entities) { return nil, false } - return o.Entities, true } -// SetEntities sets field value -func (o *Nic) SetEntities(v NicEntities) { - - o.Entities = &v - -} - // HasEntities returns a boolean if a field has been set. func (o *Nic) HasEntities() bool { - if o != nil && o.Entities != nil { + if o != nil && !IsNil(o.Entities) { return true } return false } +// SetEntities gets a reference to the given NicEntities and assigns it to the Entities field. +func (o *Nic) SetEntities(v NicEntities) { + o.Entities = &v +} + func (o Nic) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Nic) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Metadata != nil { + if !IsNil(o.Metadata) { toSerialize["metadata"] = o.Metadata } - - if o.Properties != nil { - toSerialize["properties"] = o.Properties - } - - if o.Entities != nil { + toSerialize["properties"] = o.Properties + if !IsNil(o.Entities) { toSerialize["entities"] = o.Entities } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableNic struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_nic_entities.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_nic_entities.go similarity index 68% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_nic_entities.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_nic_entities.go index 426db2494..817ade41d 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_nic_entities.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_nic_entities.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the NicEntities type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NicEntities{} + // NicEntities struct for NicEntities type NicEntities struct { Flowlogs *FlowLogs `json:"flowlogs,omitempty"` @@ -39,135 +42,122 @@ func NewNicEntitiesWithDefaults() *NicEntities { return &this } -// GetFlowlogs returns the Flowlogs field value -// If the value is explicit nil, nil is returned -func (o *NicEntities) GetFlowlogs() *FlowLogs { - if o == nil { - return nil +// GetFlowlogs returns the Flowlogs field value if set, zero value otherwise. +func (o *NicEntities) GetFlowlogs() FlowLogs { + if o == nil || IsNil(o.Flowlogs) { + var ret FlowLogs + return ret } - - return o.Flowlogs - + return *o.Flowlogs } -// GetFlowlogsOk returns a tuple with the Flowlogs field value +// GetFlowlogsOk returns a tuple with the Flowlogs 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 *NicEntities) GetFlowlogsOk() (*FlowLogs, bool) { - if o == nil { + if o == nil || IsNil(o.Flowlogs) { return nil, false } - return o.Flowlogs, true } -// SetFlowlogs sets field value -func (o *NicEntities) SetFlowlogs(v FlowLogs) { - - o.Flowlogs = &v - -} - // HasFlowlogs returns a boolean if a field has been set. func (o *NicEntities) HasFlowlogs() bool { - if o != nil && o.Flowlogs != nil { + if o != nil && !IsNil(o.Flowlogs) { return true } return false } -// GetFirewallrules returns the Firewallrules field value -// If the value is explicit nil, nil is returned -func (o *NicEntities) GetFirewallrules() *FirewallRules { - if o == nil { - return nil - } - - return o.Firewallrules +// SetFlowlogs gets a reference to the given FlowLogs and assigns it to the Flowlogs field. +func (o *NicEntities) SetFlowlogs(v FlowLogs) { + o.Flowlogs = &v +} +// GetFirewallrules returns the Firewallrules field value if set, zero value otherwise. +func (o *NicEntities) GetFirewallrules() FirewallRules { + if o == nil || IsNil(o.Firewallrules) { + var ret FirewallRules + return ret + } + return *o.Firewallrules } -// GetFirewallrulesOk returns a tuple with the Firewallrules field value +// GetFirewallrulesOk returns a tuple with the Firewallrules 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 *NicEntities) GetFirewallrulesOk() (*FirewallRules, bool) { - if o == nil { + if o == nil || IsNil(o.Firewallrules) { return nil, false } - return o.Firewallrules, true } -// SetFirewallrules sets field value -func (o *NicEntities) SetFirewallrules(v FirewallRules) { - - o.Firewallrules = &v - -} - // HasFirewallrules returns a boolean if a field has been set. func (o *NicEntities) HasFirewallrules() bool { - if o != nil && o.Firewallrules != nil { + if o != nil && !IsNil(o.Firewallrules) { return true } return false } -// GetSecuritygroups returns the Securitygroups field value -// If the value is explicit nil, nil is returned -func (o *NicEntities) GetSecuritygroups() *SecurityGroups { - if o == nil { - return nil - } - - return o.Securitygroups +// SetFirewallrules gets a reference to the given FirewallRules and assigns it to the Firewallrules field. +func (o *NicEntities) SetFirewallrules(v FirewallRules) { + o.Firewallrules = &v +} +// GetSecuritygroups returns the Securitygroups field value if set, zero value otherwise. +func (o *NicEntities) GetSecuritygroups() SecurityGroups { + if o == nil || IsNil(o.Securitygroups) { + var ret SecurityGroups + return ret + } + return *o.Securitygroups } -// GetSecuritygroupsOk returns a tuple with the Securitygroups field value +// GetSecuritygroupsOk returns a tuple with the Securitygroups 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 *NicEntities) GetSecuritygroupsOk() (*SecurityGroups, bool) { - if o == nil { + if o == nil || IsNil(o.Securitygroups) { return nil, false } - return o.Securitygroups, true } -// SetSecuritygroups sets field value -func (o *NicEntities) SetSecuritygroups(v SecurityGroups) { - - o.Securitygroups = &v - -} - // HasSecuritygroups returns a boolean if a field has been set. func (o *NicEntities) HasSecuritygroups() bool { - if o != nil && o.Securitygroups != nil { + if o != nil && !IsNil(o.Securitygroups) { return true } return false } +// SetSecuritygroups gets a reference to the given SecurityGroups and assigns it to the Securitygroups field. +func (o *NicEntities) SetSecuritygroups(v SecurityGroups) { + o.Securitygroups = &v +} + func (o NicEntities) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o NicEntities) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Flowlogs != nil { + if !IsNil(o.Flowlogs) { toSerialize["flowlogs"] = o.Flowlogs } - - if o.Firewallrules != nil { + if !IsNil(o.Firewallrules) { toSerialize["firewallrules"] = o.Firewallrules } - - if o.Securitygroups != nil { + if !IsNil(o.Securitygroups) { toSerialize["securitygroups"] = o.Securitygroups } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableNicEntities struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_nic_properties.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_nic_properties.go similarity index 60% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_nic_properties.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_nic_properties.go index cb0e7999e..0e3eb1dc9 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_nic_properties.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_nic_properties.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the NicProperties type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NicProperties{} + // NicProperties struct for NicProperties type NicProperties struct { // The name of the resource. @@ -21,21 +24,17 @@ type NicProperties struct { // The MAC address of the NIC. Mac *string `json:"mac,omitempty"` // Collection of IP addresses, assigned to the NIC. Explicitly assigned public IPs need to come from reserved IP blocks. Passing value null or empty array will assign an IP address automatically. - // to set this field to `nil` in order to be marshalled, the explicit nil address `Nil[]string` can be used, or the setter `SetIpsNil` - Ips *[]string `json:"ips,omitempty"` + Ips []string `json:"ips,omitempty"` // Indicates if the NIC will reserve an IP using DHCP. Dhcp *bool `json:"dhcp,omitempty"` // If this NIC is connected to an IPv6 enabled LAN then this property contains the IPv6 IP addresses of the NIC. The maximum number of IPv6 IP addresses per NIC is 50, if you need more, contact support. If you leave this property 'null' when adding a NIC, when changing the NIC's IPv6 CIDR block, when changing the LAN's IPv6 CIDR block or when moving the NIC to a different IPv6 enabled LAN, then we will automatically assign the same number of IPv6 addresses which you had before from the NICs new CIDR block. If you leave this property 'null' while not changing the CIDR block, the IPv6 IP addresses won't be changed either. You can also provide your own self choosen IPv6 addresses, which then must be inside the IPv6 CIDR block of this NIC. - // to set this field to `nil` in order to be marshalled, the explicit nil address `Nil[]string` can be used, or the setter `SetIpv6IpsNil` - Ipv6Ips *[]string `json:"ipv6Ips,omitempty"` + Ipv6Ips []string `json:"ipv6Ips,omitempty"` // If this NIC is connected to an IPv6 enabled LAN then this property contains the /80 IPv6 CIDR block of the NIC. If you leave this property 'null' when adding a NIC to an IPv6-enabled LAN, then an IPv6 CIDR block will automatically be assigned to the NIC, but you can also specify an /80 IPv6 CIDR block for the NIC on your own, which must be inside the /64 IPv6 CIDR block of the LAN and unique. This value can only be set, if the LAN already has an IPv6 CIDR block assigned. An IPv6-enabled LAN is limited to a maximum of 65,536 NICs. - // to set this field to `nil` in order to be marshalled, the explicit nil address `Nilstring` can be used, or the setter `SetIpv6CidrBlockNil` - Ipv6CidrBlock *string `json:"ipv6CidrBlock,omitempty"` + Ipv6CidrBlock NullableString `json:"ipv6CidrBlock,omitempty"` // Indicates if the NIC will receive an IPv6 using DHCP. It can be set to 'true' or 'false' only if this NIC is connected to an IPv6 enabled LAN. - // to set this field to `nil` in order to be marshalled, the explicit nil address `Nilbool` can be used, or the setter `SetDhcpv6Nil` - Dhcpv6 *bool `json:"dhcpv6,omitempty"` + Dhcpv6 NullableBool `json:"dhcpv6,omitempty"` // The LAN ID the NIC will be on. If the LAN ID does not exist, it will be implicitly created. - Lan *int32 `json:"lan"` + Lan int32 `json:"lan"` // Activate or deactivate the firewall. By default, an active firewall without any defined rules will block all incoming network traffic except for the firewall rules that explicitly allows certain protocols, IP addresses and ports. FirewallActive *bool `json:"firewallActive,omitempty"` // The type of firewall rules that will be allowed on the NIC. If not specified, the default INGRESS value is used. @@ -57,7 +56,9 @@ func NewNicProperties(lan int32) *NicProperties { var dhcp bool = true this.Dhcp = &dhcp - this.Lan = &lan + var dhcpv6 = true + this.Dhcpv6 = *NewNullableBool(&dhcpv6) + this.Lan = lan return &this } @@ -69,570 +70,491 @@ func NewNicPropertiesWithDefaults() *NicProperties { this := NicProperties{} var dhcp bool = true this.Dhcp = &dhcp + var dhcpv6 = true + this.Dhcpv6 = *NewNullableBool(&dhcpv6) return &this } -// GetName returns the Name field value -// If the value is explicit nil, nil is returned -func (o *NicProperties) GetName() *string { - if o == nil { - return nil +// GetName returns the Name field value if set, zero value otherwise. +func (o *NicProperties) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret } - - return o.Name - + return *o.Name } -// GetNameOk returns a tuple with the Name field value +// GetNameOk returns a tuple with the Name 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 *NicProperties) GetNameOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Name) { return nil, false } - return o.Name, true } -// SetName sets field value -func (o *NicProperties) SetName(v string) { - - o.Name = &v - -} - // HasName returns a boolean if a field has been set. func (o *NicProperties) HasName() bool { - if o != nil && o.Name != nil { + if o != nil && !IsNil(o.Name) { return true } return false } -// GetMac returns the Mac field value -// If the value is explicit nil, nil is returned -func (o *NicProperties) GetMac() *string { - if o == nil { - return nil - } - - return o.Mac +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *NicProperties) SetName(v string) { + o.Name = &v +} +// GetMac returns the Mac field value if set, zero value otherwise. +func (o *NicProperties) 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 +// GetMacOk returns a tuple with the Mac 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 *NicProperties) GetMacOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Mac) { return nil, false } - return o.Mac, true } -// SetMac sets field value -func (o *NicProperties) SetMac(v string) { - - o.Mac = &v - -} - // HasMac returns a boolean if a field has been set. func (o *NicProperties) HasMac() bool { - if o != nil && o.Mac != nil { + if o != nil && !IsNil(o.Mac) { return true } return false } -// GetIps returns the Ips field value -// If the value is explicit nil, nil is returned -func (o *NicProperties) GetIps() *[]string { +// SetMac gets a reference to the given string and assigns it to the Mac field. +func (o *NicProperties) SetMac(v string) { + o.Mac = &v +} + +// GetIps returns the Ips field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *NicProperties) GetIps() []string { if o == nil { - return nil + var ret []string + return ret } - return o.Ips - } -// GetIpsOk returns a tuple with the Ips field value +// GetIpsOk returns a tuple with the Ips 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 *NicProperties) GetIpsOk() (*[]string, bool) { - if o == nil { +func (o *NicProperties) GetIpsOk() ([]string, bool) { + if o == nil || IsNil(o.Ips) { return nil, false } - return o.Ips, true } -// SetIps sets field value -func (o *NicProperties) SetIps(v []string) { - - o.Ips = &v - -} - // HasIps returns a boolean if a field has been set. func (o *NicProperties) HasIps() bool { - if o != nil && o.Ips != nil { + if o != nil && IsNil(o.Ips) { return true } return false } -// GetDhcp returns the Dhcp field value -// If the value is explicit nil, nil is returned -func (o *NicProperties) GetDhcp() *bool { - if o == nil { - return nil - } - - return o.Dhcp +// SetIps gets a reference to the given []string and assigns it to the Ips field. +func (o *NicProperties) SetIps(v []string) { + o.Ips = v +} +// GetDhcp returns the Dhcp field value if set, zero value otherwise. +func (o *NicProperties) GetDhcp() bool { + if o == nil || IsNil(o.Dhcp) { + var ret bool + return ret + } + return *o.Dhcp } -// GetDhcpOk returns a tuple with the Dhcp field value +// GetDhcpOk returns a tuple with the Dhcp 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 *NicProperties) GetDhcpOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.Dhcp) { return nil, false } - return o.Dhcp, true } -// SetDhcp sets field value -func (o *NicProperties) SetDhcp(v bool) { - - o.Dhcp = &v - -} - // HasDhcp returns a boolean if a field has been set. func (o *NicProperties) HasDhcp() bool { - if o != nil && o.Dhcp != nil { + if o != nil && !IsNil(o.Dhcp) { return true } return false } -// GetIpv6Ips returns the Ipv6Ips field value -// If the value is explicit nil, nil is returned -func (o *NicProperties) GetIpv6Ips() *[]string { +// SetDhcp gets a reference to the given bool and assigns it to the Dhcp field. +func (o *NicProperties) SetDhcp(v bool) { + o.Dhcp = &v +} + +// GetIpv6Ips returns the Ipv6Ips field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *NicProperties) GetIpv6Ips() []string { if o == nil { - return nil + var ret []string + return ret } - return o.Ipv6Ips - } -// GetIpv6IpsOk returns a tuple with the Ipv6Ips field value +// GetIpv6IpsOk returns a tuple with the Ipv6Ips 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 *NicProperties) GetIpv6IpsOk() (*[]string, bool) { - if o == nil { +func (o *NicProperties) GetIpv6IpsOk() ([]string, bool) { + if o == nil || IsNil(o.Ipv6Ips) { return nil, false } - return o.Ipv6Ips, true } -// SetIpv6Ips sets field value -func (o *NicProperties) SetIpv6Ips(v []string) { - - o.Ipv6Ips = &v - -} - // HasIpv6Ips returns a boolean if a field has been set. func (o *NicProperties) HasIpv6Ips() bool { - if o != nil && o.Ipv6Ips != nil { + if o != nil && IsNil(o.Ipv6Ips) { return true } return false } -// GetIpv6CidrBlock returns the Ipv6CidrBlock field value -// If the value is explicit nil, nil is returned -func (o *NicProperties) GetIpv6CidrBlock() *string { - if o == nil { - return nil - } - - return o.Ipv6CidrBlock +// SetIpv6Ips gets a reference to the given []string and assigns it to the Ipv6Ips field. +func (o *NicProperties) SetIpv6Ips(v []string) { + o.Ipv6Ips = v +} +// GetIpv6CidrBlock returns the Ipv6CidrBlock field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *NicProperties) GetIpv6CidrBlock() string { + if o == nil || IsNil(o.Ipv6CidrBlock.Get()) { + var ret string + return ret + } + return *o.Ipv6CidrBlock.Get() } -// GetIpv6CidrBlockOk returns a tuple with the Ipv6CidrBlock field value +// GetIpv6CidrBlockOk returns a tuple with the Ipv6CidrBlock 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 *NicProperties) GetIpv6CidrBlockOk() (*string, bool) { if o == nil { return nil, false } - - return o.Ipv6CidrBlock, true -} - -// SetIpv6CidrBlock sets field value -func (o *NicProperties) SetIpv6CidrBlock(v string) { - - o.Ipv6CidrBlock = &v - -} - -// sets Ipv6CidrBlock to the explicit address that will be encoded as nil when marshaled -func (o *NicProperties) SetIpv6CidrBlockNil() { - o.Ipv6CidrBlock = &Nilstring + return o.Ipv6CidrBlock.Get(), o.Ipv6CidrBlock.IsSet() } // HasIpv6CidrBlock returns a boolean if a field has been set. func (o *NicProperties) HasIpv6CidrBlock() bool { - if o != nil && o.Ipv6CidrBlock != nil { + if o != nil && o.Ipv6CidrBlock.IsSet() { return true } return false } -// GetDhcpv6 returns the Dhcpv6 field value -// If the value is explicit nil, nil is returned -func (o *NicProperties) GetDhcpv6() *bool { - if o == nil { - return nil - } +// SetIpv6CidrBlock gets a reference to the given NullableString and assigns it to the Ipv6CidrBlock field. +func (o *NicProperties) SetIpv6CidrBlock(v string) { + o.Ipv6CidrBlock.Set(&v) +} - return o.Dhcpv6 +// SetIpv6CidrBlockNil sets the value for Ipv6CidrBlock to be an explicit nil +func (o *NicProperties) SetIpv6CidrBlockNil() { + o.Ipv6CidrBlock.Set(nil) +} +// UnsetIpv6CidrBlock ensures that no value is present for Ipv6CidrBlock, not even an explicit nil +func (o *NicProperties) UnsetIpv6CidrBlock() { + o.Ipv6CidrBlock.Unset() } -// GetDhcpv6Ok returns a tuple with the Dhcpv6 field value +// GetDhcpv6 returns the Dhcpv6 field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *NicProperties) GetDhcpv6() bool { + if o == nil || IsNil(o.Dhcpv6.Get()) { + var ret bool + return ret + } + return *o.Dhcpv6.Get() +} + +// GetDhcpv6Ok returns a tuple with the Dhcpv6 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 *NicProperties) GetDhcpv6Ok() (*bool, bool) { if o == nil { return nil, false } - - return o.Dhcpv6, true + return o.Dhcpv6.Get(), o.Dhcpv6.IsSet() } -// SetDhcpv6 sets field value -func (o *NicProperties) SetDhcpv6(v bool) { +// HasDhcpv6 returns a boolean if a field has been set. +func (o *NicProperties) HasDhcpv6() bool { + if o != nil && o.Dhcpv6.IsSet() { + return true + } - o.Dhcpv6 = &v + return false +} +// SetDhcpv6 gets a reference to the given NullableBool and assigns it to the Dhcpv6 field. +func (o *NicProperties) SetDhcpv6(v bool) { + o.Dhcpv6.Set(&v) } -// sets Dhcpv6 to the explicit address that will be encoded as nil when marshaled +// SetDhcpv6Nil sets the value for Dhcpv6 to be an explicit nil func (o *NicProperties) SetDhcpv6Nil() { - o.Dhcpv6 = &Nilbool + o.Dhcpv6.Set(nil) } -// HasDhcpv6 returns a boolean if a field has been set. -func (o *NicProperties) HasDhcpv6() bool { - if o != nil && o.Dhcpv6 != nil { - return true - } - - return false +// UnsetDhcpv6 ensures that no value is present for Dhcpv6, not even an explicit nil +func (o *NicProperties) UnsetDhcpv6() { + o.Dhcpv6.Unset() } // GetLan returns the Lan field value -// If the value is explicit nil, nil is returned -func (o *NicProperties) GetLan() *int32 { +func (o *NicProperties) GetLan() int32 { if o == nil { - return nil + var ret int32 + return ret } return o.Lan - } // GetLanOk returns a tuple with the Lan field value // 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 *NicProperties) GetLanOk() (*int32, bool) { if o == nil { return nil, false } - - return o.Lan, true + return &o.Lan, true } // SetLan sets field value func (o *NicProperties) SetLan(v int32) { - - o.Lan = &v - -} - -// HasLan returns a boolean if a field has been set. -func (o *NicProperties) HasLan() bool { - if o != nil && o.Lan != nil { - return true - } - - return false + o.Lan = v } -// GetFirewallActive returns the FirewallActive field value -// If the value is explicit nil, nil is returned -func (o *NicProperties) GetFirewallActive() *bool { - if o == nil { - return nil +// GetFirewallActive returns the FirewallActive field value if set, zero value otherwise. +func (o *NicProperties) GetFirewallActive() bool { + if o == nil || IsNil(o.FirewallActive) { + var ret bool + return ret } - - return o.FirewallActive - + return *o.FirewallActive } -// GetFirewallActiveOk returns a tuple with the FirewallActive field value +// GetFirewallActiveOk returns a tuple with the FirewallActive 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 *NicProperties) GetFirewallActiveOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.FirewallActive) { return nil, false } - return o.FirewallActive, true } -// SetFirewallActive sets field value -func (o *NicProperties) SetFirewallActive(v bool) { - - o.FirewallActive = &v - -} - // HasFirewallActive returns a boolean if a field has been set. func (o *NicProperties) HasFirewallActive() bool { - if o != nil && o.FirewallActive != nil { + if o != nil && !IsNil(o.FirewallActive) { return true } return false } -// GetFirewallType returns the FirewallType field value -// If the value is explicit nil, nil is returned -func (o *NicProperties) GetFirewallType() *string { - if o == nil { - return nil - } - - return o.FirewallType +// SetFirewallActive gets a reference to the given bool and assigns it to the FirewallActive field. +func (o *NicProperties) SetFirewallActive(v bool) { + o.FirewallActive = &v +} +// GetFirewallType returns the FirewallType field value if set, zero value otherwise. +func (o *NicProperties) GetFirewallType() string { + if o == nil || IsNil(o.FirewallType) { + var ret string + return ret + } + return *o.FirewallType } -// GetFirewallTypeOk returns a tuple with the FirewallType field value +// GetFirewallTypeOk returns a tuple with the FirewallType 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 *NicProperties) GetFirewallTypeOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.FirewallType) { return nil, false } - return o.FirewallType, true } -// SetFirewallType sets field value -func (o *NicProperties) SetFirewallType(v string) { - - o.FirewallType = &v - -} - // HasFirewallType returns a boolean if a field has been set. func (o *NicProperties) HasFirewallType() bool { - if o != nil && o.FirewallType != nil { + if o != nil && !IsNil(o.FirewallType) { return true } return false } -// GetDeviceNumber returns the DeviceNumber field value -// If the value is explicit nil, nil is returned -func (o *NicProperties) GetDeviceNumber() *int32 { - if o == nil { - return nil - } - - return o.DeviceNumber +// SetFirewallType gets a reference to the given string and assigns it to the FirewallType field. +func (o *NicProperties) SetFirewallType(v string) { + o.FirewallType = &v +} +// GetDeviceNumber returns the DeviceNumber field value if set, zero value otherwise. +func (o *NicProperties) GetDeviceNumber() int32 { + if o == nil || IsNil(o.DeviceNumber) { + var ret int32 + return ret + } + return *o.DeviceNumber } -// GetDeviceNumberOk returns a tuple with the DeviceNumber field value +// GetDeviceNumberOk returns a tuple with the DeviceNumber 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 *NicProperties) GetDeviceNumberOk() (*int32, bool) { - if o == nil { + if o == nil || IsNil(o.DeviceNumber) { return nil, false } - return o.DeviceNumber, true } -// SetDeviceNumber sets field value -func (o *NicProperties) SetDeviceNumber(v int32) { - - o.DeviceNumber = &v - -} - // HasDeviceNumber returns a boolean if a field has been set. func (o *NicProperties) HasDeviceNumber() bool { - if o != nil && o.DeviceNumber != nil { + if o != nil && !IsNil(o.DeviceNumber) { return true } return false } -// GetPciSlot returns the PciSlot field value -// If the value is explicit nil, nil is returned -func (o *NicProperties) GetPciSlot() *int32 { - if o == nil { - return nil - } - - return o.PciSlot +// SetDeviceNumber gets a reference to the given int32 and assigns it to the DeviceNumber field. +func (o *NicProperties) SetDeviceNumber(v int32) { + o.DeviceNumber = &v +} +// GetPciSlot returns the PciSlot field value if set, zero value otherwise. +func (o *NicProperties) GetPciSlot() int32 { + if o == nil || IsNil(o.PciSlot) { + var ret int32 + return ret + } + return *o.PciSlot } -// GetPciSlotOk returns a tuple with the PciSlot field value +// GetPciSlotOk returns a tuple with the PciSlot 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 *NicProperties) GetPciSlotOk() (*int32, bool) { - if o == nil { + if o == nil || IsNil(o.PciSlot) { return nil, false } - return o.PciSlot, true } -// SetPciSlot sets field value -func (o *NicProperties) SetPciSlot(v int32) { - - o.PciSlot = &v - -} - // HasPciSlot returns a boolean if a field has been set. func (o *NicProperties) HasPciSlot() bool { - if o != nil && o.PciSlot != nil { + if o != nil && !IsNil(o.PciSlot) { return true } return false } -// GetVnet returns the Vnet field value -// If the value is explicit nil, nil is returned -func (o *NicProperties) GetVnet() *string { - if o == nil { - return nil - } - - return o.Vnet +// SetPciSlot gets a reference to the given int32 and assigns it to the PciSlot field. +func (o *NicProperties) SetPciSlot(v int32) { + o.PciSlot = &v +} +// GetVnet returns the Vnet field value if set, zero value otherwise. +func (o *NicProperties) GetVnet() string { + if o == nil || IsNil(o.Vnet) { + var ret string + return ret + } + return *o.Vnet } -// GetVnetOk returns a tuple with the Vnet field value +// GetVnetOk returns a tuple with the Vnet 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 *NicProperties) GetVnetOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Vnet) { return nil, false } - return o.Vnet, true } -// SetVnet sets field value -func (o *NicProperties) SetVnet(v string) { - - o.Vnet = &v - -} - // HasVnet returns a boolean if a field has been set. func (o *NicProperties) HasVnet() bool { - if o != nil && o.Vnet != nil { + if o != nil && !IsNil(o.Vnet) { return true } return false } +// SetVnet gets a reference to the given string and assigns it to the Vnet field. +func (o *NicProperties) SetVnet(v string) { + o.Vnet = &v +} + func (o NicProperties) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o NicProperties) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Name != nil { + if !IsNil(o.Name) { toSerialize["name"] = o.Name } - - if o.Mac != nil { + if !IsNil(o.Mac) { toSerialize["mac"] = o.Mac } - if o.Ips != nil { toSerialize["ips"] = o.Ips } - if o.Dhcp != nil { + if !IsNil(o.Dhcp) { toSerialize["dhcp"] = o.Dhcp } - if o.Ipv6Ips != nil { toSerialize["ipv6Ips"] = o.Ipv6Ips } - - if o.Ipv6CidrBlock == &Nilstring { - toSerialize["ipv6CidrBlock"] = nil - } else if o.Ipv6CidrBlock != nil { - toSerialize["ipv6CidrBlock"] = o.Ipv6CidrBlock + if o.Ipv6CidrBlock.IsSet() { + toSerialize["ipv6CidrBlock"] = o.Ipv6CidrBlock.Get() } - - if o.Dhcpv6 == &Nilbool { - toSerialize["dhcpv6"] = nil - } else if o.Dhcpv6 != nil { - toSerialize["dhcpv6"] = o.Dhcpv6 - } - if o.Lan != nil { - toSerialize["lan"] = o.Lan + if o.Dhcpv6.IsSet() { + toSerialize["dhcpv6"] = o.Dhcpv6.Get() } - - if o.FirewallActive != nil { + toSerialize["lan"] = o.Lan + if !IsNil(o.FirewallActive) { toSerialize["firewallActive"] = o.FirewallActive } - - if o.FirewallType != nil { + if !IsNil(o.FirewallType) { toSerialize["firewallType"] = o.FirewallType } - - if o.DeviceNumber != nil { + if !IsNil(o.DeviceNumber) { toSerialize["deviceNumber"] = o.DeviceNumber } - - if o.PciSlot != nil { + if !IsNil(o.PciSlot) { toSerialize["pciSlot"] = o.PciSlot } - - if o.Vnet != nil { + if !IsNil(o.Vnet) { toSerialize["vnet"] = o.Vnet } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableNicProperties struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_nic_put.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_nic_put.go similarity index 67% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_nic_put.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_nic_put.go index b8c8131f4..e7d85e943 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_nic_put.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_nic_put.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the NicPut type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NicPut{} + // NicPut struct for NicPut type NicPut struct { // The resource's unique identifier. @@ -21,8 +24,8 @@ type NicPut struct { // The type of object that has been created. Type *Type `json:"type,omitempty"` // URL to the object representation (absolute path). - Href *string `json:"href,omitempty"` - Properties *NicProperties `json:"properties"` + Href *string `json:"href,omitempty"` + Properties NicProperties `json:"properties"` } // NewNicPut instantiates a new NicPut object @@ -32,7 +35,7 @@ type NicPut struct { func NewNicPut(properties NicProperties) *NicPut { this := NicPut{} - this.Properties = &properties + this.Properties = properties return &this } @@ -45,177 +48,147 @@ func NewNicPutWithDefaults() *NicPut { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *NicPut) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *NicPut) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *NicPut) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *NicPut) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *NicPut) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *NicPut) GetType() *Type { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *NicPut) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *NicPut) GetType() Type { + if o == nil || IsNil(o.Type) { + var ret Type + return ret + } + return *o.Type } -// GetTypeOk returns a tuple with the Type field value +// GetTypeOk returns a tuple with the Type 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 *NicPut) GetTypeOk() (*Type, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *NicPut) SetType(v Type) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *NicPut) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *NicPut) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given Type and assigns it to the Type field. +func (o *NicPut) SetType(v Type) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *NicPut) 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 +// GetHrefOk returns a tuple with the Href 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 *NicPut) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *NicPut) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *NicPut) HasHref() bool { - if o != nil && o.Href != nil { + 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 *NicPut) SetHref(v string) { + o.Href = &v +} + // GetProperties returns the Properties field value -// If the value is explicit nil, nil is returned -func (o *NicPut) GetProperties() *NicProperties { +func (o *NicPut) GetProperties() NicProperties { if o == nil { - return nil + var ret NicProperties + return ret } return o.Properties - } // GetPropertiesOk returns a tuple with the Properties field value // 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 *NicPut) GetPropertiesOk() (*NicProperties, bool) { if o == nil { return nil, false } - - return o.Properties, true + return &o.Properties, true } // SetProperties sets field value func (o *NicPut) SetProperties(v NicProperties) { - - o.Properties = &v - + o.Properties = v } -// HasProperties returns a boolean if a field has been set. -func (o *NicPut) HasProperties() bool { - if o != nil && o.Properties != nil { - return true +func (o NicPut) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } - - return false + return json.Marshal(toSerialize) } -func (o NicPut) MarshalJSON() ([]byte, error) { +func (o NicPut) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Properties != nil { - toSerialize["properties"] = o.Properties - } - - return json.Marshal(toSerialize) + toSerialize["properties"] = o.Properties + return toSerialize, nil } type NullableNicPut struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_nics.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_nics.go similarity index 59% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_nics.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_nics.go index 08aee71be..224031e0c 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_nics.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_nics.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the Nics type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Nics{} + // Nics struct for Nics type Nics struct { // The resource's unique identifier. @@ -23,7 +26,7 @@ type Nics struct { // URL to the object representation (absolute path). Href *string `json:"href,omitempty"` // Array of items in the collection. - Items *[]Nic `json:"items,omitempty"` + Items []Nic `json:"items,omitempty"` // The offset (if specified in the request). Offset *float32 `json:"offset,omitempty"` // The limit (if specified in the request). @@ -49,303 +52,262 @@ func NewNicsWithDefaults() *Nics { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *Nics) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *Nics) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *Nics) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *Nics) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *Nics) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *Nics) GetType() *Type { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Nics) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *Nics) GetType() Type { + if o == nil || IsNil(o.Type) { + var ret Type + return ret + } + return *o.Type } -// GetTypeOk returns a tuple with the Type field value +// GetTypeOk returns a tuple with the Type 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 *Nics) GetTypeOk() (*Type, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *Nics) SetType(v Type) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *Nics) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *Nics) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given Type and assigns it to the Type field. +func (o *Nics) SetType(v Type) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *Nics) 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 +// GetHrefOk returns a tuple with the Href 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 *Nics) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *Nics) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *Nics) HasHref() bool { - if o != nil && o.Href != nil { + if o != nil && !IsNil(o.Href) { return true } return false } -// GetItems returns the Items field value -// If the value is explicit nil, nil is returned -func (o *Nics) GetItems() *[]Nic { - if o == nil { - return nil - } +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *Nics) SetHref(v string) { + o.Href = &v +} +// GetItems returns the Items field value if set, zero value otherwise. +func (o *Nics) GetItems() []Nic { + if o == nil || IsNil(o.Items) { + var ret []Nic + return ret + } return o.Items - } -// GetItemsOk returns a tuple with the Items field value +// GetItemsOk returns a tuple with the Items 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 *Nics) GetItemsOk() (*[]Nic, bool) { - if o == nil { +func (o *Nics) GetItemsOk() ([]Nic, bool) { + if o == nil || IsNil(o.Items) { return nil, false } - return o.Items, true } -// SetItems sets field value -func (o *Nics) SetItems(v []Nic) { - - o.Items = &v - -} - // HasItems returns a boolean if a field has been set. func (o *Nics) HasItems() bool { - if o != nil && o.Items != nil { + if o != nil && !IsNil(o.Items) { return true } return false } -// GetOffset returns the Offset field value -// If the value is explicit nil, nil is returned -func (o *Nics) GetOffset() *float32 { - if o == nil { - return nil - } - - return o.Offset +// SetItems gets a reference to the given []Nic and assigns it to the Items field. +func (o *Nics) SetItems(v []Nic) { + o.Items = v +} +// GetOffset returns the Offset field value if set, zero value otherwise. +func (o *Nics) GetOffset() float32 { + if o == nil || IsNil(o.Offset) { + var ret float32 + return ret + } + return *o.Offset } -// GetOffsetOk returns a tuple with the Offset field value +// GetOffsetOk returns a tuple with the Offset 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 *Nics) GetOffsetOk() (*float32, bool) { - if o == nil { + if o == nil || IsNil(o.Offset) { return nil, false } - return o.Offset, true } -// SetOffset sets field value -func (o *Nics) SetOffset(v float32) { - - o.Offset = &v - -} - // HasOffset returns a boolean if a field has been set. func (o *Nics) HasOffset() bool { - if o != nil && o.Offset != nil { + if o != nil && !IsNil(o.Offset) { return true } return false } -// GetLimit returns the Limit field value -// If the value is explicit nil, nil is returned -func (o *Nics) GetLimit() *float32 { - if o == nil { - return nil - } - - return o.Limit +// SetOffset gets a reference to the given float32 and assigns it to the Offset field. +func (o *Nics) SetOffset(v float32) { + o.Offset = &v +} +// GetLimit returns the Limit field value if set, zero value otherwise. +func (o *Nics) GetLimit() float32 { + if o == nil || IsNil(o.Limit) { + var ret float32 + return ret + } + return *o.Limit } -// GetLimitOk returns a tuple with the Limit field value +// GetLimitOk returns a tuple with the Limit 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 *Nics) GetLimitOk() (*float32, bool) { - if o == nil { + if o == nil || IsNil(o.Limit) { return nil, false } - return o.Limit, true } -// SetLimit sets field value -func (o *Nics) SetLimit(v float32) { - - o.Limit = &v - -} - // HasLimit returns a boolean if a field has been set. func (o *Nics) HasLimit() bool { - if o != nil && o.Limit != nil { + if o != nil && !IsNil(o.Limit) { return true } return false } -// GetLinks returns the Links field value -// If the value is explicit nil, nil is returned -func (o *Nics) GetLinks() *PaginationLinks { - if o == nil { - return nil - } - - return o.Links +// SetLimit gets a reference to the given float32 and assigns it to the Limit field. +func (o *Nics) SetLimit(v float32) { + o.Limit = &v +} +// GetLinks returns the Links field value if set, zero value otherwise. +func (o *Nics) GetLinks() PaginationLinks { + if o == nil || IsNil(o.Links) { + var ret PaginationLinks + return ret + } + return *o.Links } -// GetLinksOk returns a tuple with the Links field value +// GetLinksOk returns a tuple with the Links 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 *Nics) GetLinksOk() (*PaginationLinks, bool) { - if o == nil { + if o == nil || IsNil(o.Links) { return nil, false } - return o.Links, true } -// SetLinks sets field value -func (o *Nics) SetLinks(v PaginationLinks) { - - o.Links = &v - -} - // HasLinks returns a boolean if a field has been set. func (o *Nics) HasLinks() bool { - if o != nil && o.Links != nil { + if o != nil && !IsNil(o.Links) { return true } return false } +// SetLinks gets a reference to the given PaginationLinks and assigns it to the Links field. +func (o *Nics) SetLinks(v PaginationLinks) { + o.Links = &v +} + func (o Nics) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Nics) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Items != nil { + if !IsNil(o.Items) { toSerialize["items"] = o.Items } - - if o.Offset != nil { + if !IsNil(o.Offset) { toSerialize["offset"] = o.Offset } - - if o.Limit != nil { + if !IsNil(o.Limit) { toSerialize["limit"] = o.Limit } - - if o.Links != nil { + if !IsNil(o.Links) { toSerialize["_links"] = o.Links } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableNics struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_no_state_meta_data.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_no_state_meta_data.go similarity index 64% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_no_state_meta_data.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_no_state_meta_data.go index 43dd28282..04c4d9347 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_no_state_meta_data.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_no_state_meta_data.go @@ -12,21 +12,25 @@ package ionoscloud import ( "encoding/json" + "time" ) +// checks if the NoStateMetaData type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &NoStateMetaData{} + // NoStateMetaData struct for NoStateMetaData type NoStateMetaData struct { // Resource's Entity Tag as defined in http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.11 Entity Tag is also added as an 'ETag response header to requests which don't use 'depth' parameter. Etag *string `json:"etag,omitempty"` // The time when the resource was created. - CreatedDate *IonosTime + CreatedDate *IonosTime `json:"createdDate,omitempty"` // The user who has created the resource. CreatedBy *string `json:"createdBy,omitempty"` // The unique ID of the user who created the resource. CreatedByUserId *string `json:"createdByUserId,omitempty"` // The last time the resource was modified. - LastModifiedDate *IonosTime + LastModifiedDate *IonosTime `json:"lastModifiedDate,omitempty"` // The user who last modified the resource. LastModifiedBy *string `json:"lastModifiedBy,omitempty"` // The unique ID of the user who last modified the resource. @@ -51,317 +55,262 @@ func NewNoStateMetaDataWithDefaults() *NoStateMetaData { return &this } -// GetEtag returns the Etag field value -// If the value is explicit nil, nil is returned -func (o *NoStateMetaData) GetEtag() *string { - if o == nil { - return nil +// GetEtag returns the Etag field value if set, zero value otherwise. +func (o *NoStateMetaData) GetEtag() string { + if o == nil || IsNil(o.Etag) { + var ret string + return ret } - - return o.Etag - + return *o.Etag } -// GetEtagOk returns a tuple with the Etag field value +// GetEtagOk returns a tuple with the Etag 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 *NoStateMetaData) GetEtagOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Etag) { return nil, false } - return o.Etag, true } -// SetEtag sets field value -func (o *NoStateMetaData) SetEtag(v string) { - - o.Etag = &v - -} - // HasEtag returns a boolean if a field has been set. func (o *NoStateMetaData) HasEtag() bool { - if o != nil && o.Etag != nil { + if o != nil && !IsNil(o.Etag) { return true } return false } -// GetCreatedDate returns the CreatedDate field value -// If the value is explicit nil, nil is returned -func (o *NoStateMetaData) GetCreatedDate() *time.Time { - if o == nil { - return nil - } +// SetEtag gets a reference to the given string and assigns it to the Etag field. +func (o *NoStateMetaData) SetEtag(v string) { + o.Etag = &v +} - if o.CreatedDate == nil { - return nil +// GetCreatedDate returns the CreatedDate field value if set, zero value otherwise. +func (o *NoStateMetaData) GetCreatedDate() time.Time { + if o == nil || IsNil(o.CreatedDate) { + var ret time.Time + return ret } - return &o.CreatedDate.Time - + return o.CreatedDate.Time } -// GetCreatedDateOk returns a tuple with the CreatedDate field value +// GetCreatedDateOk returns a tuple with the CreatedDate 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 *NoStateMetaData) GetCreatedDateOk() (*time.Time, bool) { - if o == nil { - return nil, false - } - - if o.CreatedDate == nil { + if o == nil || IsNil(o.CreatedDate) { return nil, false } return &o.CreatedDate.Time, true - -} - -// SetCreatedDate sets field value -func (o *NoStateMetaData) SetCreatedDate(v time.Time) { - - o.CreatedDate = &IonosTime{v} - } // HasCreatedDate returns a boolean if a field has been set. func (o *NoStateMetaData) HasCreatedDate() bool { - if o != nil && o.CreatedDate != nil { + if o != nil && !IsNil(o.CreatedDate) { return true } return false } -// GetCreatedBy returns the CreatedBy field value -// If the value is explicit nil, nil is returned -func (o *NoStateMetaData) GetCreatedBy() *string { - if o == nil { - return nil - } - - return o.CreatedBy +// SetCreatedDate gets a reference to the given time.Time and assigns it to the CreatedDate field. +func (o *NoStateMetaData) SetCreatedDate(v time.Time) { + o.CreatedDate = &IonosTime{v} +} +// GetCreatedBy returns the CreatedBy field value if set, zero value otherwise. +func (o *NoStateMetaData) GetCreatedBy() string { + if o == nil || IsNil(o.CreatedBy) { + var ret string + return ret + } + return *o.CreatedBy } -// GetCreatedByOk returns a tuple with the CreatedBy field value +// GetCreatedByOk returns a tuple with the CreatedBy 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 *NoStateMetaData) GetCreatedByOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.CreatedBy) { return nil, false } - return o.CreatedBy, true } -// SetCreatedBy sets field value -func (o *NoStateMetaData) SetCreatedBy(v string) { - - o.CreatedBy = &v - -} - // HasCreatedBy returns a boolean if a field has been set. func (o *NoStateMetaData) HasCreatedBy() bool { - if o != nil && o.CreatedBy != nil { + if o != nil && !IsNil(o.CreatedBy) { return true } return false } -// GetCreatedByUserId returns the CreatedByUserId field value -// If the value is explicit nil, nil is returned -func (o *NoStateMetaData) GetCreatedByUserId() *string { - if o == nil { - return nil - } - - return o.CreatedByUserId +// SetCreatedBy gets a reference to the given string and assigns it to the CreatedBy field. +func (o *NoStateMetaData) SetCreatedBy(v string) { + o.CreatedBy = &v +} +// GetCreatedByUserId returns the CreatedByUserId field value if set, zero value otherwise. +func (o *NoStateMetaData) GetCreatedByUserId() string { + if o == nil || IsNil(o.CreatedByUserId) { + var ret string + return ret + } + return *o.CreatedByUserId } -// GetCreatedByUserIdOk returns a tuple with the CreatedByUserId field value +// GetCreatedByUserIdOk returns a tuple with the CreatedByUserId 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 *NoStateMetaData) GetCreatedByUserIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.CreatedByUserId) { return nil, false } - return o.CreatedByUserId, true } -// SetCreatedByUserId sets field value -func (o *NoStateMetaData) SetCreatedByUserId(v string) { - - o.CreatedByUserId = &v - -} - // HasCreatedByUserId returns a boolean if a field has been set. func (o *NoStateMetaData) HasCreatedByUserId() bool { - if o != nil && o.CreatedByUserId != nil { + if o != nil && !IsNil(o.CreatedByUserId) { return true } return false } -// GetLastModifiedDate returns the LastModifiedDate field value -// If the value is explicit nil, nil is returned -func (o *NoStateMetaData) GetLastModifiedDate() *time.Time { - if o == nil { - return nil - } +// SetCreatedByUserId gets a reference to the given string and assigns it to the CreatedByUserId field. +func (o *NoStateMetaData) SetCreatedByUserId(v string) { + o.CreatedByUserId = &v +} - if o.LastModifiedDate == nil { - return nil +// GetLastModifiedDate returns the LastModifiedDate field value if set, zero value otherwise. +func (o *NoStateMetaData) GetLastModifiedDate() time.Time { + if o == nil || IsNil(o.LastModifiedDate) { + var ret time.Time + return ret } - return &o.LastModifiedDate.Time - + return o.LastModifiedDate.Time } -// GetLastModifiedDateOk returns a tuple with the LastModifiedDate field value +// GetLastModifiedDateOk returns a tuple with the LastModifiedDate 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 *NoStateMetaData) GetLastModifiedDateOk() (*time.Time, bool) { - if o == nil { - return nil, false - } - - if o.LastModifiedDate == nil { + if o == nil || IsNil(o.LastModifiedDate) { return nil, false } return &o.LastModifiedDate.Time, true - -} - -// SetLastModifiedDate sets field value -func (o *NoStateMetaData) SetLastModifiedDate(v time.Time) { - - o.LastModifiedDate = &IonosTime{v} - } // HasLastModifiedDate returns a boolean if a field has been set. func (o *NoStateMetaData) HasLastModifiedDate() bool { - if o != nil && o.LastModifiedDate != nil { + if o != nil && !IsNil(o.LastModifiedDate) { return true } return false } -// GetLastModifiedBy returns the LastModifiedBy field value -// If the value is explicit nil, nil is returned -func (o *NoStateMetaData) GetLastModifiedBy() *string { - if o == nil { - return nil - } - - return o.LastModifiedBy +// SetLastModifiedDate gets a reference to the given time.Time and assigns it to the LastModifiedDate field. +func (o *NoStateMetaData) SetLastModifiedDate(v time.Time) { + o.LastModifiedDate = &IonosTime{v} +} +// GetLastModifiedBy returns the LastModifiedBy field value if set, zero value otherwise. +func (o *NoStateMetaData) GetLastModifiedBy() string { + if o == nil || IsNil(o.LastModifiedBy) { + var ret string + return ret + } + return *o.LastModifiedBy } -// GetLastModifiedByOk returns a tuple with the LastModifiedBy field value +// GetLastModifiedByOk returns a tuple with the LastModifiedBy 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 *NoStateMetaData) GetLastModifiedByOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.LastModifiedBy) { return nil, false } - return o.LastModifiedBy, true } -// SetLastModifiedBy sets field value -func (o *NoStateMetaData) SetLastModifiedBy(v string) { - - o.LastModifiedBy = &v - -} - // HasLastModifiedBy returns a boolean if a field has been set. func (o *NoStateMetaData) HasLastModifiedBy() bool { - if o != nil && o.LastModifiedBy != nil { + if o != nil && !IsNil(o.LastModifiedBy) { return true } return false } -// GetLastModifiedByUserId returns the LastModifiedByUserId field value -// If the value is explicit nil, nil is returned -func (o *NoStateMetaData) GetLastModifiedByUserId() *string { - if o == nil { - return nil - } - - return o.LastModifiedByUserId +// SetLastModifiedBy gets a reference to the given string and assigns it to the LastModifiedBy field. +func (o *NoStateMetaData) SetLastModifiedBy(v string) { + o.LastModifiedBy = &v +} +// GetLastModifiedByUserId returns the LastModifiedByUserId field value if set, zero value otherwise. +func (o *NoStateMetaData) GetLastModifiedByUserId() string { + if o == nil || IsNil(o.LastModifiedByUserId) { + var ret string + return ret + } + return *o.LastModifiedByUserId } -// GetLastModifiedByUserIdOk returns a tuple with the LastModifiedByUserId field value +// GetLastModifiedByUserIdOk returns a tuple with the LastModifiedByUserId 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 *NoStateMetaData) GetLastModifiedByUserIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.LastModifiedByUserId) { return nil, false } - return o.LastModifiedByUserId, true } -// SetLastModifiedByUserId sets field value -func (o *NoStateMetaData) SetLastModifiedByUserId(v string) { - - o.LastModifiedByUserId = &v - -} - // HasLastModifiedByUserId returns a boolean if a field has been set. func (o *NoStateMetaData) HasLastModifiedByUserId() bool { - if o != nil && o.LastModifiedByUserId != nil { + if o != nil && !IsNil(o.LastModifiedByUserId) { return true } return false } +// SetLastModifiedByUserId gets a reference to the given string and assigns it to the LastModifiedByUserId field. +func (o *NoStateMetaData) SetLastModifiedByUserId(v string) { + o.LastModifiedByUserId = &v +} + func (o NoStateMetaData) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o NoStateMetaData) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Etag != nil { + if !IsNil(o.Etag) { toSerialize["etag"] = o.Etag } - - if o.CreatedDate != nil { + if !IsNil(o.CreatedDate) { toSerialize["createdDate"] = o.CreatedDate } - - if o.CreatedBy != nil { + if !IsNil(o.CreatedBy) { toSerialize["createdBy"] = o.CreatedBy } - - if o.CreatedByUserId != nil { + if !IsNil(o.CreatedByUserId) { toSerialize["createdByUserId"] = o.CreatedByUserId } - - if o.LastModifiedDate != nil { + if !IsNil(o.LastModifiedDate) { toSerialize["lastModifiedDate"] = o.LastModifiedDate } - - if o.LastModifiedBy != nil { + if !IsNil(o.LastModifiedBy) { toSerialize["lastModifiedBy"] = o.LastModifiedBy } - - if o.LastModifiedByUserId != nil { + if !IsNil(o.LastModifiedByUserId) { toSerialize["lastModifiedByUserId"] = o.LastModifiedByUserId } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableNoStateMetaData struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_pagination_links.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_pagination_links.go similarity index 70% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_pagination_links.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_pagination_links.go index 9f20e1c17..16e842c25 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_pagination_links.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_pagination_links.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the PaginationLinks type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PaginationLinks{} + // PaginationLinks struct for PaginationLinks type PaginationLinks struct { // URL (with offset and limit parameters) of the previous page; only present if offset is greater than 0. @@ -42,135 +45,122 @@ func NewPaginationLinksWithDefaults() *PaginationLinks { return &this } -// GetPrev returns the Prev field value -// If the value is explicit nil, nil is returned -func (o *PaginationLinks) GetPrev() *string { - if o == nil { - return nil +// GetPrev returns the Prev field value if set, zero value otherwise. +func (o *PaginationLinks) GetPrev() string { + if o == nil || IsNil(o.Prev) { + var ret string + return ret } - - return o.Prev - + return *o.Prev } -// GetPrevOk returns a tuple with the Prev field value +// GetPrevOk returns a tuple with the Prev 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 *PaginationLinks) GetPrevOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Prev) { return nil, false } - return o.Prev, true } -// SetPrev sets field value -func (o *PaginationLinks) SetPrev(v string) { - - o.Prev = &v - -} - // HasPrev returns a boolean if a field has been set. func (o *PaginationLinks) HasPrev() bool { - if o != nil && o.Prev != nil { + if o != nil && !IsNil(o.Prev) { return true } return false } -// GetSelf returns the Self field value -// If the value is explicit nil, nil is returned -func (o *PaginationLinks) GetSelf() *string { - if o == nil { - return nil - } - - return o.Self +// SetPrev gets a reference to the given string and assigns it to the Prev field. +func (o *PaginationLinks) SetPrev(v string) { + o.Prev = &v +} +// GetSelf returns the Self field value if set, zero value otherwise. +func (o *PaginationLinks) GetSelf() string { + if o == nil || IsNil(o.Self) { + var ret string + return ret + } + return *o.Self } -// GetSelfOk returns a tuple with the Self field value +// GetSelfOk returns a tuple with the Self 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 *PaginationLinks) GetSelfOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Self) { return nil, false } - return o.Self, true } -// SetSelf sets field value -func (o *PaginationLinks) SetSelf(v string) { - - o.Self = &v - -} - // HasSelf returns a boolean if a field has been set. func (o *PaginationLinks) HasSelf() bool { - if o != nil && o.Self != nil { + if o != nil && !IsNil(o.Self) { return true } return false } -// GetNext returns the Next field value -// If the value is explicit nil, nil is returned -func (o *PaginationLinks) GetNext() *string { - if o == nil { - return nil - } - - return o.Next +// SetSelf gets a reference to the given string and assigns it to the Self field. +func (o *PaginationLinks) SetSelf(v string) { + o.Self = &v +} +// GetNext returns the Next field value if set, zero value otherwise. +func (o *PaginationLinks) GetNext() string { + if o == nil || IsNil(o.Next) { + var ret string + return ret + } + return *o.Next } -// GetNextOk returns a tuple with the Next field value +// GetNextOk returns a tuple with the Next 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 *PaginationLinks) GetNextOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Next) { return nil, false } - return o.Next, true } -// SetNext sets field value -func (o *PaginationLinks) SetNext(v string) { - - o.Next = &v - -} - // HasNext returns a boolean if a field has been set. func (o *PaginationLinks) HasNext() bool { - if o != nil && o.Next != nil { + if o != nil && !IsNil(o.Next) { return true } return false } +// SetNext gets a reference to the given string and assigns it to the Next field. +func (o *PaginationLinks) SetNext(v string) { + o.Next = &v +} + func (o PaginationLinks) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o PaginationLinks) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Prev != nil { + if !IsNil(o.Prev) { toSerialize["prev"] = o.Prev } - - if o.Self != nil { + if !IsNil(o.Self) { toSerialize["self"] = o.Self } - - if o.Next != nil { + if !IsNil(o.Next) { toSerialize["next"] = o.Next } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullablePaginationLinks struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_peer.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_peer.go similarity index 64% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_peer.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_peer.go index 69a731df6..fcf6ca878 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_peer.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_peer.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the Peer type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Peer{} + // Peer struct for Peer type Peer struct { // Identifier of the LAN connected to the Cross Connect. @@ -46,219 +49,192 @@ func NewPeerWithDefaults() *Peer { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *Peer) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *Peer) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *Peer) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *Peer) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *Peer) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetName returns the Name field value -// If the value is explicit nil, nil is returned -func (o *Peer) GetName() *string { - if o == nil { - return nil - } - - return o.Name +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Peer) SetId(v string) { + o.Id = &v +} +// GetName returns the Name field value if set, zero value otherwise. +func (o *Peer) 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 +// GetNameOk returns a tuple with the Name 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 *Peer) GetNameOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Name) { return nil, false } - return o.Name, true } -// SetName sets field value -func (o *Peer) SetName(v string) { - - o.Name = &v - -} - // HasName returns a boolean if a field has been set. func (o *Peer) HasName() bool { - if o != nil && o.Name != nil { + if o != nil && !IsNil(o.Name) { return true } return false } -// GetDatacenterId returns the DatacenterId field value -// If the value is explicit nil, nil is returned -func (o *Peer) GetDatacenterId() *string { - if o == nil { - return nil - } - - return o.DatacenterId +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *Peer) SetName(v string) { + o.Name = &v +} +// GetDatacenterId returns the DatacenterId field value if set, zero value otherwise. +func (o *Peer) GetDatacenterId() string { + if o == nil || IsNil(o.DatacenterId) { + var ret string + return ret + } + return *o.DatacenterId } -// GetDatacenterIdOk returns a tuple with the DatacenterId field value +// GetDatacenterIdOk returns a tuple with the DatacenterId 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 *Peer) GetDatacenterIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.DatacenterId) { return nil, false } - return o.DatacenterId, true } -// SetDatacenterId sets field value -func (o *Peer) SetDatacenterId(v string) { - - o.DatacenterId = &v - -} - // HasDatacenterId returns a boolean if a field has been set. func (o *Peer) HasDatacenterId() bool { - if o != nil && o.DatacenterId != nil { + if o != nil && !IsNil(o.DatacenterId) { return true } return false } -// GetDatacenterName returns the DatacenterName field value -// If the value is explicit nil, nil is returned -func (o *Peer) GetDatacenterName() *string { - if o == nil { - return nil - } - - return o.DatacenterName +// SetDatacenterId gets a reference to the given string and assigns it to the DatacenterId field. +func (o *Peer) SetDatacenterId(v string) { + o.DatacenterId = &v +} +// GetDatacenterName returns the DatacenterName field value if set, zero value otherwise. +func (o *Peer) GetDatacenterName() string { + if o == nil || IsNil(o.DatacenterName) { + var ret string + return ret + } + return *o.DatacenterName } -// GetDatacenterNameOk returns a tuple with the DatacenterName field value +// GetDatacenterNameOk returns a tuple with the DatacenterName 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 *Peer) GetDatacenterNameOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.DatacenterName) { return nil, false } - return o.DatacenterName, true } -// SetDatacenterName sets field value -func (o *Peer) SetDatacenterName(v string) { - - o.DatacenterName = &v - -} - // HasDatacenterName returns a boolean if a field has been set. func (o *Peer) HasDatacenterName() bool { - if o != nil && o.DatacenterName != nil { + if o != nil && !IsNil(o.DatacenterName) { return true } return false } -// GetLocation returns the Location field value -// If the value is explicit nil, nil is returned -func (o *Peer) GetLocation() *string { - if o == nil { - return nil - } - - return o.Location +// SetDatacenterName gets a reference to the given string and assigns it to the DatacenterName field. +func (o *Peer) SetDatacenterName(v string) { + o.DatacenterName = &v +} +// GetLocation returns the Location field value if set, zero value otherwise. +func (o *Peer) GetLocation() string { + if o == nil || IsNil(o.Location) { + var ret string + return ret + } + return *o.Location } -// GetLocationOk returns a tuple with the Location field value +// GetLocationOk returns a tuple with the Location 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 *Peer) GetLocationOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Location) { return nil, false } - return o.Location, true } -// SetLocation sets field value -func (o *Peer) SetLocation(v string) { - - o.Location = &v - -} - // HasLocation returns a boolean if a field has been set. func (o *Peer) HasLocation() bool { - if o != nil && o.Location != nil { + if o != nil && !IsNil(o.Location) { return true } return false } +// SetLocation gets a reference to the given string and assigns it to the Location field. +func (o *Peer) SetLocation(v string) { + o.Location = &v +} + func (o Peer) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Peer) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Name != nil { + if !IsNil(o.Name) { toSerialize["name"] = o.Name } - - if o.DatacenterId != nil { + if !IsNil(o.DatacenterId) { toSerialize["datacenterId"] = o.DatacenterId } - - if o.DatacenterName != nil { + if !IsNil(o.DatacenterName) { toSerialize["datacenterName"] = o.DatacenterName } - - if o.Location != nil { + if !IsNil(o.Location) { toSerialize["location"] = o.Location } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullablePeer struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_private_cross_connect.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_private_cross_connect.go similarity index 64% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_private_cross_connect.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_private_cross_connect.go index ea004a8f1..edeb20511 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_private_cross_connect.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_private_cross_connect.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the PrivateCrossConnect type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PrivateCrossConnect{} + // PrivateCrossConnect struct for PrivateCrossConnect type PrivateCrossConnect struct { // The resource's unique identifier. @@ -21,9 +24,9 @@ type PrivateCrossConnect struct { // The type of object that has been created. Type *Type `json:"type,omitempty"` // URL to the object representation (absolute path). - Href *string `json:"href,omitempty"` - Metadata *DatacenterElementMetadata `json:"metadata,omitempty"` - Properties *PrivateCrossConnectProperties `json:"properties"` + Href *string `json:"href,omitempty"` + Metadata *DatacenterElementMetadata `json:"metadata,omitempty"` + Properties PrivateCrossConnectProperties `json:"properties"` } // NewPrivateCrossConnect instantiates a new PrivateCrossConnect object @@ -33,7 +36,7 @@ type PrivateCrossConnect struct { func NewPrivateCrossConnect(properties PrivateCrossConnectProperties) *PrivateCrossConnect { this := PrivateCrossConnect{} - this.Properties = &properties + this.Properties = properties return &this } @@ -46,219 +49,182 @@ func NewPrivateCrossConnectWithDefaults() *PrivateCrossConnect { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *PrivateCrossConnect) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *PrivateCrossConnect) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *PrivateCrossConnect) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *PrivateCrossConnect) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *PrivateCrossConnect) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *PrivateCrossConnect) GetType() *Type { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *PrivateCrossConnect) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *PrivateCrossConnect) GetType() Type { + if o == nil || IsNil(o.Type) { + var ret Type + return ret + } + return *o.Type } -// GetTypeOk returns a tuple with the Type field value +// GetTypeOk returns a tuple with the Type 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 *PrivateCrossConnect) GetTypeOk() (*Type, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *PrivateCrossConnect) SetType(v Type) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *PrivateCrossConnect) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *PrivateCrossConnect) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given Type and assigns it to the Type field. +func (o *PrivateCrossConnect) SetType(v Type) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *PrivateCrossConnect) 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 +// GetHrefOk returns a tuple with the Href 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 *PrivateCrossConnect) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *PrivateCrossConnect) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *PrivateCrossConnect) HasHref() bool { - if o != nil && o.Href != nil { + if o != nil && !IsNil(o.Href) { return true } return false } -// GetMetadata returns the Metadata field value -// If the value is explicit nil, nil is returned -func (o *PrivateCrossConnect) GetMetadata() *DatacenterElementMetadata { - if o == nil { - return nil - } - - return o.Metadata +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *PrivateCrossConnect) SetHref(v string) { + o.Href = &v +} +// GetMetadata returns the Metadata field value if set, zero value otherwise. +func (o *PrivateCrossConnect) GetMetadata() DatacenterElementMetadata { + if o == nil || IsNil(o.Metadata) { + var ret DatacenterElementMetadata + return ret + } + return *o.Metadata } -// GetMetadataOk returns a tuple with the Metadata field value +// GetMetadataOk returns a tuple with the Metadata 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 *PrivateCrossConnect) GetMetadataOk() (*DatacenterElementMetadata, bool) { - if o == nil { + if o == nil || IsNil(o.Metadata) { return nil, false } - return o.Metadata, true } -// SetMetadata sets field value -func (o *PrivateCrossConnect) SetMetadata(v DatacenterElementMetadata) { - - o.Metadata = &v - -} - // HasMetadata returns a boolean if a field has been set. func (o *PrivateCrossConnect) HasMetadata() bool { - if o != nil && o.Metadata != nil { + if o != nil && !IsNil(o.Metadata) { return true } return false } +// SetMetadata gets a reference to the given DatacenterElementMetadata and assigns it to the Metadata field. +func (o *PrivateCrossConnect) SetMetadata(v DatacenterElementMetadata) { + o.Metadata = &v +} + // GetProperties returns the Properties field value -// If the value is explicit nil, nil is returned -func (o *PrivateCrossConnect) GetProperties() *PrivateCrossConnectProperties { +func (o *PrivateCrossConnect) GetProperties() PrivateCrossConnectProperties { if o == nil { - return nil + var ret PrivateCrossConnectProperties + return ret } return o.Properties - } // GetPropertiesOk returns a tuple with the Properties field value // 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 *PrivateCrossConnect) GetPropertiesOk() (*PrivateCrossConnectProperties, bool) { if o == nil { return nil, false } - - return o.Properties, true + return &o.Properties, true } // SetProperties sets field value func (o *PrivateCrossConnect) SetProperties(v PrivateCrossConnectProperties) { - - o.Properties = &v - + o.Properties = v } -// HasProperties returns a boolean if a field has been set. -func (o *PrivateCrossConnect) HasProperties() bool { - if o != nil && o.Properties != nil { - return true +func (o PrivateCrossConnect) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } - - return false + return json.Marshal(toSerialize) } -func (o PrivateCrossConnect) MarshalJSON() ([]byte, error) { +func (o PrivateCrossConnect) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Metadata != nil { + if !IsNil(o.Metadata) { toSerialize["metadata"] = o.Metadata } - - if o.Properties != nil { - toSerialize["properties"] = o.Properties - } - - return json.Marshal(toSerialize) + toSerialize["properties"] = o.Properties + return toSerialize, nil } type NullablePrivateCrossConnect struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_private_cross_connect_properties.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_private_cross_connect_properties.go similarity index 68% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_private_cross_connect_properties.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_private_cross_connect_properties.go index c4eb87232..c069976b9 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_private_cross_connect_properties.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_private_cross_connect_properties.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the PrivateCrossConnectProperties type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PrivateCrossConnectProperties{} + // PrivateCrossConnectProperties struct for PrivateCrossConnectProperties type PrivateCrossConnectProperties struct { // The name of the Cross Connect. @@ -21,9 +24,9 @@ type PrivateCrossConnectProperties struct { // Human-readable description of the Cross Connect. Description *string `json:"description,omitempty"` // Read-Only attribute. Lists LAN's connected to this Cross Connect. - Peers *[]Peer `json:"peers,omitempty"` + Peers []Peer `json:"peers,omitempty"` // Read-Only attribute. Lists data centers that can be connected to this Cross Connect. If the Cross Connect is not connected to any LANs it lists all VDCs the user has access to. If the Cross Connect is connected to at least 1 LAN it lists all VDCs the user has access to in the location of the connected LAN. - ConnectableDatacenters *[]ConnectableDatacenter `json:"connectableDatacenters,omitempty"` + ConnectableDatacenters []ConnectableDatacenter `json:"connectableDatacenters,omitempty"` } // NewPrivateCrossConnectProperties instantiates a new PrivateCrossConnectProperties object @@ -44,177 +47,157 @@ func NewPrivateCrossConnectPropertiesWithDefaults() *PrivateCrossConnectProperti return &this } -// GetName returns the Name field value -// If the value is explicit nil, nil is returned -func (o *PrivateCrossConnectProperties) GetName() *string { - if o == nil { - return nil +// GetName returns the Name field value if set, zero value otherwise. +func (o *PrivateCrossConnectProperties) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret } - - return o.Name - + return *o.Name } -// GetNameOk returns a tuple with the Name field value +// GetNameOk returns a tuple with the Name 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 *PrivateCrossConnectProperties) GetNameOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Name) { return nil, false } - return o.Name, true } -// SetName sets field value -func (o *PrivateCrossConnectProperties) SetName(v string) { - - o.Name = &v - -} - // HasName returns a boolean if a field has been set. func (o *PrivateCrossConnectProperties) HasName() bool { - if o != nil && o.Name != nil { + if o != nil && !IsNil(o.Name) { return true } return false } -// GetDescription returns the Description field value -// If the value is explicit nil, nil is returned -func (o *PrivateCrossConnectProperties) GetDescription() *string { - if o == nil { - return nil - } - - return o.Description +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *PrivateCrossConnectProperties) SetName(v string) { + o.Name = &v +} +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *PrivateCrossConnectProperties) 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 +// GetDescriptionOk returns a tuple with the Description 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 *PrivateCrossConnectProperties) GetDescriptionOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Description) { return nil, false } - return o.Description, true } -// SetDescription sets field value -func (o *PrivateCrossConnectProperties) SetDescription(v string) { - - o.Description = &v - -} - // HasDescription returns a boolean if a field has been set. func (o *PrivateCrossConnectProperties) HasDescription() bool { - if o != nil && o.Description != nil { + if o != nil && !IsNil(o.Description) { return true } return false } -// GetPeers returns the Peers field value -// If the value is explicit nil, nil is returned -func (o *PrivateCrossConnectProperties) GetPeers() *[]Peer { - if o == nil { - return nil - } +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *PrivateCrossConnectProperties) SetDescription(v string) { + o.Description = &v +} +// GetPeers returns the Peers field value if set, zero value otherwise. +func (o *PrivateCrossConnectProperties) GetPeers() []Peer { + if o == nil || IsNil(o.Peers) { + var ret []Peer + return ret + } return o.Peers - } -// GetPeersOk returns a tuple with the Peers field value +// GetPeersOk returns a tuple with the Peers 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 *PrivateCrossConnectProperties) GetPeersOk() (*[]Peer, bool) { - if o == nil { +func (o *PrivateCrossConnectProperties) GetPeersOk() ([]Peer, bool) { + if o == nil || IsNil(o.Peers) { return nil, false } - return o.Peers, true } -// SetPeers sets field value -func (o *PrivateCrossConnectProperties) SetPeers(v []Peer) { - - o.Peers = &v - -} - // HasPeers returns a boolean if a field has been set. func (o *PrivateCrossConnectProperties) HasPeers() bool { - if o != nil && o.Peers != nil { + if o != nil && !IsNil(o.Peers) { return true } return false } -// GetConnectableDatacenters returns the ConnectableDatacenters field value -// If the value is explicit nil, nil is returned -func (o *PrivateCrossConnectProperties) GetConnectableDatacenters() *[]ConnectableDatacenter { - if o == nil { - return nil - } +// SetPeers gets a reference to the given []Peer and assigns it to the Peers field. +func (o *PrivateCrossConnectProperties) SetPeers(v []Peer) { + o.Peers = v +} +// GetConnectableDatacenters returns the ConnectableDatacenters field value if set, zero value otherwise. +func (o *PrivateCrossConnectProperties) GetConnectableDatacenters() []ConnectableDatacenter { + if o == nil || IsNil(o.ConnectableDatacenters) { + var ret []ConnectableDatacenter + return ret + } return o.ConnectableDatacenters - } -// GetConnectableDatacentersOk returns a tuple with the ConnectableDatacenters field value +// GetConnectableDatacentersOk returns a tuple with the ConnectableDatacenters 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 *PrivateCrossConnectProperties) GetConnectableDatacentersOk() (*[]ConnectableDatacenter, bool) { - if o == nil { +func (o *PrivateCrossConnectProperties) GetConnectableDatacentersOk() ([]ConnectableDatacenter, bool) { + if o == nil || IsNil(o.ConnectableDatacenters) { return nil, false } - return o.ConnectableDatacenters, true } -// SetConnectableDatacenters sets field value -func (o *PrivateCrossConnectProperties) SetConnectableDatacenters(v []ConnectableDatacenter) { - - o.ConnectableDatacenters = &v - -} - // HasConnectableDatacenters returns a boolean if a field has been set. func (o *PrivateCrossConnectProperties) HasConnectableDatacenters() bool { - if o != nil && o.ConnectableDatacenters != nil { + if o != nil && !IsNil(o.ConnectableDatacenters) { return true } return false } +// SetConnectableDatacenters gets a reference to the given []ConnectableDatacenter and assigns it to the ConnectableDatacenters field. +func (o *PrivateCrossConnectProperties) SetConnectableDatacenters(v []ConnectableDatacenter) { + o.ConnectableDatacenters = v +} + func (o PrivateCrossConnectProperties) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o PrivateCrossConnectProperties) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Name != nil { + if !IsNil(o.Name) { toSerialize["name"] = o.Name } - - if o.Description != nil { + if !IsNil(o.Description) { toSerialize["description"] = o.Description } - - if o.Peers != nil { + if !IsNil(o.Peers) { toSerialize["peers"] = o.Peers } - - if o.ConnectableDatacenters != nil { + if !IsNil(o.ConnectableDatacenters) { toSerialize["connectableDatacenters"] = o.ConnectableDatacenters } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullablePrivateCrossConnectProperties struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_private_cross_connects.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_private_cross_connects.go similarity index 65% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_private_cross_connects.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_private_cross_connects.go index 93ec063b3..ea19e6d4d 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_private_cross_connects.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_private_cross_connects.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the PrivateCrossConnects type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PrivateCrossConnects{} + // PrivateCrossConnects struct for PrivateCrossConnects type PrivateCrossConnects struct { // The resource's unique identifier. @@ -23,7 +26,7 @@ type PrivateCrossConnects struct { // URL to the object representation (absolute path). Href *string `json:"href,omitempty"` // Array of items in the collection. - Items *[]PrivateCrossConnect `json:"items,omitempty"` + Items []PrivateCrossConnect `json:"items,omitempty"` } // NewPrivateCrossConnects instantiates a new PrivateCrossConnects object @@ -44,177 +47,157 @@ func NewPrivateCrossConnectsWithDefaults() *PrivateCrossConnects { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *PrivateCrossConnects) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *PrivateCrossConnects) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *PrivateCrossConnects) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *PrivateCrossConnects) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *PrivateCrossConnects) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *PrivateCrossConnects) GetType() *Type { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *PrivateCrossConnects) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *PrivateCrossConnects) GetType() Type { + if o == nil || IsNil(o.Type) { + var ret Type + return ret + } + return *o.Type } -// GetTypeOk returns a tuple with the Type field value +// GetTypeOk returns a tuple with the Type 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 *PrivateCrossConnects) GetTypeOk() (*Type, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *PrivateCrossConnects) SetType(v Type) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *PrivateCrossConnects) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *PrivateCrossConnects) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given Type and assigns it to the Type field. +func (o *PrivateCrossConnects) SetType(v Type) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *PrivateCrossConnects) 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 +// GetHrefOk returns a tuple with the Href 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 *PrivateCrossConnects) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *PrivateCrossConnects) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *PrivateCrossConnects) HasHref() bool { - if o != nil && o.Href != nil { + if o != nil && !IsNil(o.Href) { return true } return false } -// GetItems returns the Items field value -// If the value is explicit nil, nil is returned -func (o *PrivateCrossConnects) GetItems() *[]PrivateCrossConnect { - if o == nil { - return nil - } +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *PrivateCrossConnects) SetHref(v string) { + o.Href = &v +} +// GetItems returns the Items field value if set, zero value otherwise. +func (o *PrivateCrossConnects) GetItems() []PrivateCrossConnect { + if o == nil || IsNil(o.Items) { + var ret []PrivateCrossConnect + return ret + } return o.Items - } -// GetItemsOk returns a tuple with the Items field value +// GetItemsOk returns a tuple with the Items 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 *PrivateCrossConnects) GetItemsOk() (*[]PrivateCrossConnect, bool) { - if o == nil { +func (o *PrivateCrossConnects) GetItemsOk() ([]PrivateCrossConnect, bool) { + if o == nil || IsNil(o.Items) { return nil, false } - return o.Items, true } -// SetItems sets field value -func (o *PrivateCrossConnects) SetItems(v []PrivateCrossConnect) { - - o.Items = &v - -} - // HasItems returns a boolean if a field has been set. func (o *PrivateCrossConnects) HasItems() bool { - if o != nil && o.Items != nil { + if o != nil && !IsNil(o.Items) { return true } return false } +// SetItems gets a reference to the given []PrivateCrossConnect and assigns it to the Items field. +func (o *PrivateCrossConnects) SetItems(v []PrivateCrossConnect) { + o.Items = v +} + func (o PrivateCrossConnects) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o PrivateCrossConnects) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Items != nil { + if !IsNil(o.Items) { toSerialize["items"] = o.Items } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullablePrivateCrossConnects struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_remote_console_url.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_remote_console_url.go similarity index 79% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_remote_console_url.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_remote_console_url.go index 123c34fd1..de6582d35 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_remote_console_url.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_remote_console_url.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the RemoteConsoleUrl type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &RemoteConsoleUrl{} + // RemoteConsoleUrl struct for RemoteConsoleUrl type RemoteConsoleUrl struct { // The remote console url with the jwToken parameter for access @@ -38,51 +41,52 @@ func NewRemoteConsoleUrlWithDefaults() *RemoteConsoleUrl { return &this } -// GetUrl returns the Url field value -// If the value is explicit nil, nil is returned -func (o *RemoteConsoleUrl) GetUrl() *string { - if o == nil { - return nil +// GetUrl returns the Url field value if set, zero value otherwise. +func (o *RemoteConsoleUrl) GetUrl() string { + if o == nil || IsNil(o.Url) { + var ret string + return ret } - - return o.Url - + return *o.Url } -// GetUrlOk returns a tuple with the Url field value +// GetUrlOk returns a tuple with the Url 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 *RemoteConsoleUrl) GetUrlOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Url) { return nil, false } - return o.Url, true } -// SetUrl sets field value -func (o *RemoteConsoleUrl) SetUrl(v string) { - - o.Url = &v - -} - // HasUrl returns a boolean if a field has been set. func (o *RemoteConsoleUrl) HasUrl() bool { - if o != nil && o.Url != nil { + if o != nil && !IsNil(o.Url) { return true } return false } +// SetUrl gets a reference to the given string and assigns it to the Url field. +func (o *RemoteConsoleUrl) SetUrl(v string) { + o.Url = &v +} + func (o RemoteConsoleUrl) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o RemoteConsoleUrl) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Url != nil { + if !IsNil(o.Url) { toSerialize["url"] = o.Url } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableRemoteConsoleUrl struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_request.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_request.go similarity index 63% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_request.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_request.go index ef8f9af9c..a685d4706 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_request.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_request.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the Request type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Request{} + // Request struct for Request type Request struct { // The resource's unique identifier. @@ -21,9 +24,9 @@ type Request struct { // The type of object that has been created. Type *Type `json:"type,omitempty"` // URL to the object representation (absolute path). - Href *string `json:"href,omitempty"` - Metadata *RequestMetadata `json:"metadata,omitempty"` - Properties *RequestProperties `json:"properties"` + Href *string `json:"href,omitempty"` + Metadata *RequestMetadata `json:"metadata,omitempty"` + Properties RequestProperties `json:"properties"` } // NewRequest instantiates a new Request object @@ -33,7 +36,7 @@ type Request struct { func NewRequest(properties RequestProperties) *Request { this := Request{} - this.Properties = &properties + this.Properties = properties return &this } @@ -46,219 +49,182 @@ func NewRequestWithDefaults() *Request { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *Request) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *Request) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *Request) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *Request) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *Request) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *Request) GetType() *Type { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Request) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *Request) GetType() Type { + if o == nil || IsNil(o.Type) { + var ret Type + return ret + } + return *o.Type } -// GetTypeOk returns a tuple with the Type field value +// GetTypeOk returns a tuple with the Type 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 *Request) GetTypeOk() (*Type, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *Request) SetType(v Type) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *Request) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *Request) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given Type and assigns it to the Type field. +func (o *Request) SetType(v Type) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *Request) 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 +// GetHrefOk returns a tuple with the Href 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 *Request) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *Request) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *Request) HasHref() bool { - if o != nil && o.Href != nil { + if o != nil && !IsNil(o.Href) { return true } return false } -// GetMetadata returns the Metadata field value -// If the value is explicit nil, nil is returned -func (o *Request) GetMetadata() *RequestMetadata { - if o == nil { - return nil - } - - return o.Metadata +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *Request) SetHref(v string) { + o.Href = &v +} +// GetMetadata returns the Metadata field value if set, zero value otherwise. +func (o *Request) GetMetadata() RequestMetadata { + if o == nil || IsNil(o.Metadata) { + var ret RequestMetadata + return ret + } + return *o.Metadata } -// GetMetadataOk returns a tuple with the Metadata field value +// GetMetadataOk returns a tuple with the Metadata 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 *Request) GetMetadataOk() (*RequestMetadata, bool) { - if o == nil { + if o == nil || IsNil(o.Metadata) { return nil, false } - return o.Metadata, true } -// SetMetadata sets field value -func (o *Request) SetMetadata(v RequestMetadata) { - - o.Metadata = &v - -} - // HasMetadata returns a boolean if a field has been set. func (o *Request) HasMetadata() bool { - if o != nil && o.Metadata != nil { + if o != nil && !IsNil(o.Metadata) { return true } return false } +// SetMetadata gets a reference to the given RequestMetadata and assigns it to the Metadata field. +func (o *Request) SetMetadata(v RequestMetadata) { + o.Metadata = &v +} + // GetProperties returns the Properties field value -// If the value is explicit nil, nil is returned -func (o *Request) GetProperties() *RequestProperties { +func (o *Request) GetProperties() RequestProperties { if o == nil { - return nil + var ret RequestProperties + return ret } return o.Properties - } // GetPropertiesOk returns a tuple with the Properties field value // 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 *Request) GetPropertiesOk() (*RequestProperties, bool) { if o == nil { return nil, false } - - return o.Properties, true + return &o.Properties, true } // SetProperties sets field value func (o *Request) SetProperties(v RequestProperties) { - - o.Properties = &v - + o.Properties = v } -// HasProperties returns a boolean if a field has been set. -func (o *Request) HasProperties() bool { - if o != nil && o.Properties != nil { - return true +func (o Request) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } - - return false + return json.Marshal(toSerialize) } -func (o Request) MarshalJSON() ([]byte, error) { +func (o Request) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Metadata != nil { + if !IsNil(o.Metadata) { toSerialize["metadata"] = o.Metadata } - - if o.Properties != nil { - toSerialize["properties"] = o.Properties - } - - return json.Marshal(toSerialize) + toSerialize["properties"] = o.Properties + return toSerialize, nil } type NullableRequest struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_request_metadata.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_request_metadata.go similarity index 68% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_request_metadata.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_request_metadata.go index e0e2fc967..05d9afb8c 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_request_metadata.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_request_metadata.go @@ -12,13 +12,17 @@ package ionoscloud import ( "encoding/json" + "time" ) +// checks if the RequestMetadata type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &RequestMetadata{} + // RequestMetadata struct for RequestMetadata type RequestMetadata struct { // The last time the resource was created. - CreatedDate *IonosTime + CreatedDate *IonosTime `json:"createdDate,omitempty"` // The user who created the resource. CreatedBy *string `json:"createdBy,omitempty"` // Resource's Entity Tag as defined in http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.11 Entity Tag is also added as an 'ETag response header to requests which don't use 'depth' parameter. @@ -44,184 +48,157 @@ func NewRequestMetadataWithDefaults() *RequestMetadata { return &this } -// GetCreatedDate returns the CreatedDate field value -// If the value is explicit nil, nil is returned -func (o *RequestMetadata) GetCreatedDate() *time.Time { - if o == nil { - return nil +// GetCreatedDate returns the CreatedDate field value if set, zero value otherwise. +func (o *RequestMetadata) GetCreatedDate() time.Time { + if o == nil || IsNil(o.CreatedDate) { + var ret time.Time + return ret } - - if o.CreatedDate == nil { - return nil - } - return &o.CreatedDate.Time - + return o.CreatedDate.Time } -// GetCreatedDateOk returns a tuple with the CreatedDate field value +// GetCreatedDateOk returns a tuple with the CreatedDate 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 *RequestMetadata) GetCreatedDateOk() (*time.Time, bool) { - if o == nil { - return nil, false - } - - if o.CreatedDate == nil { + if o == nil || IsNil(o.CreatedDate) { return nil, false } return &o.CreatedDate.Time, true - -} - -// SetCreatedDate sets field value -func (o *RequestMetadata) SetCreatedDate(v time.Time) { - - o.CreatedDate = &IonosTime{v} - } // HasCreatedDate returns a boolean if a field has been set. func (o *RequestMetadata) HasCreatedDate() bool { - if o != nil && o.CreatedDate != nil { + if o != nil && !IsNil(o.CreatedDate) { return true } return false } -// GetCreatedBy returns the CreatedBy field value -// If the value is explicit nil, nil is returned -func (o *RequestMetadata) GetCreatedBy() *string { - if o == nil { - return nil - } - - return o.CreatedBy +// SetCreatedDate gets a reference to the given time.Time and assigns it to the CreatedDate field. +func (o *RequestMetadata) SetCreatedDate(v time.Time) { + o.CreatedDate = &IonosTime{v} +} +// GetCreatedBy returns the CreatedBy field value if set, zero value otherwise. +func (o *RequestMetadata) GetCreatedBy() string { + if o == nil || IsNil(o.CreatedBy) { + var ret string + return ret + } + return *o.CreatedBy } -// GetCreatedByOk returns a tuple with the CreatedBy field value +// GetCreatedByOk returns a tuple with the CreatedBy 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 *RequestMetadata) GetCreatedByOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.CreatedBy) { return nil, false } - return o.CreatedBy, true } -// SetCreatedBy sets field value -func (o *RequestMetadata) SetCreatedBy(v string) { - - o.CreatedBy = &v - -} - // HasCreatedBy returns a boolean if a field has been set. func (o *RequestMetadata) HasCreatedBy() bool { - if o != nil && o.CreatedBy != nil { + if o != nil && !IsNil(o.CreatedBy) { return true } return false } -// GetEtag returns the Etag field value -// If the value is explicit nil, nil is returned -func (o *RequestMetadata) GetEtag() *string { - if o == nil { - return nil - } - - return o.Etag +// SetCreatedBy gets a reference to the given string and assigns it to the CreatedBy field. +func (o *RequestMetadata) SetCreatedBy(v string) { + o.CreatedBy = &v +} +// GetEtag returns the Etag field value if set, zero value otherwise. +func (o *RequestMetadata) GetEtag() string { + if o == nil || IsNil(o.Etag) { + var ret string + return ret + } + return *o.Etag } -// GetEtagOk returns a tuple with the Etag field value +// GetEtagOk returns a tuple with the Etag 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 *RequestMetadata) GetEtagOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Etag) { return nil, false } - return o.Etag, true } -// SetEtag sets field value -func (o *RequestMetadata) SetEtag(v string) { - - o.Etag = &v - -} - // HasEtag returns a boolean if a field has been set. func (o *RequestMetadata) HasEtag() bool { - if o != nil && o.Etag != nil { + if o != nil && !IsNil(o.Etag) { return true } return false } -// GetRequestStatus returns the RequestStatus field value -// If the value is explicit nil, nil is returned -func (o *RequestMetadata) GetRequestStatus() *RequestStatus { - if o == nil { - return nil - } - - return o.RequestStatus +// SetEtag gets a reference to the given string and assigns it to the Etag field. +func (o *RequestMetadata) SetEtag(v string) { + o.Etag = &v +} +// GetRequestStatus returns the RequestStatus field value if set, zero value otherwise. +func (o *RequestMetadata) GetRequestStatus() RequestStatus { + if o == nil || IsNil(o.RequestStatus) { + var ret RequestStatus + return ret + } + return *o.RequestStatus } -// GetRequestStatusOk returns a tuple with the RequestStatus field value +// GetRequestStatusOk returns a tuple with the RequestStatus 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 *RequestMetadata) GetRequestStatusOk() (*RequestStatus, bool) { - if o == nil { + if o == nil || IsNil(o.RequestStatus) { return nil, false } - return o.RequestStatus, true } -// SetRequestStatus sets field value -func (o *RequestMetadata) SetRequestStatus(v RequestStatus) { - - o.RequestStatus = &v - -} - // HasRequestStatus returns a boolean if a field has been set. func (o *RequestMetadata) HasRequestStatus() bool { - if o != nil && o.RequestStatus != nil { + if o != nil && !IsNil(o.RequestStatus) { return true } return false } +// SetRequestStatus gets a reference to the given RequestStatus and assigns it to the RequestStatus field. +func (o *RequestMetadata) SetRequestStatus(v RequestStatus) { + o.RequestStatus = &v +} + func (o RequestMetadata) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o RequestMetadata) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.CreatedDate != nil { + if !IsNil(o.CreatedDate) { toSerialize["createdDate"] = o.CreatedDate } - - if o.CreatedBy != nil { + if !IsNil(o.CreatedBy) { toSerialize["createdBy"] = o.CreatedBy } - - if o.Etag != nil { + if !IsNil(o.Etag) { toSerialize["etag"] = o.Etag } - - if o.RequestStatus != nil { + if !IsNil(o.RequestStatus) { toSerialize["requestStatus"] = o.RequestStatus } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableRequestMetadata struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_request_properties.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_request_properties.go similarity index 66% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_request_properties.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_request_properties.go index 2235ce0bd..ec8975c41 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_request_properties.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_request_properties.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the RequestProperties type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &RequestProperties{} + // RequestProperties struct for RequestProperties type RequestProperties struct { Method *string `json:"method,omitempty"` @@ -40,177 +43,157 @@ func NewRequestPropertiesWithDefaults() *RequestProperties { return &this } -// GetMethod returns the Method field value -// If the value is explicit nil, nil is returned -func (o *RequestProperties) GetMethod() *string { - if o == nil { - return nil +// GetMethod returns the Method field value if set, zero value otherwise. +func (o *RequestProperties) GetMethod() string { + if o == nil || IsNil(o.Method) { + var ret string + return ret } - - return o.Method - + return *o.Method } -// GetMethodOk returns a tuple with the Method field value +// GetMethodOk returns a tuple with the Method 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 *RequestProperties) GetMethodOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Method) { return nil, false } - return o.Method, true } -// SetMethod sets field value -func (o *RequestProperties) SetMethod(v string) { - - o.Method = &v - -} - // HasMethod returns a boolean if a field has been set. func (o *RequestProperties) HasMethod() bool { - if o != nil && o.Method != nil { + if o != nil && !IsNil(o.Method) { return true } return false } -// GetHeaders returns the Headers field value -// If the value is explicit nil, nil is returned -func (o *RequestProperties) GetHeaders() *map[string]string { - if o == nil { - return nil - } - - return o.Headers +// SetMethod gets a reference to the given string and assigns it to the Method field. +func (o *RequestProperties) SetMethod(v string) { + o.Method = &v +} +// GetHeaders returns the Headers field value if set, zero value otherwise. +func (o *RequestProperties) GetHeaders() map[string]string { + if o == nil || IsNil(o.Headers) { + var ret map[string]string + return ret + } + return *o.Headers } -// GetHeadersOk returns a tuple with the Headers field value +// GetHeadersOk returns a tuple with the Headers 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 *RequestProperties) GetHeadersOk() (*map[string]string, bool) { - if o == nil { + if o == nil || IsNil(o.Headers) { return nil, false } - return o.Headers, true } -// SetHeaders sets field value -func (o *RequestProperties) SetHeaders(v map[string]string) { - - o.Headers = &v - -} - // HasHeaders returns a boolean if a field has been set. func (o *RequestProperties) HasHeaders() bool { - if o != nil && o.Headers != nil { + if o != nil && !IsNil(o.Headers) { return true } return false } -// GetBody returns the Body field value -// If the value is explicit nil, nil is returned -func (o *RequestProperties) GetBody() *string { - if o == nil { - return nil - } - - return o.Body +// SetHeaders gets a reference to the given map[string]string and assigns it to the Headers field. +func (o *RequestProperties) SetHeaders(v map[string]string) { + o.Headers = &v +} +// GetBody returns the Body field value if set, zero value otherwise. +func (o *RequestProperties) 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 +// GetBodyOk returns a tuple with the Body 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 *RequestProperties) GetBodyOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Body) { return nil, false } - return o.Body, true } -// SetBody sets field value -func (o *RequestProperties) SetBody(v string) { - - o.Body = &v - -} - // HasBody returns a boolean if a field has been set. func (o *RequestProperties) HasBody() bool { - if o != nil && o.Body != nil { + if o != nil && !IsNil(o.Body) { return true } return false } -// GetUrl returns the Url field value -// If the value is explicit nil, nil is returned -func (o *RequestProperties) GetUrl() *string { - if o == nil { - return nil - } - - return o.Url +// SetBody gets a reference to the given string and assigns it to the Body field. +func (o *RequestProperties) SetBody(v string) { + o.Body = &v +} +// GetUrl returns the Url field value if set, zero value otherwise. +func (o *RequestProperties) GetUrl() string { + if o == nil || IsNil(o.Url) { + var ret string + return ret + } + return *o.Url } -// GetUrlOk returns a tuple with the Url field value +// GetUrlOk returns a tuple with the Url 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 *RequestProperties) GetUrlOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Url) { return nil, false } - return o.Url, true } -// SetUrl sets field value -func (o *RequestProperties) SetUrl(v string) { - - o.Url = &v - -} - // HasUrl returns a boolean if a field has been set. func (o *RequestProperties) HasUrl() bool { - if o != nil && o.Url != nil { + if o != nil && !IsNil(o.Url) { return true } return false } +// SetUrl gets a reference to the given string and assigns it to the Url field. +func (o *RequestProperties) SetUrl(v string) { + o.Url = &v +} + func (o RequestProperties) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o RequestProperties) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Method != nil { + if !IsNil(o.Method) { toSerialize["method"] = o.Method } - - if o.Headers != nil { + if !IsNil(o.Headers) { toSerialize["headers"] = o.Headers } - - if o.Body != nil { + if !IsNil(o.Body) { toSerialize["body"] = o.Body } - - if o.Url != nil { + if !IsNil(o.Url) { toSerialize["url"] = o.Url } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableRequestProperties struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_request_status.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_request_status.go similarity index 66% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_request_status.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_request_status.go index 5c920eea2..02c0e163f 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_request_status.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_request_status.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the RequestStatus type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &RequestStatus{} + // RequestStatus struct for RequestStatus type RequestStatus struct { // The resource's unique identifier. @@ -43,177 +46,157 @@ func NewRequestStatusWithDefaults() *RequestStatus { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *RequestStatus) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *RequestStatus) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *RequestStatus) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *RequestStatus) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *RequestStatus) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *RequestStatus) GetType() *Type { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *RequestStatus) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *RequestStatus) GetType() Type { + if o == nil || IsNil(o.Type) { + var ret Type + return ret + } + return *o.Type } -// GetTypeOk returns a tuple with the Type field value +// GetTypeOk returns a tuple with the Type 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 *RequestStatus) GetTypeOk() (*Type, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *RequestStatus) SetType(v Type) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *RequestStatus) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *RequestStatus) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given Type and assigns it to the Type field. +func (o *RequestStatus) SetType(v Type) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *RequestStatus) 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 +// GetHrefOk returns a tuple with the Href 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 *RequestStatus) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *RequestStatus) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *RequestStatus) HasHref() bool { - if o != nil && o.Href != nil { + if o != nil && !IsNil(o.Href) { return true } return false } -// GetMetadata returns the Metadata field value -// If the value is explicit nil, nil is returned -func (o *RequestStatus) GetMetadata() *RequestStatusMetadata { - if o == nil { - return nil - } - - return o.Metadata +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *RequestStatus) SetHref(v string) { + o.Href = &v +} +// GetMetadata returns the Metadata field value if set, zero value otherwise. +func (o *RequestStatus) GetMetadata() RequestStatusMetadata { + if o == nil || IsNil(o.Metadata) { + var ret RequestStatusMetadata + return ret + } + return *o.Metadata } -// GetMetadataOk returns a tuple with the Metadata field value +// GetMetadataOk returns a tuple with the Metadata 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 *RequestStatus) GetMetadataOk() (*RequestStatusMetadata, bool) { - if o == nil { + if o == nil || IsNil(o.Metadata) { return nil, false } - return o.Metadata, true } -// SetMetadata sets field value -func (o *RequestStatus) SetMetadata(v RequestStatusMetadata) { - - o.Metadata = &v - -} - // HasMetadata returns a boolean if a field has been set. func (o *RequestStatus) HasMetadata() bool { - if o != nil && o.Metadata != nil { + if o != nil && !IsNil(o.Metadata) { return true } return false } +// SetMetadata gets a reference to the given RequestStatusMetadata and assigns it to the Metadata field. +func (o *RequestStatus) SetMetadata(v RequestStatusMetadata) { + o.Metadata = &v +} + func (o RequestStatus) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o RequestStatus) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Metadata != nil { + if !IsNil(o.Metadata) { toSerialize["metadata"] = o.Metadata } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableRequestStatus struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_request_status_metadata.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_request_status_metadata.go similarity index 64% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_request_status_metadata.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_request_status_metadata.go index 15e4f9a62..9f9516120 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_request_status_metadata.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_request_status_metadata.go @@ -14,13 +14,16 @@ import ( "encoding/json" ) +// checks if the RequestStatusMetadata type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &RequestStatusMetadata{} + // RequestStatusMetadata struct for RequestStatusMetadata type RequestStatusMetadata struct { Status *string `json:"status,omitempty"` Message *string `json:"message,omitempty"` // Resource's Entity Tag as defined in http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.11 Entity Tag is also added as an 'ETag response header to requests which don't use 'depth' parameter. - Etag *string `json:"etag,omitempty"` - Targets *[]RequestTarget `json:"targets,omitempty"` + Etag *string `json:"etag,omitempty"` + Targets []RequestTarget `json:"targets,omitempty"` } // NewRequestStatusMetadata instantiates a new RequestStatusMetadata object @@ -41,177 +44,157 @@ func NewRequestStatusMetadataWithDefaults() *RequestStatusMetadata { return &this } -// GetStatus returns the Status field value -// If the value is explicit nil, nil is returned -func (o *RequestStatusMetadata) GetStatus() *string { - if o == nil { - return nil +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *RequestStatusMetadata) GetStatus() string { + if o == nil || IsNil(o.Status) { + var ret string + return ret } - - return o.Status - + return *o.Status } -// GetStatusOk returns a tuple with the Status field value +// GetStatusOk returns a tuple with the Status 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 *RequestStatusMetadata) GetStatusOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Status) { return nil, false } - return o.Status, true } -// SetStatus sets field value -func (o *RequestStatusMetadata) SetStatus(v string) { - - o.Status = &v - -} - // HasStatus returns a boolean if a field has been set. func (o *RequestStatusMetadata) HasStatus() bool { - if o != nil && o.Status != nil { + if o != nil && !IsNil(o.Status) { return true } return false } -// GetMessage returns the Message field value -// If the value is explicit nil, nil is returned -func (o *RequestStatusMetadata) GetMessage() *string { - if o == nil { - return nil - } - - return o.Message +// SetStatus gets a reference to the given string and assigns it to the Status field. +func (o *RequestStatusMetadata) SetStatus(v string) { + o.Status = &v +} +// GetMessage returns the Message field value if set, zero value otherwise. +func (o *RequestStatusMetadata) 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 +// GetMessageOk returns a tuple with the Message 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 *RequestStatusMetadata) GetMessageOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Message) { return nil, false } - return o.Message, true } -// SetMessage sets field value -func (o *RequestStatusMetadata) SetMessage(v string) { - - o.Message = &v - -} - // HasMessage returns a boolean if a field has been set. func (o *RequestStatusMetadata) HasMessage() bool { - if o != nil && o.Message != nil { + if o != nil && !IsNil(o.Message) { return true } return false } -// GetEtag returns the Etag field value -// If the value is explicit nil, nil is returned -func (o *RequestStatusMetadata) GetEtag() *string { - if o == nil { - return nil - } - - return o.Etag +// SetMessage gets a reference to the given string and assigns it to the Message field. +func (o *RequestStatusMetadata) SetMessage(v string) { + o.Message = &v +} +// GetEtag returns the Etag field value if set, zero value otherwise. +func (o *RequestStatusMetadata) GetEtag() string { + if o == nil || IsNil(o.Etag) { + var ret string + return ret + } + return *o.Etag } -// GetEtagOk returns a tuple with the Etag field value +// GetEtagOk returns a tuple with the Etag 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 *RequestStatusMetadata) GetEtagOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Etag) { return nil, false } - return o.Etag, true } -// SetEtag sets field value -func (o *RequestStatusMetadata) SetEtag(v string) { - - o.Etag = &v - -} - // HasEtag returns a boolean if a field has been set. func (o *RequestStatusMetadata) HasEtag() bool { - if o != nil && o.Etag != nil { + if o != nil && !IsNil(o.Etag) { return true } return false } -// GetTargets returns the Targets field value -// If the value is explicit nil, nil is returned -func (o *RequestStatusMetadata) GetTargets() *[]RequestTarget { - if o == nil { - return nil - } +// SetEtag gets a reference to the given string and assigns it to the Etag field. +func (o *RequestStatusMetadata) SetEtag(v string) { + o.Etag = &v +} +// GetTargets returns the Targets field value if set, zero value otherwise. +func (o *RequestStatusMetadata) GetTargets() []RequestTarget { + if o == nil || IsNil(o.Targets) { + var ret []RequestTarget + return ret + } return o.Targets - } -// GetTargetsOk returns a tuple with the Targets field value +// GetTargetsOk returns a tuple with the Targets 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 *RequestStatusMetadata) GetTargetsOk() (*[]RequestTarget, bool) { - if o == nil { +func (o *RequestStatusMetadata) GetTargetsOk() ([]RequestTarget, bool) { + if o == nil || IsNil(o.Targets) { return nil, false } - return o.Targets, true } -// SetTargets sets field value -func (o *RequestStatusMetadata) SetTargets(v []RequestTarget) { - - o.Targets = &v - -} - // HasTargets returns a boolean if a field has been set. func (o *RequestStatusMetadata) HasTargets() bool { - if o != nil && o.Targets != nil { + if o != nil && !IsNil(o.Targets) { return true } return false } +// SetTargets gets a reference to the given []RequestTarget and assigns it to the Targets field. +func (o *RequestStatusMetadata) SetTargets(v []RequestTarget) { + o.Targets = v +} + func (o RequestStatusMetadata) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o RequestStatusMetadata) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Status != nil { + if !IsNil(o.Status) { toSerialize["status"] = o.Status } - - if o.Message != nil { + if !IsNil(o.Message) { toSerialize["message"] = o.Message } - - if o.Etag != nil { + if !IsNil(o.Etag) { toSerialize["etag"] = o.Etag } - - if o.Targets != nil { + if !IsNil(o.Targets) { toSerialize["targets"] = o.Targets } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableRequestStatusMetadata struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_request_target.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_request_target.go similarity index 71% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_request_target.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_request_target.go index 87a3f73f7..842aff875 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_request_target.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_request_target.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the RequestTarget type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &RequestTarget{} + // RequestTarget struct for RequestTarget type RequestTarget struct { Target *ResourceReference `json:"target,omitempty"` @@ -38,93 +41,87 @@ func NewRequestTargetWithDefaults() *RequestTarget { return &this } -// GetTarget returns the Target field value -// If the value is explicit nil, nil is returned -func (o *RequestTarget) GetTarget() *ResourceReference { - if o == nil { - return nil +// GetTarget returns the Target field value if set, zero value otherwise. +func (o *RequestTarget) GetTarget() ResourceReference { + if o == nil || IsNil(o.Target) { + var ret ResourceReference + return ret } - - return o.Target - + return *o.Target } -// GetTargetOk returns a tuple with the Target field value +// GetTargetOk returns a tuple with the Target 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 *RequestTarget) GetTargetOk() (*ResourceReference, bool) { - if o == nil { + if o == nil || IsNil(o.Target) { return nil, false } - return o.Target, true } -// SetTarget sets field value -func (o *RequestTarget) SetTarget(v ResourceReference) { - - o.Target = &v - -} - // HasTarget returns a boolean if a field has been set. func (o *RequestTarget) HasTarget() bool { - if o != nil && o.Target != nil { + if o != nil && !IsNil(o.Target) { return true } return false } -// GetStatus returns the Status field value -// If the value is explicit nil, nil is returned -func (o *RequestTarget) GetStatus() *string { - if o == nil { - return nil - } - - return o.Status +// SetTarget gets a reference to the given ResourceReference and assigns it to the Target field. +func (o *RequestTarget) SetTarget(v ResourceReference) { + o.Target = &v +} +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *RequestTarget) 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 +// GetStatusOk returns a tuple with the Status 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 *RequestTarget) GetStatusOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Status) { return nil, false } - return o.Status, true } -// SetStatus sets field value -func (o *RequestTarget) SetStatus(v string) { - - o.Status = &v - -} - // HasStatus returns a boolean if a field has been set. func (o *RequestTarget) HasStatus() bool { - if o != nil && o.Status != nil { + 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 *RequestTarget) SetStatus(v string) { + o.Status = &v +} + func (o RequestTarget) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o RequestTarget) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Target != nil { + if !IsNil(o.Target) { toSerialize["target"] = o.Target } - - if o.Status != nil { + if !IsNil(o.Status) { toSerialize["status"] = o.Status } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableRequestTarget struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_requests.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_requests.go similarity index 61% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_requests.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_requests.go index a92f1509f..826503d61 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_requests.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_requests.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the Requests type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Requests{} + // Requests struct for Requests type Requests struct { // The resource's unique identifier. @@ -23,12 +26,12 @@ type Requests struct { // URL to the object representation (absolute path). Href *string `json:"href,omitempty"` // Array of items in the collection. - Items *[]Request `json:"items,omitempty"` + Items []Request `json:"items,omitempty"` // The offset, specified in the request (if not is specified, 0 is used by default). - Offset *float32 `json:"offset"` + Offset float32 `json:"offset"` // The limit, specified in the request (if not specified, the endpoint's default pagination limit is used). - Limit *float32 `json:"limit"` - Links *PaginationLinks `json:"_links"` + Limit float32 `json:"limit"` + Links PaginationLinks `json:"_links"` } // NewRequests instantiates a new Requests object @@ -38,9 +41,9 @@ type Requests struct { func NewRequests(offset float32, limit float32, links PaginationLinks) *Requests { this := Requests{} - this.Offset = &offset - this.Limit = &limit - this.Links = &links + this.Offset = offset + this.Limit = limit + this.Links = links return &this } @@ -53,303 +56,232 @@ func NewRequestsWithDefaults() *Requests { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *Requests) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *Requests) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *Requests) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *Requests) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *Requests) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *Requests) GetType() *Type { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Requests) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *Requests) GetType() Type { + if o == nil || IsNil(o.Type) { + var ret Type + return ret + } + return *o.Type } -// GetTypeOk returns a tuple with the Type field value +// GetTypeOk returns a tuple with the Type 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 *Requests) GetTypeOk() (*Type, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *Requests) SetType(v Type) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *Requests) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *Requests) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given Type and assigns it to the Type field. +func (o *Requests) SetType(v Type) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *Requests) 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 +// GetHrefOk returns a tuple with the Href 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 *Requests) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *Requests) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *Requests) HasHref() bool { - if o != nil && o.Href != nil { + if o != nil && !IsNil(o.Href) { return true } return false } -// GetItems returns the Items field value -// If the value is explicit nil, nil is returned -func (o *Requests) GetItems() *[]Request { - if o == nil { - return nil - } +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *Requests) SetHref(v string) { + o.Href = &v +} +// GetItems returns the Items field value if set, zero value otherwise. +func (o *Requests) GetItems() []Request { + if o == nil || IsNil(o.Items) { + var ret []Request + return ret + } return o.Items - } -// GetItemsOk returns a tuple with the Items field value +// GetItemsOk returns a tuple with the Items 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 *Requests) GetItemsOk() (*[]Request, bool) { - if o == nil { +func (o *Requests) GetItemsOk() ([]Request, bool) { + if o == nil || IsNil(o.Items) { return nil, false } - return o.Items, true } -// SetItems sets field value -func (o *Requests) SetItems(v []Request) { - - o.Items = &v - -} - // HasItems returns a boolean if a field has been set. func (o *Requests) HasItems() bool { - if o != nil && o.Items != nil { + if o != nil && !IsNil(o.Items) { return true } return false } +// SetItems gets a reference to the given []Request and assigns it to the Items field. +func (o *Requests) SetItems(v []Request) { + o.Items = v +} + // GetOffset returns the Offset field value -// If the value is explicit nil, nil is returned -func (o *Requests) GetOffset() *float32 { +func (o *Requests) GetOffset() float32 { if o == nil { - return nil + var ret float32 + return ret } return o.Offset - } // GetOffsetOk returns a tuple with the Offset field value // 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 *Requests) GetOffsetOk() (*float32, bool) { if o == nil { return nil, false } - - return o.Offset, true + return &o.Offset, true } // SetOffset sets field value func (o *Requests) SetOffset(v float32) { - - o.Offset = &v - -} - -// HasOffset returns a boolean if a field has been set. -func (o *Requests) HasOffset() bool { - if o != nil && o.Offset != nil { - return true - } - - return false + o.Offset = v } // GetLimit returns the Limit field value -// If the value is explicit nil, nil is returned -func (o *Requests) GetLimit() *float32 { +func (o *Requests) GetLimit() float32 { if o == nil { - return nil + var ret float32 + return ret } return o.Limit - } // GetLimitOk returns a tuple with the Limit field value // 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 *Requests) GetLimitOk() (*float32, bool) { if o == nil { return nil, false } - - return o.Limit, true + return &o.Limit, true } // SetLimit sets field value func (o *Requests) SetLimit(v float32) { - - o.Limit = &v - -} - -// HasLimit returns a boolean if a field has been set. -func (o *Requests) HasLimit() bool { - if o != nil && o.Limit != nil { - return true - } - - return false + o.Limit = v } // GetLinks returns the Links field value -// If the value is explicit nil, nil is returned -func (o *Requests) GetLinks() *PaginationLinks { +func (o *Requests) GetLinks() PaginationLinks { if o == nil { - return nil + var ret PaginationLinks + return ret } return o.Links - } // GetLinksOk returns a tuple with the Links field value // 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 *Requests) GetLinksOk() (*PaginationLinks, bool) { if o == nil { return nil, false } - - return o.Links, true + return &o.Links, true } // SetLinks sets field value func (o *Requests) SetLinks(v PaginationLinks) { - - o.Links = &v - + o.Links = v } -// HasLinks returns a boolean if a field has been set. -func (o *Requests) HasLinks() bool { - if o != nil && o.Links != nil { - return true +func (o Requests) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } - - return false + return json.Marshal(toSerialize) } -func (o Requests) MarshalJSON() ([]byte, error) { +func (o Requests) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Items != nil { + if !IsNil(o.Items) { toSerialize["items"] = o.Items } - - if o.Offset != nil { - toSerialize["offset"] = o.Offset - } - - if o.Limit != nil { - toSerialize["limit"] = o.Limit - } - - if o.Links != nil { - toSerialize["_links"] = o.Links - } - - return json.Marshal(toSerialize) + toSerialize["offset"] = o.Offset + toSerialize["limit"] = o.Limit + toSerialize["_links"] = o.Links + return toSerialize, nil } type NullableRequests struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_resource.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_resource.go similarity index 62% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_resource.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_resource.go index 21bb51fce..f904f0146 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_resource.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_resource.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the Resource type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Resource{} + // Resource datacenter resource representation type Resource struct { // The resource's unique identifier. @@ -45,261 +48,227 @@ func NewResourceWithDefaults() *Resource { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *Resource) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *Resource) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *Resource) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *Resource) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *Resource) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *Resource) GetType() *Type { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Resource) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *Resource) GetType() Type { + if o == nil || IsNil(o.Type) { + var ret Type + return ret + } + return *o.Type } -// GetTypeOk returns a tuple with the Type field value +// GetTypeOk returns a tuple with the Type 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 *Resource) GetTypeOk() (*Type, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *Resource) SetType(v Type) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *Resource) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *Resource) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given Type and assigns it to the Type field. +func (o *Resource) SetType(v Type) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *Resource) 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 +// GetHrefOk returns a tuple with the Href 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 *Resource) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *Resource) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *Resource) HasHref() bool { - if o != nil && o.Href != nil { + if o != nil && !IsNil(o.Href) { return true } return false } -// GetMetadata returns the Metadata field value -// If the value is explicit nil, nil is returned -func (o *Resource) GetMetadata() *DatacenterElementMetadata { - if o == nil { - return nil - } - - return o.Metadata +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *Resource) SetHref(v string) { + o.Href = &v +} +// GetMetadata returns the Metadata field value if set, zero value otherwise. +func (o *Resource) GetMetadata() DatacenterElementMetadata { + if o == nil || IsNil(o.Metadata) { + var ret DatacenterElementMetadata + return ret + } + return *o.Metadata } -// GetMetadataOk returns a tuple with the Metadata field value +// GetMetadataOk returns a tuple with the Metadata 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 *Resource) GetMetadataOk() (*DatacenterElementMetadata, bool) { - if o == nil { + if o == nil || IsNil(o.Metadata) { return nil, false } - return o.Metadata, true } -// SetMetadata sets field value -func (o *Resource) SetMetadata(v DatacenterElementMetadata) { - - o.Metadata = &v - -} - // HasMetadata returns a boolean if a field has been set. func (o *Resource) HasMetadata() bool { - if o != nil && o.Metadata != nil { + if o != nil && !IsNil(o.Metadata) { return true } return false } -// GetProperties returns the Properties field value -// If the value is explicit nil, nil is returned -func (o *Resource) GetProperties() *ResourceProperties { - if o == nil { - return nil - } - - return o.Properties +// SetMetadata gets a reference to the given DatacenterElementMetadata and assigns it to the Metadata field. +func (o *Resource) SetMetadata(v DatacenterElementMetadata) { + o.Metadata = &v +} +// GetProperties returns the Properties field value if set, zero value otherwise. +func (o *Resource) GetProperties() ResourceProperties { + if o == nil || IsNil(o.Properties) { + var ret ResourceProperties + return ret + } + return *o.Properties } -// GetPropertiesOk returns a tuple with the Properties field value +// GetPropertiesOk returns a tuple with the Properties 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 *Resource) GetPropertiesOk() (*ResourceProperties, bool) { - if o == nil { + if o == nil || IsNil(o.Properties) { return nil, false } - return o.Properties, true } -// SetProperties sets field value -func (o *Resource) SetProperties(v ResourceProperties) { - - o.Properties = &v - -} - // HasProperties returns a boolean if a field has been set. func (o *Resource) HasProperties() bool { - if o != nil && o.Properties != nil { + if o != nil && !IsNil(o.Properties) { return true } return false } -// GetEntities returns the Entities field value -// If the value is explicit nil, nil is returned -func (o *Resource) GetEntities() *ResourceEntities { - if o == nil { - return nil - } - - return o.Entities +// SetProperties gets a reference to the given ResourceProperties and assigns it to the Properties field. +func (o *Resource) SetProperties(v ResourceProperties) { + o.Properties = &v +} +// GetEntities returns the Entities field value if set, zero value otherwise. +func (o *Resource) GetEntities() ResourceEntities { + if o == nil || IsNil(o.Entities) { + var ret ResourceEntities + return ret + } + return *o.Entities } -// GetEntitiesOk returns a tuple with the Entities field value +// GetEntitiesOk returns a tuple with the Entities 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 *Resource) GetEntitiesOk() (*ResourceEntities, bool) { - if o == nil { + if o == nil || IsNil(o.Entities) { return nil, false } - return o.Entities, true } -// SetEntities sets field value -func (o *Resource) SetEntities(v ResourceEntities) { - - o.Entities = &v - -} - // HasEntities returns a boolean if a field has been set. func (o *Resource) HasEntities() bool { - if o != nil && o.Entities != nil { + if o != nil && !IsNil(o.Entities) { return true } return false } +// SetEntities gets a reference to the given ResourceEntities and assigns it to the Entities field. +func (o *Resource) SetEntities(v ResourceEntities) { + o.Entities = &v +} + func (o Resource) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Resource) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Metadata != nil { + if !IsNil(o.Metadata) { toSerialize["metadata"] = o.Metadata } - - if o.Properties != nil { + if !IsNil(o.Properties) { toSerialize["properties"] = o.Properties } - - if o.Entities != nil { + if !IsNil(o.Entities) { toSerialize["entities"] = o.Entities } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableResource struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_resource_entities.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_resource_entities.go similarity index 77% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_resource_entities.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_resource_entities.go index dd3a7472a..bbb4b99c6 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_resource_entities.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_resource_entities.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the ResourceEntities type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ResourceEntities{} + // ResourceEntities struct for ResourceEntities type ResourceEntities struct { Groups *ResourceGroups `json:"groups,omitempty"` @@ -37,51 +40,52 @@ func NewResourceEntitiesWithDefaults() *ResourceEntities { return &this } -// GetGroups returns the Groups field value -// If the value is explicit nil, nil is returned -func (o *ResourceEntities) GetGroups() *ResourceGroups { - if o == nil { - return nil +// GetGroups returns the Groups field value if set, zero value otherwise. +func (o *ResourceEntities) GetGroups() ResourceGroups { + if o == nil || IsNil(o.Groups) { + var ret ResourceGroups + return ret } - - return o.Groups - + return *o.Groups } -// GetGroupsOk returns a tuple with the Groups field value +// GetGroupsOk returns a tuple with the Groups 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 *ResourceEntities) GetGroupsOk() (*ResourceGroups, bool) { - if o == nil { + if o == nil || IsNil(o.Groups) { return nil, false } - return o.Groups, true } -// SetGroups sets field value -func (o *ResourceEntities) SetGroups(v ResourceGroups) { - - o.Groups = &v - -} - // HasGroups returns a boolean if a field has been set. func (o *ResourceEntities) HasGroups() bool { - if o != nil && o.Groups != nil { + if o != nil && !IsNil(o.Groups) { return true } return false } +// SetGroups gets a reference to the given ResourceGroups and assigns it to the Groups field. +func (o *ResourceEntities) SetGroups(v ResourceGroups) { + o.Groups = &v +} + func (o ResourceEntities) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ResourceEntities) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Groups != nil { + if !IsNil(o.Groups) { toSerialize["groups"] = o.Groups } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableResourceEntities struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_resource_groups.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_resource_groups.go similarity index 65% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_resource_groups.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_resource_groups.go index e56184795..ddd8047d3 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_resource_groups.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_resource_groups.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the ResourceGroups type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ResourceGroups{} + // ResourceGroups Resources assigned to this group. type ResourceGroups struct { // The resource's unique identifier. @@ -23,7 +26,7 @@ type ResourceGroups struct { // URL to the object representation (absolute path). Href *string `json:"href,omitempty"` // Array of items in the collection. - Items *[]Resource `json:"items,omitempty"` + Items []Resource `json:"items,omitempty"` } // NewResourceGroups instantiates a new ResourceGroups object @@ -44,177 +47,157 @@ func NewResourceGroupsWithDefaults() *ResourceGroups { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *ResourceGroups) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *ResourceGroups) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *ResourceGroups) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *ResourceGroups) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *ResourceGroups) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *ResourceGroups) GetType() *Type { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *ResourceGroups) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *ResourceGroups) GetType() Type { + if o == nil || IsNil(o.Type) { + var ret Type + return ret + } + return *o.Type } -// GetTypeOk returns a tuple with the Type field value +// GetTypeOk returns a tuple with the Type 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 *ResourceGroups) GetTypeOk() (*Type, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *ResourceGroups) SetType(v Type) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *ResourceGroups) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *ResourceGroups) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given Type and assigns it to the Type field. +func (o *ResourceGroups) SetType(v Type) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *ResourceGroups) 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 +// GetHrefOk returns a tuple with the Href 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 *ResourceGroups) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *ResourceGroups) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *ResourceGroups) HasHref() bool { - if o != nil && o.Href != nil { + if o != nil && !IsNil(o.Href) { return true } return false } -// GetItems returns the Items field value -// If the value is explicit nil, nil is returned -func (o *ResourceGroups) GetItems() *[]Resource { - if o == nil { - return nil - } +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *ResourceGroups) SetHref(v string) { + o.Href = &v +} +// GetItems returns the Items field value if set, zero value otherwise. +func (o *ResourceGroups) GetItems() []Resource { + if o == nil || IsNil(o.Items) { + var ret []Resource + return ret + } return o.Items - } -// GetItemsOk returns a tuple with the Items field value +// GetItemsOk returns a tuple with the Items 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 *ResourceGroups) GetItemsOk() (*[]Resource, bool) { - if o == nil { +func (o *ResourceGroups) GetItemsOk() ([]Resource, bool) { + if o == nil || IsNil(o.Items) { return nil, false } - return o.Items, true } -// SetItems sets field value -func (o *ResourceGroups) SetItems(v []Resource) { - - o.Items = &v - -} - // HasItems returns a boolean if a field has been set. func (o *ResourceGroups) HasItems() bool { - if o != nil && o.Items != nil { + if o != nil && !IsNil(o.Items) { return true } return false } +// SetItems gets a reference to the given []Resource and assigns it to the Items field. +func (o *ResourceGroups) SetItems(v []Resource) { + o.Items = v +} + func (o ResourceGroups) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ResourceGroups) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Items != nil { + if !IsNil(o.Items) { toSerialize["items"] = o.Items } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableResourceGroups struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_resource_limits.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_resource_limits.go new file mode 100644 index 000000000..6b8b3a06b --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_resource_limits.go @@ -0,0 +1,790 @@ +/* + * CLOUD API + * + * IONOS Enterprise-grade Infrastructure as a Service (IaaS) solutions can be managed through the Cloud API, in addition or as an alternative to the \"Data Center Designer\" (DCD) browser-based tool. Both methods employ consistent concepts and features, deliver similar power and flexibility, and can be used to perform a multitude of management tasks, including adding servers, volumes, configuring networks, and so on. + * + * API version: 6.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + "encoding/json" +) + +// checks if the ResourceLimits type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ResourceLimits{} + +// ResourceLimits struct for ResourceLimits +type ResourceLimits struct { + // The maximum number of CPU cores per server. + CoresPerServer int32 `json:"coresPerServer"` + // The maximum number of CPU cores per contract. + CoresPerContract int32 `json:"coresPerContract"` + // The number of CPU cores provisioned. + CoresProvisioned int32 `json:"coresProvisioned"` + // The maximum amount of RAM (in MB) that can be provisioned for a particular server under this contract. + RamPerServer int32 `json:"ramPerServer"` + // The maximum amount of RAM (in MB) that can be provisioned under this contract. + RamPerContract int32 `json:"ramPerContract"` + // The amount of RAM (in MB) provisioned under this contract. + RamProvisioned int32 `json:"ramProvisioned"` + // The maximum size (in MB) of an idividual hard disk volume. + HddLimitPerVolume int64 `json:"hddLimitPerVolume"` + // The maximum amount of disk space (in MB) that can be provided under this contract. + HddLimitPerContract int64 `json:"hddLimitPerContract"` + // The amount of hard disk space (in MB) that is currently provisioned. + HddVolumeProvisioned int64 `json:"hddVolumeProvisioned"` + // The maximum size (in MB) of an individual solid state disk volume. + SsdLimitPerVolume int64 `json:"ssdLimitPerVolume"` + // The maximum amount of solid state disk space (in MB) that can be provisioned under this contract. + SsdLimitPerContract int64 `json:"ssdLimitPerContract"` + // The amount of solid state disk space (in MB) that is currently provisioned. + SsdVolumeProvisioned int64 `json:"ssdVolumeProvisioned"` + // The amount of DAS disk space (in MB) in a Cube server that is currently provisioned. + DasVolumeProvisioned int64 `json:"dasVolumeProvisioned"` + // The maximum number of static public IP addresses that can be reserved by this customer across contracts. + ReservableIps int32 `json:"reservableIps"` + // The maximum number of static public IP addresses that can be reserved for this contract. + ReservedIpsOnContract int32 `json:"reservedIpsOnContract"` + // The number of static public IP addresses in use. + ReservedIpsInUse int32 `json:"reservedIpsInUse"` + // The maximum number of Kubernetes clusters that can be created under this contract. + K8sClusterLimitTotal int32 `json:"k8sClusterLimitTotal"` + // The amount of Kubernetes clusters that is currently provisioned. + K8sClustersProvisioned int32 `json:"k8sClustersProvisioned"` + // The NLB total limit. + NlbLimitTotal int32 `json:"nlbLimitTotal"` + // The NLBs provisioned. + NlbProvisioned int32 `json:"nlbProvisioned"` + // The NAT Gateway total limit. + NatGatewayLimitTotal int32 `json:"natGatewayLimitTotal"` + // The NAT Gateways provisioned. + NatGatewayProvisioned int32 `json:"natGatewayProvisioned"` + // The maximum number of security groups per VDC. + SecurityGroupsPerVdc int32 `json:"securityGroupsPerVdc"` + // The maximum number of security groups that can be attached to a NIC or a VM individually. For example, a user can have maximum 10 security groups per NIC and 10 per VM. + SecurityGroupsPerResource int32 `json:"securityGroupsPerResource"` + // The maximum number of rules per security group. + RulesPerSecurityGroup int32 `json:"rulesPerSecurityGroup"` +} + +// NewResourceLimits instantiates a new ResourceLimits 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 NewResourceLimits(coresPerServer int32, coresPerContract int32, coresProvisioned int32, ramPerServer int32, ramPerContract int32, ramProvisioned int32, hddLimitPerVolume int64, hddLimitPerContract int64, hddVolumeProvisioned int64, ssdLimitPerVolume int64, ssdLimitPerContract int64, ssdVolumeProvisioned int64, dasVolumeProvisioned int64, reservableIps int32, reservedIpsOnContract int32, reservedIpsInUse int32, k8sClusterLimitTotal int32, k8sClustersProvisioned int32, nlbLimitTotal int32, nlbProvisioned int32, natGatewayLimitTotal int32, natGatewayProvisioned int32, securityGroupsPerVdc int32, securityGroupsPerResource int32, rulesPerSecurityGroup int32) *ResourceLimits { + this := ResourceLimits{} + + this.CoresPerServer = coresPerServer + this.CoresPerContract = coresPerContract + this.CoresProvisioned = coresProvisioned + this.RamPerServer = ramPerServer + this.RamPerContract = ramPerContract + this.RamProvisioned = ramProvisioned + this.HddLimitPerVolume = hddLimitPerVolume + this.HddLimitPerContract = hddLimitPerContract + this.HddVolumeProvisioned = hddVolumeProvisioned + this.SsdLimitPerVolume = ssdLimitPerVolume + this.SsdLimitPerContract = ssdLimitPerContract + this.SsdVolumeProvisioned = ssdVolumeProvisioned + this.DasVolumeProvisioned = dasVolumeProvisioned + this.ReservableIps = reservableIps + this.ReservedIpsOnContract = reservedIpsOnContract + this.ReservedIpsInUse = reservedIpsInUse + this.K8sClusterLimitTotal = k8sClusterLimitTotal + this.K8sClustersProvisioned = k8sClustersProvisioned + this.NlbLimitTotal = nlbLimitTotal + this.NlbProvisioned = nlbProvisioned + this.NatGatewayLimitTotal = natGatewayLimitTotal + this.NatGatewayProvisioned = natGatewayProvisioned + this.SecurityGroupsPerVdc = securityGroupsPerVdc + this.SecurityGroupsPerResource = securityGroupsPerResource + this.RulesPerSecurityGroup = rulesPerSecurityGroup + + return &this +} + +// NewResourceLimitsWithDefaults instantiates a new ResourceLimits 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 NewResourceLimitsWithDefaults() *ResourceLimits { + this := ResourceLimits{} + return &this +} + +// GetCoresPerServer returns the CoresPerServer field value +func (o *ResourceLimits) GetCoresPerServer() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.CoresPerServer +} + +// GetCoresPerServerOk returns a tuple with the CoresPerServer field value +// and a boolean to check if the value has been set. +func (o *ResourceLimits) GetCoresPerServerOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.CoresPerServer, true +} + +// SetCoresPerServer sets field value +func (o *ResourceLimits) SetCoresPerServer(v int32) { + o.CoresPerServer = v +} + +// GetCoresPerContract returns the CoresPerContract field value +func (o *ResourceLimits) GetCoresPerContract() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.CoresPerContract +} + +// GetCoresPerContractOk returns a tuple with the CoresPerContract field value +// and a boolean to check if the value has been set. +func (o *ResourceLimits) GetCoresPerContractOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.CoresPerContract, true +} + +// SetCoresPerContract sets field value +func (o *ResourceLimits) SetCoresPerContract(v int32) { + o.CoresPerContract = v +} + +// GetCoresProvisioned returns the CoresProvisioned field value +func (o *ResourceLimits) GetCoresProvisioned() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.CoresProvisioned +} + +// GetCoresProvisionedOk returns a tuple with the CoresProvisioned field value +// and a boolean to check if the value has been set. +func (o *ResourceLimits) GetCoresProvisionedOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.CoresProvisioned, true +} + +// SetCoresProvisioned sets field value +func (o *ResourceLimits) SetCoresProvisioned(v int32) { + o.CoresProvisioned = v +} + +// GetRamPerServer returns the RamPerServer field value +func (o *ResourceLimits) GetRamPerServer() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.RamPerServer +} + +// GetRamPerServerOk returns a tuple with the RamPerServer field value +// and a boolean to check if the value has been set. +func (o *ResourceLimits) GetRamPerServerOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.RamPerServer, true +} + +// SetRamPerServer sets field value +func (o *ResourceLimits) SetRamPerServer(v int32) { + o.RamPerServer = v +} + +// GetRamPerContract returns the RamPerContract field value +func (o *ResourceLimits) GetRamPerContract() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.RamPerContract +} + +// GetRamPerContractOk returns a tuple with the RamPerContract field value +// and a boolean to check if the value has been set. +func (o *ResourceLimits) GetRamPerContractOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.RamPerContract, true +} + +// SetRamPerContract sets field value +func (o *ResourceLimits) SetRamPerContract(v int32) { + o.RamPerContract = v +} + +// GetRamProvisioned returns the RamProvisioned field value +func (o *ResourceLimits) GetRamProvisioned() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.RamProvisioned +} + +// GetRamProvisionedOk returns a tuple with the RamProvisioned field value +// and a boolean to check if the value has been set. +func (o *ResourceLimits) GetRamProvisionedOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.RamProvisioned, true +} + +// SetRamProvisioned sets field value +func (o *ResourceLimits) SetRamProvisioned(v int32) { + o.RamProvisioned = v +} + +// GetHddLimitPerVolume returns the HddLimitPerVolume field value +func (o *ResourceLimits) GetHddLimitPerVolume() int64 { + if o == nil { + var ret int64 + return ret + } + + return o.HddLimitPerVolume +} + +// GetHddLimitPerVolumeOk returns a tuple with the HddLimitPerVolume field value +// and a boolean to check if the value has been set. +func (o *ResourceLimits) GetHddLimitPerVolumeOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.HddLimitPerVolume, true +} + +// SetHddLimitPerVolume sets field value +func (o *ResourceLimits) SetHddLimitPerVolume(v int64) { + o.HddLimitPerVolume = v +} + +// GetHddLimitPerContract returns the HddLimitPerContract field value +func (o *ResourceLimits) GetHddLimitPerContract() int64 { + if o == nil { + var ret int64 + return ret + } + + return o.HddLimitPerContract +} + +// GetHddLimitPerContractOk returns a tuple with the HddLimitPerContract field value +// and a boolean to check if the value has been set. +func (o *ResourceLimits) GetHddLimitPerContractOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.HddLimitPerContract, true +} + +// SetHddLimitPerContract sets field value +func (o *ResourceLimits) SetHddLimitPerContract(v int64) { + o.HddLimitPerContract = v +} + +// GetHddVolumeProvisioned returns the HddVolumeProvisioned field value +func (o *ResourceLimits) GetHddVolumeProvisioned() int64 { + if o == nil { + var ret int64 + return ret + } + + return o.HddVolumeProvisioned +} + +// GetHddVolumeProvisionedOk returns a tuple with the HddVolumeProvisioned field value +// and a boolean to check if the value has been set. +func (o *ResourceLimits) GetHddVolumeProvisionedOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.HddVolumeProvisioned, true +} + +// SetHddVolumeProvisioned sets field value +func (o *ResourceLimits) SetHddVolumeProvisioned(v int64) { + o.HddVolumeProvisioned = v +} + +// GetSsdLimitPerVolume returns the SsdLimitPerVolume field value +func (o *ResourceLimits) GetSsdLimitPerVolume() int64 { + if o == nil { + var ret int64 + return ret + } + + return o.SsdLimitPerVolume +} + +// GetSsdLimitPerVolumeOk returns a tuple with the SsdLimitPerVolume field value +// and a boolean to check if the value has been set. +func (o *ResourceLimits) GetSsdLimitPerVolumeOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.SsdLimitPerVolume, true +} + +// SetSsdLimitPerVolume sets field value +func (o *ResourceLimits) SetSsdLimitPerVolume(v int64) { + o.SsdLimitPerVolume = v +} + +// GetSsdLimitPerContract returns the SsdLimitPerContract field value +func (o *ResourceLimits) GetSsdLimitPerContract() int64 { + if o == nil { + var ret int64 + return ret + } + + return o.SsdLimitPerContract +} + +// GetSsdLimitPerContractOk returns a tuple with the SsdLimitPerContract field value +// and a boolean to check if the value has been set. +func (o *ResourceLimits) GetSsdLimitPerContractOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.SsdLimitPerContract, true +} + +// SetSsdLimitPerContract sets field value +func (o *ResourceLimits) SetSsdLimitPerContract(v int64) { + o.SsdLimitPerContract = v +} + +// GetSsdVolumeProvisioned returns the SsdVolumeProvisioned field value +func (o *ResourceLimits) GetSsdVolumeProvisioned() int64 { + if o == nil { + var ret int64 + return ret + } + + return o.SsdVolumeProvisioned +} + +// GetSsdVolumeProvisionedOk returns a tuple with the SsdVolumeProvisioned field value +// and a boolean to check if the value has been set. +func (o *ResourceLimits) GetSsdVolumeProvisionedOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.SsdVolumeProvisioned, true +} + +// SetSsdVolumeProvisioned sets field value +func (o *ResourceLimits) SetSsdVolumeProvisioned(v int64) { + o.SsdVolumeProvisioned = v +} + +// GetDasVolumeProvisioned returns the DasVolumeProvisioned field value +func (o *ResourceLimits) GetDasVolumeProvisioned() int64 { + if o == nil { + var ret int64 + return ret + } + + return o.DasVolumeProvisioned +} + +// GetDasVolumeProvisionedOk returns a tuple with the DasVolumeProvisioned field value +// and a boolean to check if the value has been set. +func (o *ResourceLimits) GetDasVolumeProvisionedOk() (*int64, bool) { + if o == nil { + return nil, false + } + return &o.DasVolumeProvisioned, true +} + +// SetDasVolumeProvisioned sets field value +func (o *ResourceLimits) SetDasVolumeProvisioned(v int64) { + o.DasVolumeProvisioned = v +} + +// GetReservableIps returns the ReservableIps field value +func (o *ResourceLimits) GetReservableIps() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.ReservableIps +} + +// GetReservableIpsOk returns a tuple with the ReservableIps field value +// and a boolean to check if the value has been set. +func (o *ResourceLimits) GetReservableIpsOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.ReservableIps, true +} + +// SetReservableIps sets field value +func (o *ResourceLimits) SetReservableIps(v int32) { + o.ReservableIps = v +} + +// GetReservedIpsOnContract returns the ReservedIpsOnContract field value +func (o *ResourceLimits) GetReservedIpsOnContract() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.ReservedIpsOnContract +} + +// GetReservedIpsOnContractOk returns a tuple with the ReservedIpsOnContract field value +// and a boolean to check if the value has been set. +func (o *ResourceLimits) GetReservedIpsOnContractOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.ReservedIpsOnContract, true +} + +// SetReservedIpsOnContract sets field value +func (o *ResourceLimits) SetReservedIpsOnContract(v int32) { + o.ReservedIpsOnContract = v +} + +// GetReservedIpsInUse returns the ReservedIpsInUse field value +func (o *ResourceLimits) GetReservedIpsInUse() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.ReservedIpsInUse +} + +// GetReservedIpsInUseOk returns a tuple with the ReservedIpsInUse field value +// and a boolean to check if the value has been set. +func (o *ResourceLimits) GetReservedIpsInUseOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.ReservedIpsInUse, true +} + +// SetReservedIpsInUse sets field value +func (o *ResourceLimits) SetReservedIpsInUse(v int32) { + o.ReservedIpsInUse = v +} + +// GetK8sClusterLimitTotal returns the K8sClusterLimitTotal field value +func (o *ResourceLimits) GetK8sClusterLimitTotal() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.K8sClusterLimitTotal +} + +// GetK8sClusterLimitTotalOk returns a tuple with the K8sClusterLimitTotal field value +// and a boolean to check if the value has been set. +func (o *ResourceLimits) GetK8sClusterLimitTotalOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.K8sClusterLimitTotal, true +} + +// SetK8sClusterLimitTotal sets field value +func (o *ResourceLimits) SetK8sClusterLimitTotal(v int32) { + o.K8sClusterLimitTotal = v +} + +// GetK8sClustersProvisioned returns the K8sClustersProvisioned field value +func (o *ResourceLimits) GetK8sClustersProvisioned() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.K8sClustersProvisioned +} + +// GetK8sClustersProvisionedOk returns a tuple with the K8sClustersProvisioned field value +// and a boolean to check if the value has been set. +func (o *ResourceLimits) GetK8sClustersProvisionedOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.K8sClustersProvisioned, true +} + +// SetK8sClustersProvisioned sets field value +func (o *ResourceLimits) SetK8sClustersProvisioned(v int32) { + o.K8sClustersProvisioned = v +} + +// GetNlbLimitTotal returns the NlbLimitTotal field value +func (o *ResourceLimits) GetNlbLimitTotal() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.NlbLimitTotal +} + +// GetNlbLimitTotalOk returns a tuple with the NlbLimitTotal field value +// and a boolean to check if the value has been set. +func (o *ResourceLimits) GetNlbLimitTotalOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.NlbLimitTotal, true +} + +// SetNlbLimitTotal sets field value +func (o *ResourceLimits) SetNlbLimitTotal(v int32) { + o.NlbLimitTotal = v +} + +// GetNlbProvisioned returns the NlbProvisioned field value +func (o *ResourceLimits) GetNlbProvisioned() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.NlbProvisioned +} + +// GetNlbProvisionedOk returns a tuple with the NlbProvisioned field value +// and a boolean to check if the value has been set. +func (o *ResourceLimits) GetNlbProvisionedOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.NlbProvisioned, true +} + +// SetNlbProvisioned sets field value +func (o *ResourceLimits) SetNlbProvisioned(v int32) { + o.NlbProvisioned = v +} + +// GetNatGatewayLimitTotal returns the NatGatewayLimitTotal field value +func (o *ResourceLimits) GetNatGatewayLimitTotal() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.NatGatewayLimitTotal +} + +// GetNatGatewayLimitTotalOk returns a tuple with the NatGatewayLimitTotal field value +// and a boolean to check if the value has been set. +func (o *ResourceLimits) GetNatGatewayLimitTotalOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.NatGatewayLimitTotal, true +} + +// SetNatGatewayLimitTotal sets field value +func (o *ResourceLimits) SetNatGatewayLimitTotal(v int32) { + o.NatGatewayLimitTotal = v +} + +// GetNatGatewayProvisioned returns the NatGatewayProvisioned field value +func (o *ResourceLimits) GetNatGatewayProvisioned() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.NatGatewayProvisioned +} + +// GetNatGatewayProvisionedOk returns a tuple with the NatGatewayProvisioned field value +// and a boolean to check if the value has been set. +func (o *ResourceLimits) GetNatGatewayProvisionedOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.NatGatewayProvisioned, true +} + +// SetNatGatewayProvisioned sets field value +func (o *ResourceLimits) SetNatGatewayProvisioned(v int32) { + o.NatGatewayProvisioned = v +} + +// GetSecurityGroupsPerVdc returns the SecurityGroupsPerVdc field value +func (o *ResourceLimits) GetSecurityGroupsPerVdc() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.SecurityGroupsPerVdc +} + +// GetSecurityGroupsPerVdcOk returns a tuple with the SecurityGroupsPerVdc field value +// and a boolean to check if the value has been set. +func (o *ResourceLimits) GetSecurityGroupsPerVdcOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.SecurityGroupsPerVdc, true +} + +// SetSecurityGroupsPerVdc sets field value +func (o *ResourceLimits) SetSecurityGroupsPerVdc(v int32) { + o.SecurityGroupsPerVdc = v +} + +// GetSecurityGroupsPerResource returns the SecurityGroupsPerResource field value +func (o *ResourceLimits) GetSecurityGroupsPerResource() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.SecurityGroupsPerResource +} + +// GetSecurityGroupsPerResourceOk returns a tuple with the SecurityGroupsPerResource field value +// and a boolean to check if the value has been set. +func (o *ResourceLimits) GetSecurityGroupsPerResourceOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.SecurityGroupsPerResource, true +} + +// SetSecurityGroupsPerResource sets field value +func (o *ResourceLimits) SetSecurityGroupsPerResource(v int32) { + o.SecurityGroupsPerResource = v +} + +// GetRulesPerSecurityGroup returns the RulesPerSecurityGroup field value +func (o *ResourceLimits) GetRulesPerSecurityGroup() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.RulesPerSecurityGroup +} + +// GetRulesPerSecurityGroupOk returns a tuple with the RulesPerSecurityGroup field value +// and a boolean to check if the value has been set. +func (o *ResourceLimits) GetRulesPerSecurityGroupOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.RulesPerSecurityGroup, true +} + +// SetRulesPerSecurityGroup sets field value +func (o *ResourceLimits) SetRulesPerSecurityGroup(v int32) { + o.RulesPerSecurityGroup = v +} + +func (o ResourceLimits) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ResourceLimits) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["coresPerServer"] = o.CoresPerServer + toSerialize["coresPerContract"] = o.CoresPerContract + toSerialize["coresProvisioned"] = o.CoresProvisioned + toSerialize["ramPerServer"] = o.RamPerServer + toSerialize["ramPerContract"] = o.RamPerContract + toSerialize["ramProvisioned"] = o.RamProvisioned + toSerialize["hddLimitPerVolume"] = o.HddLimitPerVolume + toSerialize["hddLimitPerContract"] = o.HddLimitPerContract + toSerialize["hddVolumeProvisioned"] = o.HddVolumeProvisioned + toSerialize["ssdLimitPerVolume"] = o.SsdLimitPerVolume + toSerialize["ssdLimitPerContract"] = o.SsdLimitPerContract + toSerialize["ssdVolumeProvisioned"] = o.SsdVolumeProvisioned + toSerialize["dasVolumeProvisioned"] = o.DasVolumeProvisioned + toSerialize["reservableIps"] = o.ReservableIps + toSerialize["reservedIpsOnContract"] = o.ReservedIpsOnContract + toSerialize["reservedIpsInUse"] = o.ReservedIpsInUse + toSerialize["k8sClusterLimitTotal"] = o.K8sClusterLimitTotal + toSerialize["k8sClustersProvisioned"] = o.K8sClustersProvisioned + toSerialize["nlbLimitTotal"] = o.NlbLimitTotal + toSerialize["nlbProvisioned"] = o.NlbProvisioned + toSerialize["natGatewayLimitTotal"] = o.NatGatewayLimitTotal + toSerialize["natGatewayProvisioned"] = o.NatGatewayProvisioned + toSerialize["securityGroupsPerVdc"] = o.SecurityGroupsPerVdc + toSerialize["securityGroupsPerResource"] = o.SecurityGroupsPerResource + toSerialize["rulesPerSecurityGroup"] = o.RulesPerSecurityGroup + return toSerialize, nil +} + +type NullableResourceLimits struct { + value *ResourceLimits + isSet bool +} + +func (v NullableResourceLimits) Get() *ResourceLimits { + return v.value +} + +func (v *NullableResourceLimits) Set(val *ResourceLimits) { + v.value = val + v.isSet = true +} + +func (v NullableResourceLimits) IsSet() bool { + return v.isSet +} + +func (v *NullableResourceLimits) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableResourceLimits(val *ResourceLimits) *NullableResourceLimits { + return &NullableResourceLimits{value: val, isSet: true} +} + +func (v NullableResourceLimits) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableResourceLimits) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_resource_properties.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_resource_properties.go similarity index 76% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_resource_properties.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_resource_properties.go index 44bc3be5a..12f65882c 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_resource_properties.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_resource_properties.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the ResourceProperties type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ResourceProperties{} + // ResourceProperties struct for ResourceProperties type ResourceProperties struct { // The name of the resource. @@ -40,93 +43,87 @@ func NewResourcePropertiesWithDefaults() *ResourceProperties { return &this } -// GetName returns the Name field value -// If the value is explicit nil, nil is returned -func (o *ResourceProperties) GetName() *string { - if o == nil { - return nil +// GetName returns the Name field value if set, zero value otherwise. +func (o *ResourceProperties) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret } - - return o.Name - + return *o.Name } -// GetNameOk returns a tuple with the Name field value +// GetNameOk returns a tuple with the Name 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 *ResourceProperties) GetNameOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Name) { return nil, false } - return o.Name, true } -// SetName sets field value -func (o *ResourceProperties) SetName(v string) { - - o.Name = &v - -} - // HasName returns a boolean if a field has been set. func (o *ResourceProperties) HasName() bool { - if o != nil && o.Name != nil { + if o != nil && !IsNil(o.Name) { return true } return false } -// GetSecAuthProtection returns the SecAuthProtection field value -// If the value is explicit nil, nil is returned -func (o *ResourceProperties) GetSecAuthProtection() *bool { - if o == nil { - return nil - } - - return o.SecAuthProtection +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *ResourceProperties) SetName(v string) { + o.Name = &v +} +// GetSecAuthProtection returns the SecAuthProtection field value if set, zero value otherwise. +func (o *ResourceProperties) GetSecAuthProtection() bool { + if o == nil || IsNil(o.SecAuthProtection) { + var ret bool + return ret + } + return *o.SecAuthProtection } -// GetSecAuthProtectionOk returns a tuple with the SecAuthProtection field value +// GetSecAuthProtectionOk returns a tuple with the SecAuthProtection 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 *ResourceProperties) GetSecAuthProtectionOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.SecAuthProtection) { return nil, false } - return o.SecAuthProtection, true } -// SetSecAuthProtection sets field value -func (o *ResourceProperties) SetSecAuthProtection(v bool) { - - o.SecAuthProtection = &v - -} - // HasSecAuthProtection returns a boolean if a field has been set. func (o *ResourceProperties) HasSecAuthProtection() bool { - if o != nil && o.SecAuthProtection != nil { + if o != nil && !IsNil(o.SecAuthProtection) { return true } return false } +// SetSecAuthProtection gets a reference to the given bool and assigns it to the SecAuthProtection field. +func (o *ResourceProperties) SetSecAuthProtection(v bool) { + o.SecAuthProtection = &v +} + func (o ResourceProperties) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ResourceProperties) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Name != nil { + if !IsNil(o.Name) { toSerialize["name"] = o.Name } - - if o.SecAuthProtection != nil { + if !IsNil(o.SecAuthProtection) { toSerialize["secAuthProtection"] = o.SecAuthProtection } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableResourceProperties struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_resource_reference.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_resource_reference.go similarity index 73% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_resource_reference.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_resource_reference.go index 3d2fd9801..de3549c22 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_resource_reference.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_resource_reference.go @@ -14,10 +14,13 @@ import ( "encoding/json" ) +// checks if the ResourceReference type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ResourceReference{} + // ResourceReference struct for ResourceReference type ResourceReference struct { // The resource's unique identifier. - Id *string `json:"id"` + Id string `json:"id"` // The type of object that has been created. Type *Type `json:"type,omitempty"` // URL to the object representation (absolute path). @@ -31,7 +34,7 @@ type ResourceReference struct { func NewResourceReference(id string) *ResourceReference { this := ResourceReference{} - this.Id = &id + this.Id = id return &this } @@ -45,134 +48,111 @@ func NewResourceReferenceWithDefaults() *ResourceReference { } // GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *ResourceReference) GetId() *string { +func (o *ResourceReference) GetId() string { if o == nil { - return 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. -// NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *ResourceReference) GetIdOk() (*string, bool) { if o == nil { return nil, false } - - return o.Id, true + return &o.Id, true } // SetId sets field value func (o *ResourceReference) SetId(v string) { - - o.Id = &v - -} - -// HasId returns a boolean if a field has been set. -func (o *ResourceReference) HasId() bool { - if o != nil && o.Id != nil { - return true - } - - return false + o.Id = v } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *ResourceReference) GetType() *Type { - if o == nil { - return nil +// GetType returns the Type field value if set, zero value otherwise. +func (o *ResourceReference) GetType() Type { + if o == nil || IsNil(o.Type) { + var ret Type + return ret } - - return o.Type - + return *o.Type } -// GetTypeOk returns a tuple with the Type field value +// GetTypeOk returns a tuple with the Type 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 *ResourceReference) GetTypeOk() (*Type, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *ResourceReference) SetType(v Type) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *ResourceReference) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *ResourceReference) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given Type and assigns it to the Type field. +func (o *ResourceReference) SetType(v Type) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *ResourceReference) 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 +// GetHrefOk returns a tuple with the Href 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 *ResourceReference) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *ResourceReference) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *ResourceReference) HasHref() bool { - if o != nil && o.Href != nil { + 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 *ResourceReference) SetHref(v string) { + o.Href = &v +} + func (o ResourceReference) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.Id != nil { - toSerialize["id"] = o.Id + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } + return json.Marshal(toSerialize) +} - if o.Type != nil { +func (o ResourceReference) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["id"] = o.Id + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableResourceReference struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_resources.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_resources.go similarity index 64% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_resources.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_resources.go index 68ba71bef..956be720c 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_resources.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_resources.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the Resources type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Resources{} + // Resources Collection to represent the resource. type Resources struct { // The resource's unique identifier. @@ -23,7 +26,7 @@ type Resources struct { // URL to the object representation (absolute path). Href *string `json:"href,omitempty"` // Array of items in the collection. - Items *[]Resource `json:"items,omitempty"` + Items []Resource `json:"items,omitempty"` } // NewResources instantiates a new Resources object @@ -44,177 +47,157 @@ func NewResourcesWithDefaults() *Resources { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *Resources) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *Resources) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *Resources) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *Resources) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *Resources) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *Resources) GetType() *Type { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Resources) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *Resources) GetType() Type { + if o == nil || IsNil(o.Type) { + var ret Type + return ret + } + return *o.Type } -// GetTypeOk returns a tuple with the Type field value +// GetTypeOk returns a tuple with the Type 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 *Resources) GetTypeOk() (*Type, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *Resources) SetType(v Type) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *Resources) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *Resources) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given Type and assigns it to the Type field. +func (o *Resources) SetType(v Type) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *Resources) 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 +// GetHrefOk returns a tuple with the Href 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 *Resources) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *Resources) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *Resources) HasHref() bool { - if o != nil && o.Href != nil { + if o != nil && !IsNil(o.Href) { return true } return false } -// GetItems returns the Items field value -// If the value is explicit nil, nil is returned -func (o *Resources) GetItems() *[]Resource { - if o == nil { - return nil - } +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *Resources) SetHref(v string) { + o.Href = &v +} +// GetItems returns the Items field value if set, zero value otherwise. +func (o *Resources) GetItems() []Resource { + if o == nil || IsNil(o.Items) { + var ret []Resource + return ret + } return o.Items - } -// GetItemsOk returns a tuple with the Items field value +// GetItemsOk returns a tuple with the Items 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 *Resources) GetItemsOk() (*[]Resource, bool) { - if o == nil { +func (o *Resources) GetItemsOk() ([]Resource, bool) { + if o == nil || IsNil(o.Items) { return nil, false } - return o.Items, true } -// SetItems sets field value -func (o *Resources) SetItems(v []Resource) { - - o.Items = &v - -} - // HasItems returns a boolean if a field has been set. func (o *Resources) HasItems() bool { - if o != nil && o.Items != nil { + if o != nil && !IsNil(o.Items) { return true } return false } +// SetItems gets a reference to the given []Resource and assigns it to the Items field. +func (o *Resources) SetItems(v []Resource) { + o.Items = v +} + func (o Resources) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Resources) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Items != nil { + if !IsNil(o.Items) { toSerialize["items"] = o.Items } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableResources struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_resources_users.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_resources_users.go similarity index 65% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_resources_users.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_resources_users.go index c89fcaf4d..56dc64181 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_resources_users.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_resources_users.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the ResourcesUsers type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ResourcesUsers{} + // ResourcesUsers Resources owned by a user. type ResourcesUsers struct { // The resource's unique identifier. @@ -23,7 +26,7 @@ type ResourcesUsers struct { // URL to the object representation (absolute path). Href *string `json:"href,omitempty"` // Array of items in the collection. - Items *[]Resource `json:"items,omitempty"` + Items []Resource `json:"items,omitempty"` } // NewResourcesUsers instantiates a new ResourcesUsers object @@ -44,177 +47,157 @@ func NewResourcesUsersWithDefaults() *ResourcesUsers { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *ResourcesUsers) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *ResourcesUsers) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *ResourcesUsers) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *ResourcesUsers) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *ResourcesUsers) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *ResourcesUsers) GetType() *Type { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *ResourcesUsers) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *ResourcesUsers) GetType() Type { + if o == nil || IsNil(o.Type) { + var ret Type + return ret + } + return *o.Type } -// GetTypeOk returns a tuple with the Type field value +// GetTypeOk returns a tuple with the Type 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 *ResourcesUsers) GetTypeOk() (*Type, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *ResourcesUsers) SetType(v Type) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *ResourcesUsers) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *ResourcesUsers) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given Type and assigns it to the Type field. +func (o *ResourcesUsers) SetType(v Type) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *ResourcesUsers) 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 +// GetHrefOk returns a tuple with the Href 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 *ResourcesUsers) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *ResourcesUsers) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *ResourcesUsers) HasHref() bool { - if o != nil && o.Href != nil { + if o != nil && !IsNil(o.Href) { return true } return false } -// GetItems returns the Items field value -// If the value is explicit nil, nil is returned -func (o *ResourcesUsers) GetItems() *[]Resource { - if o == nil { - return nil - } +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *ResourcesUsers) SetHref(v string) { + o.Href = &v +} +// GetItems returns the Items field value if set, zero value otherwise. +func (o *ResourcesUsers) GetItems() []Resource { + if o == nil || IsNil(o.Items) { + var ret []Resource + return ret + } return o.Items - } -// GetItemsOk returns a tuple with the Items field value +// GetItemsOk returns a tuple with the Items 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 *ResourcesUsers) GetItemsOk() (*[]Resource, bool) { - if o == nil { +func (o *ResourcesUsers) GetItemsOk() ([]Resource, bool) { + if o == nil || IsNil(o.Items) { return nil, false } - return o.Items, true } -// SetItems sets field value -func (o *ResourcesUsers) SetItems(v []Resource) { - - o.Items = &v - -} - // HasItems returns a boolean if a field has been set. func (o *ResourcesUsers) HasItems() bool { - if o != nil && o.Items != nil { + if o != nil && !IsNil(o.Items) { return true } return false } +// SetItems gets a reference to the given []Resource and assigns it to the Items field. +func (o *ResourcesUsers) SetItems(v []Resource) { + o.Items = v +} + func (o ResourcesUsers) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ResourcesUsers) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Items != nil { + if !IsNil(o.Items) { toSerialize["items"] = o.Items } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableResourcesUsers struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_restore_snapshot.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_restore_snapshot.go similarity index 78% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_restore_snapshot.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_restore_snapshot.go index 768c4554d..4add703fd 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_restore_snapshot.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_restore_snapshot.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the RestoreSnapshot type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &RestoreSnapshot{} + // RestoreSnapshot struct for RestoreSnapshot type RestoreSnapshot struct { Properties *RestoreSnapshotProperties `json:"properties,omitempty"` @@ -37,51 +40,52 @@ func NewRestoreSnapshotWithDefaults() *RestoreSnapshot { return &this } -// GetProperties returns the Properties field value -// If the value is explicit nil, nil is returned -func (o *RestoreSnapshot) GetProperties() *RestoreSnapshotProperties { - if o == nil { - return nil +// GetProperties returns the Properties field value if set, zero value otherwise. +func (o *RestoreSnapshot) GetProperties() RestoreSnapshotProperties { + if o == nil || IsNil(o.Properties) { + var ret RestoreSnapshotProperties + return ret } - - return o.Properties - + return *o.Properties } -// GetPropertiesOk returns a tuple with the Properties field value +// GetPropertiesOk returns a tuple with the Properties 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 *RestoreSnapshot) GetPropertiesOk() (*RestoreSnapshotProperties, bool) { - if o == nil { + if o == nil || IsNil(o.Properties) { return nil, false } - return o.Properties, true } -// SetProperties sets field value -func (o *RestoreSnapshot) SetProperties(v RestoreSnapshotProperties) { - - o.Properties = &v - -} - // HasProperties returns a boolean if a field has been set. func (o *RestoreSnapshot) HasProperties() bool { - if o != nil && o.Properties != nil { + if o != nil && !IsNil(o.Properties) { return true } return false } +// SetProperties gets a reference to the given RestoreSnapshotProperties and assigns it to the Properties field. +func (o *RestoreSnapshot) SetProperties(v RestoreSnapshotProperties) { + o.Properties = &v +} + func (o RestoreSnapshot) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o RestoreSnapshot) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Properties != nil { + if !IsNil(o.Properties) { toSerialize["properties"] = o.Properties } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableRestoreSnapshot struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_restore_snapshot_properties.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_restore_snapshot_properties.go similarity index 80% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_restore_snapshot_properties.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_restore_snapshot_properties.go index b8e9ace1e..f61fa01d6 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_restore_snapshot_properties.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_restore_snapshot_properties.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the RestoreSnapshotProperties type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &RestoreSnapshotProperties{} + // RestoreSnapshotProperties struct for RestoreSnapshotProperties type RestoreSnapshotProperties struct { // The id of the snapshot @@ -38,51 +41,52 @@ func NewRestoreSnapshotPropertiesWithDefaults() *RestoreSnapshotProperties { return &this } -// GetSnapshotId returns the SnapshotId field value -// If the value is explicit nil, nil is returned -func (o *RestoreSnapshotProperties) GetSnapshotId() *string { - if o == nil { - return nil +// GetSnapshotId returns the SnapshotId field value if set, zero value otherwise. +func (o *RestoreSnapshotProperties) GetSnapshotId() string { + if o == nil || IsNil(o.SnapshotId) { + var ret string + return ret } - - return o.SnapshotId - + return *o.SnapshotId } -// GetSnapshotIdOk returns a tuple with the SnapshotId field value +// GetSnapshotIdOk returns a tuple with the SnapshotId 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 *RestoreSnapshotProperties) GetSnapshotIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.SnapshotId) { return nil, false } - return o.SnapshotId, true } -// SetSnapshotId sets field value -func (o *RestoreSnapshotProperties) SetSnapshotId(v string) { - - o.SnapshotId = &v - -} - // HasSnapshotId returns a boolean if a field has been set. func (o *RestoreSnapshotProperties) HasSnapshotId() bool { - if o != nil && o.SnapshotId != nil { + if o != nil && !IsNil(o.SnapshotId) { return true } return false } +// SetSnapshotId gets a reference to the given string and assigns it to the SnapshotId field. +func (o *RestoreSnapshotProperties) SetSnapshotId(v string) { + o.SnapshotId = &v +} + func (o RestoreSnapshotProperties) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o RestoreSnapshotProperties) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.SnapshotId != nil { + if !IsNil(o.SnapshotId) { toSerialize["snapshotId"] = o.SnapshotId } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableRestoreSnapshotProperties struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_s3_bucket.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_s3_bucket.go similarity index 84% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_s3_bucket.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_s3_bucket.go index c0f438c4d..d8e8105e1 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_s3_bucket.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_s3_bucket.go @@ -14,10 +14,13 @@ import ( "encoding/json" ) +// checks if the S3Bucket type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &S3Bucket{} + // S3Bucket struct for S3Bucket type S3Bucket struct { // The name of the Object storage bucket. - Name *string `json:"name"` + Name string `json:"name"` } // NewS3Bucket instantiates a new S3Bucket object @@ -27,7 +30,7 @@ type S3Bucket struct { func NewS3Bucket(name string) *S3Bucket { this := S3Bucket{} - this.Name = &name + this.Name = name return &this } @@ -41,50 +44,41 @@ func NewS3BucketWithDefaults() *S3Bucket { } // GetName returns the Name field value -// If the value is explicit nil, nil is returned -func (o *S3Bucket) GetName() *string { +func (o *S3Bucket) GetName() string { if o == nil { - return 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. -// NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *S3Bucket) GetNameOk() (*string, bool) { if o == nil { return nil, false } - - return o.Name, true + return &o.Name, true } // SetName sets field value func (o *S3Bucket) SetName(v string) { - - o.Name = &v - + o.Name = v } -// HasName returns a boolean if a field has been set. -func (o *S3Bucket) HasName() bool { - if o != nil && o.Name != nil { - return true +func (o S3Bucket) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } - - return false + return json.Marshal(toSerialize) } -func (o S3Bucket) MarshalJSON() ([]byte, error) { +func (o S3Bucket) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Name != nil { - toSerialize["name"] = o.Name - } - - return json.Marshal(toSerialize) + toSerialize["name"] = o.Name + return toSerialize, nil } type NullableS3Bucket struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_s3_key.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_s3_key.go similarity index 63% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_s3_key.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_s3_key.go index 9a630dfb1..da040fe0a 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_s3_key.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_s3_key.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the S3Key type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &S3Key{} + // S3Key struct for S3Key type S3Key struct { // The resource's unique identifier. @@ -21,9 +24,9 @@ type S3Key struct { // The type of the resource. Type *Type `json:"type,omitempty"` // URL to the object representation (absolute path). - Href *string `json:"href,omitempty"` - Metadata *S3KeyMetadata `json:"metadata,omitempty"` - Properties *S3KeyProperties `json:"properties"` + Href *string `json:"href,omitempty"` + Metadata *S3KeyMetadata `json:"metadata,omitempty"` + Properties S3KeyProperties `json:"properties"` } // NewS3Key instantiates a new S3Key object @@ -33,7 +36,7 @@ type S3Key struct { func NewS3Key(properties S3KeyProperties) *S3Key { this := S3Key{} - this.Properties = &properties + this.Properties = properties return &this } @@ -46,219 +49,182 @@ func NewS3KeyWithDefaults() *S3Key { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *S3Key) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *S3Key) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *S3Key) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *S3Key) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *S3Key) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *S3Key) GetType() *Type { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *S3Key) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *S3Key) GetType() Type { + if o == nil || IsNil(o.Type) { + var ret Type + return ret + } + return *o.Type } -// GetTypeOk returns a tuple with the Type field value +// GetTypeOk returns a tuple with the Type 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 *S3Key) GetTypeOk() (*Type, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *S3Key) SetType(v Type) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *S3Key) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *S3Key) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given Type and assigns it to the Type field. +func (o *S3Key) SetType(v Type) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *S3Key) 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 +// GetHrefOk returns a tuple with the Href 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 *S3Key) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *S3Key) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *S3Key) HasHref() bool { - if o != nil && o.Href != nil { + if o != nil && !IsNil(o.Href) { return true } return false } -// GetMetadata returns the Metadata field value -// If the value is explicit nil, nil is returned -func (o *S3Key) GetMetadata() *S3KeyMetadata { - if o == nil { - return nil - } - - return o.Metadata +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *S3Key) SetHref(v string) { + o.Href = &v +} +// GetMetadata returns the Metadata field value if set, zero value otherwise. +func (o *S3Key) GetMetadata() S3KeyMetadata { + if o == nil || IsNil(o.Metadata) { + var ret S3KeyMetadata + return ret + } + return *o.Metadata } -// GetMetadataOk returns a tuple with the Metadata field value +// GetMetadataOk returns a tuple with the Metadata 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 *S3Key) GetMetadataOk() (*S3KeyMetadata, bool) { - if o == nil { + if o == nil || IsNil(o.Metadata) { return nil, false } - return o.Metadata, true } -// SetMetadata sets field value -func (o *S3Key) SetMetadata(v S3KeyMetadata) { - - o.Metadata = &v - -} - // HasMetadata returns a boolean if a field has been set. func (o *S3Key) HasMetadata() bool { - if o != nil && o.Metadata != nil { + if o != nil && !IsNil(o.Metadata) { return true } return false } +// SetMetadata gets a reference to the given S3KeyMetadata and assigns it to the Metadata field. +func (o *S3Key) SetMetadata(v S3KeyMetadata) { + o.Metadata = &v +} + // GetProperties returns the Properties field value -// If the value is explicit nil, nil is returned -func (o *S3Key) GetProperties() *S3KeyProperties { +func (o *S3Key) GetProperties() S3KeyProperties { if o == nil { - return nil + var ret S3KeyProperties + return ret } return o.Properties - } // GetPropertiesOk returns a tuple with the Properties field value // 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 *S3Key) GetPropertiesOk() (*S3KeyProperties, bool) { if o == nil { return nil, false } - - return o.Properties, true + return &o.Properties, true } // SetProperties sets field value func (o *S3Key) SetProperties(v S3KeyProperties) { - - o.Properties = &v - + o.Properties = v } -// HasProperties returns a boolean if a field has been set. -func (o *S3Key) HasProperties() bool { - if o != nil && o.Properties != nil { - return true +func (o S3Key) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } - - return false + return json.Marshal(toSerialize) } -func (o S3Key) MarshalJSON() ([]byte, error) { +func (o S3Key) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Metadata != nil { + if !IsNil(o.Metadata) { toSerialize["metadata"] = o.Metadata } - - if o.Properties != nil { - toSerialize["properties"] = o.Properties - } - - return json.Marshal(toSerialize) + toSerialize["properties"] = o.Properties + return toSerialize, nil } type NullableS3Key struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_s3_key_metadata.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_s3_key_metadata.go similarity index 64% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_s3_key_metadata.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_s3_key_metadata.go index c0ead4602..474fc4a7f 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_s3_key_metadata.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_s3_key_metadata.go @@ -12,21 +12,25 @@ package ionoscloud import ( "encoding/json" + "time" ) +// checks if the S3KeyMetadata type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &S3KeyMetadata{} + // S3KeyMetadata struct for S3KeyMetadata type S3KeyMetadata struct { // Resource's Entity Tag as defined in http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.11 Entity Tag is also added as an 'ETag response header to requests which don't use 'depth' parameter. Etag *string `json:"etag,omitempty"` // The time when the Object storage key was created. - CreatedDate *IonosTime + CreatedDate *IonosTime `json:"createdDate,omitempty"` // Unique name of the identity that created the resource. CreatedBy *string `json:"createdBy,omitempty"` // The unique ID of the user who created the Object storage key. CreatedByUserId *string `json:"createdByUserId,omitempty"` // The last time the Object storage key was modified. - LastModifiedDate *IonosTime + LastModifiedDate *IonosTime `json:"lastModifiedDate,omitempty"` // Unique name of the identity that last modified the Object storage key. LastModifiedBy *string `json:"lastModifiedBy,omitempty"` // The unique ID of the user who last modified the Object storage key. @@ -51,317 +55,262 @@ func NewS3KeyMetadataWithDefaults() *S3KeyMetadata { return &this } -// GetEtag returns the Etag field value -// If the value is explicit nil, nil is returned -func (o *S3KeyMetadata) GetEtag() *string { - if o == nil { - return nil +// GetEtag returns the Etag field value if set, zero value otherwise. +func (o *S3KeyMetadata) GetEtag() string { + if o == nil || IsNil(o.Etag) { + var ret string + return ret } - - return o.Etag - + return *o.Etag } -// GetEtagOk returns a tuple with the Etag field value +// GetEtagOk returns a tuple with the Etag 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 *S3KeyMetadata) GetEtagOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Etag) { return nil, false } - return o.Etag, true } -// SetEtag sets field value -func (o *S3KeyMetadata) SetEtag(v string) { - - o.Etag = &v - -} - // HasEtag returns a boolean if a field has been set. func (o *S3KeyMetadata) HasEtag() bool { - if o != nil && o.Etag != nil { + if o != nil && !IsNil(o.Etag) { return true } return false } -// GetCreatedDate returns the CreatedDate field value -// If the value is explicit nil, nil is returned -func (o *S3KeyMetadata) GetCreatedDate() *time.Time { - if o == nil { - return nil - } +// SetEtag gets a reference to the given string and assigns it to the Etag field. +func (o *S3KeyMetadata) SetEtag(v string) { + o.Etag = &v +} - if o.CreatedDate == nil { - return nil +// GetCreatedDate returns the CreatedDate field value if set, zero value otherwise. +func (o *S3KeyMetadata) GetCreatedDate() time.Time { + if o == nil || IsNil(o.CreatedDate) { + var ret time.Time + return ret } - return &o.CreatedDate.Time - + return o.CreatedDate.Time } -// GetCreatedDateOk returns a tuple with the CreatedDate field value +// GetCreatedDateOk returns a tuple with the CreatedDate 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 *S3KeyMetadata) GetCreatedDateOk() (*time.Time, bool) { - if o == nil { - return nil, false - } - - if o.CreatedDate == nil { + if o == nil || IsNil(o.CreatedDate) { return nil, false } return &o.CreatedDate.Time, true - -} - -// SetCreatedDate sets field value -func (o *S3KeyMetadata) SetCreatedDate(v time.Time) { - - o.CreatedDate = &IonosTime{v} - } // HasCreatedDate returns a boolean if a field has been set. func (o *S3KeyMetadata) HasCreatedDate() bool { - if o != nil && o.CreatedDate != nil { + if o != nil && !IsNil(o.CreatedDate) { return true } return false } -// GetCreatedBy returns the CreatedBy field value -// If the value is explicit nil, nil is returned -func (o *S3KeyMetadata) GetCreatedBy() *string { - if o == nil { - return nil - } - - return o.CreatedBy +// SetCreatedDate gets a reference to the given time.Time and assigns it to the CreatedDate field. +func (o *S3KeyMetadata) SetCreatedDate(v time.Time) { + o.CreatedDate = &IonosTime{v} +} +// GetCreatedBy returns the CreatedBy field value if set, zero value otherwise. +func (o *S3KeyMetadata) GetCreatedBy() string { + if o == nil || IsNil(o.CreatedBy) { + var ret string + return ret + } + return *o.CreatedBy } -// GetCreatedByOk returns a tuple with the CreatedBy field value +// GetCreatedByOk returns a tuple with the CreatedBy 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 *S3KeyMetadata) GetCreatedByOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.CreatedBy) { return nil, false } - return o.CreatedBy, true } -// SetCreatedBy sets field value -func (o *S3KeyMetadata) SetCreatedBy(v string) { - - o.CreatedBy = &v - -} - // HasCreatedBy returns a boolean if a field has been set. func (o *S3KeyMetadata) HasCreatedBy() bool { - if o != nil && o.CreatedBy != nil { + if o != nil && !IsNil(o.CreatedBy) { return true } return false } -// GetCreatedByUserId returns the CreatedByUserId field value -// If the value is explicit nil, nil is returned -func (o *S3KeyMetadata) GetCreatedByUserId() *string { - if o == nil { - return nil - } - - return o.CreatedByUserId +// SetCreatedBy gets a reference to the given string and assigns it to the CreatedBy field. +func (o *S3KeyMetadata) SetCreatedBy(v string) { + o.CreatedBy = &v +} +// GetCreatedByUserId returns the CreatedByUserId field value if set, zero value otherwise. +func (o *S3KeyMetadata) GetCreatedByUserId() string { + if o == nil || IsNil(o.CreatedByUserId) { + var ret string + return ret + } + return *o.CreatedByUserId } -// GetCreatedByUserIdOk returns a tuple with the CreatedByUserId field value +// GetCreatedByUserIdOk returns a tuple with the CreatedByUserId 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 *S3KeyMetadata) GetCreatedByUserIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.CreatedByUserId) { return nil, false } - return o.CreatedByUserId, true } -// SetCreatedByUserId sets field value -func (o *S3KeyMetadata) SetCreatedByUserId(v string) { - - o.CreatedByUserId = &v - -} - // HasCreatedByUserId returns a boolean if a field has been set. func (o *S3KeyMetadata) HasCreatedByUserId() bool { - if o != nil && o.CreatedByUserId != nil { + if o != nil && !IsNil(o.CreatedByUserId) { return true } return false } -// GetLastModifiedDate returns the LastModifiedDate field value -// If the value is explicit nil, nil is returned -func (o *S3KeyMetadata) GetLastModifiedDate() *time.Time { - if o == nil { - return nil - } +// SetCreatedByUserId gets a reference to the given string and assigns it to the CreatedByUserId field. +func (o *S3KeyMetadata) SetCreatedByUserId(v string) { + o.CreatedByUserId = &v +} - if o.LastModifiedDate == nil { - return nil +// GetLastModifiedDate returns the LastModifiedDate field value if set, zero value otherwise. +func (o *S3KeyMetadata) GetLastModifiedDate() time.Time { + if o == nil || IsNil(o.LastModifiedDate) { + var ret time.Time + return ret } - return &o.LastModifiedDate.Time - + return o.LastModifiedDate.Time } -// GetLastModifiedDateOk returns a tuple with the LastModifiedDate field value +// GetLastModifiedDateOk returns a tuple with the LastModifiedDate 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 *S3KeyMetadata) GetLastModifiedDateOk() (*time.Time, bool) { - if o == nil { - return nil, false - } - - if o.LastModifiedDate == nil { + if o == nil || IsNil(o.LastModifiedDate) { return nil, false } return &o.LastModifiedDate.Time, true - -} - -// SetLastModifiedDate sets field value -func (o *S3KeyMetadata) SetLastModifiedDate(v time.Time) { - - o.LastModifiedDate = &IonosTime{v} - } // HasLastModifiedDate returns a boolean if a field has been set. func (o *S3KeyMetadata) HasLastModifiedDate() bool { - if o != nil && o.LastModifiedDate != nil { + if o != nil && !IsNil(o.LastModifiedDate) { return true } return false } -// GetLastModifiedBy returns the LastModifiedBy field value -// If the value is explicit nil, nil is returned -func (o *S3KeyMetadata) GetLastModifiedBy() *string { - if o == nil { - return nil - } - - return o.LastModifiedBy +// SetLastModifiedDate gets a reference to the given time.Time and assigns it to the LastModifiedDate field. +func (o *S3KeyMetadata) SetLastModifiedDate(v time.Time) { + o.LastModifiedDate = &IonosTime{v} +} +// GetLastModifiedBy returns the LastModifiedBy field value if set, zero value otherwise. +func (o *S3KeyMetadata) GetLastModifiedBy() string { + if o == nil || IsNil(o.LastModifiedBy) { + var ret string + return ret + } + return *o.LastModifiedBy } -// GetLastModifiedByOk returns a tuple with the LastModifiedBy field value +// GetLastModifiedByOk returns a tuple with the LastModifiedBy 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 *S3KeyMetadata) GetLastModifiedByOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.LastModifiedBy) { return nil, false } - return o.LastModifiedBy, true } -// SetLastModifiedBy sets field value -func (o *S3KeyMetadata) SetLastModifiedBy(v string) { - - o.LastModifiedBy = &v - -} - // HasLastModifiedBy returns a boolean if a field has been set. func (o *S3KeyMetadata) HasLastModifiedBy() bool { - if o != nil && o.LastModifiedBy != nil { + if o != nil && !IsNil(o.LastModifiedBy) { return true } return false } -// GetLastModifiedByUserId returns the LastModifiedByUserId field value -// If the value is explicit nil, nil is returned -func (o *S3KeyMetadata) GetLastModifiedByUserId() *string { - if o == nil { - return nil - } - - return o.LastModifiedByUserId +// SetLastModifiedBy gets a reference to the given string and assigns it to the LastModifiedBy field. +func (o *S3KeyMetadata) SetLastModifiedBy(v string) { + o.LastModifiedBy = &v +} +// GetLastModifiedByUserId returns the LastModifiedByUserId field value if set, zero value otherwise. +func (o *S3KeyMetadata) GetLastModifiedByUserId() string { + if o == nil || IsNil(o.LastModifiedByUserId) { + var ret string + return ret + } + return *o.LastModifiedByUserId } -// GetLastModifiedByUserIdOk returns a tuple with the LastModifiedByUserId field value +// GetLastModifiedByUserIdOk returns a tuple with the LastModifiedByUserId 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 *S3KeyMetadata) GetLastModifiedByUserIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.LastModifiedByUserId) { return nil, false } - return o.LastModifiedByUserId, true } -// SetLastModifiedByUserId sets field value -func (o *S3KeyMetadata) SetLastModifiedByUserId(v string) { - - o.LastModifiedByUserId = &v - -} - // HasLastModifiedByUserId returns a boolean if a field has been set. func (o *S3KeyMetadata) HasLastModifiedByUserId() bool { - if o != nil && o.LastModifiedByUserId != nil { + if o != nil && !IsNil(o.LastModifiedByUserId) { return true } return false } +// SetLastModifiedByUserId gets a reference to the given string and assigns it to the LastModifiedByUserId field. +func (o *S3KeyMetadata) SetLastModifiedByUserId(v string) { + o.LastModifiedByUserId = &v +} + func (o S3KeyMetadata) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o S3KeyMetadata) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Etag != nil { + if !IsNil(o.Etag) { toSerialize["etag"] = o.Etag } - - if o.CreatedDate != nil { + if !IsNil(o.CreatedDate) { toSerialize["createdDate"] = o.CreatedDate } - - if o.CreatedBy != nil { + if !IsNil(o.CreatedBy) { toSerialize["createdBy"] = o.CreatedBy } - - if o.CreatedByUserId != nil { + if !IsNil(o.CreatedByUserId) { toSerialize["createdByUserId"] = o.CreatedByUserId } - - if o.LastModifiedDate != nil { + if !IsNil(o.LastModifiedDate) { toSerialize["lastModifiedDate"] = o.LastModifiedDate } - - if o.LastModifiedBy != nil { + if !IsNil(o.LastModifiedBy) { toSerialize["lastModifiedBy"] = o.LastModifiedBy } - - if o.LastModifiedByUserId != nil { + if !IsNil(o.LastModifiedByUserId) { toSerialize["lastModifiedByUserId"] = o.LastModifiedByUserId } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableS3KeyMetadata struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_s3_key_properties.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_s3_key_properties.go similarity index 73% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_s3_key_properties.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_s3_key_properties.go index 08e6e6aaf..ae0b4582a 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_s3_key_properties.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_s3_key_properties.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the S3KeyProperties type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &S3KeyProperties{} + // S3KeyProperties struct for S3KeyProperties type S3KeyProperties struct { // Secret of the Object storage key. @@ -40,93 +43,87 @@ func NewS3KeyPropertiesWithDefaults() *S3KeyProperties { return &this } -// GetSecretKey returns the SecretKey field value -// If the value is explicit nil, nil is returned -func (o *S3KeyProperties) GetSecretKey() *string { - if o == nil { - return nil +// GetSecretKey returns the SecretKey field value if set, zero value otherwise. +func (o *S3KeyProperties) GetSecretKey() string { + if o == nil || IsNil(o.SecretKey) { + var ret string + return ret } - - return o.SecretKey - + return *o.SecretKey } -// GetSecretKeyOk returns a tuple with the SecretKey field value +// GetSecretKeyOk returns a tuple with the SecretKey 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 *S3KeyProperties) GetSecretKeyOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.SecretKey) { return nil, false } - return o.SecretKey, true } -// SetSecretKey sets field value -func (o *S3KeyProperties) SetSecretKey(v string) { - - o.SecretKey = &v - -} - // HasSecretKey returns a boolean if a field has been set. func (o *S3KeyProperties) HasSecretKey() bool { - if o != nil && o.SecretKey != nil { + if o != nil && !IsNil(o.SecretKey) { return true } return false } -// GetActive returns the Active field value -// If the value is explicit nil, nil is returned -func (o *S3KeyProperties) GetActive() *bool { - if o == nil { - return nil - } - - return o.Active +// SetSecretKey gets a reference to the given string and assigns it to the SecretKey field. +func (o *S3KeyProperties) SetSecretKey(v string) { + o.SecretKey = &v +} +// GetActive returns the Active field value if set, zero value otherwise. +func (o *S3KeyProperties) GetActive() bool { + if o == nil || IsNil(o.Active) { + var ret bool + return ret + } + return *o.Active } -// GetActiveOk returns a tuple with the Active field value +// GetActiveOk returns a tuple with the Active 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 *S3KeyProperties) GetActiveOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.Active) { return nil, false } - return o.Active, true } -// SetActive sets field value -func (o *S3KeyProperties) SetActive(v bool) { - - o.Active = &v - -} - // HasActive returns a boolean if a field has been set. func (o *S3KeyProperties) HasActive() bool { - if o != nil && o.Active != nil { + if o != nil && !IsNil(o.Active) { return true } return false } +// SetActive gets a reference to the given bool and assigns it to the Active field. +func (o *S3KeyProperties) SetActive(v bool) { + o.Active = &v +} + func (o S3KeyProperties) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o S3KeyProperties) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.SecretKey != nil { + if !IsNil(o.SecretKey) { toSerialize["secretKey"] = o.SecretKey } - - if o.Active != nil { + if !IsNil(o.Active) { toSerialize["active"] = o.Active } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableS3KeyProperties struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_s3_keys.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_s3_keys.go similarity index 64% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_s3_keys.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_s3_keys.go index 3dabbc499..fda2fe6dd 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_s3_keys.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_s3_keys.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the S3Keys type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &S3Keys{} + // S3Keys struct for S3Keys type S3Keys struct { // The resource's unique identifier. @@ -23,7 +26,7 @@ type S3Keys struct { // URL to the object representation (absolute path). Href *string `json:"href,omitempty"` // Array of items in the collection. - Items *[]S3Key `json:"items,omitempty"` + Items []S3Key `json:"items,omitempty"` } // NewS3Keys instantiates a new S3Keys object @@ -44,177 +47,157 @@ func NewS3KeysWithDefaults() *S3Keys { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *S3Keys) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *S3Keys) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *S3Keys) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *S3Keys) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *S3Keys) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *S3Keys) GetType() *Type { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *S3Keys) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *S3Keys) GetType() Type { + if o == nil || IsNil(o.Type) { + var ret Type + return ret + } + return *o.Type } -// GetTypeOk returns a tuple with the Type field value +// GetTypeOk returns a tuple with the Type 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 *S3Keys) GetTypeOk() (*Type, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *S3Keys) SetType(v Type) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *S3Keys) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *S3Keys) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given Type and assigns it to the Type field. +func (o *S3Keys) SetType(v Type) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *S3Keys) 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 +// GetHrefOk returns a tuple with the Href 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 *S3Keys) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *S3Keys) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *S3Keys) HasHref() bool { - if o != nil && o.Href != nil { + if o != nil && !IsNil(o.Href) { return true } return false } -// GetItems returns the Items field value -// If the value is explicit nil, nil is returned -func (o *S3Keys) GetItems() *[]S3Key { - if o == nil { - return nil - } +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *S3Keys) SetHref(v string) { + o.Href = &v +} +// GetItems returns the Items field value if set, zero value otherwise. +func (o *S3Keys) GetItems() []S3Key { + if o == nil || IsNil(o.Items) { + var ret []S3Key + return ret + } return o.Items - } -// GetItemsOk returns a tuple with the Items field value +// GetItemsOk returns a tuple with the Items 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 *S3Keys) GetItemsOk() (*[]S3Key, bool) { - if o == nil { +func (o *S3Keys) GetItemsOk() ([]S3Key, bool) { + if o == nil || IsNil(o.Items) { return nil, false } - return o.Items, true } -// SetItems sets field value -func (o *S3Keys) SetItems(v []S3Key) { - - o.Items = &v - -} - // HasItems returns a boolean if a field has been set. func (o *S3Keys) HasItems() bool { - if o != nil && o.Items != nil { + if o != nil && !IsNil(o.Items) { return true } return false } +// SetItems gets a reference to the given []S3Key and assigns it to the Items field. +func (o *S3Keys) SetItems(v []S3Key) { + o.Items = v +} + func (o S3Keys) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o S3Keys) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Items != nil { + if !IsNil(o.Items) { toSerialize["items"] = o.Items } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableS3Keys struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_s3_object_storage_sso.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_s3_object_storage_sso.go similarity index 78% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_s3_object_storage_sso.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_s3_object_storage_sso.go index 166367cea..fdf32bce1 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_s3_object_storage_sso.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_s3_object_storage_sso.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the S3ObjectStorageSSO type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &S3ObjectStorageSSO{} + // S3ObjectStorageSSO struct for S3ObjectStorageSSO type S3ObjectStorageSSO struct { // The Ionos object storage single sign on url @@ -38,51 +41,52 @@ func NewS3ObjectStorageSSOWithDefaults() *S3ObjectStorageSSO { return &this } -// GetSsoUrl returns the SsoUrl field value -// If the value is explicit nil, nil is returned -func (o *S3ObjectStorageSSO) GetSsoUrl() *string { - if o == nil { - return nil +// GetSsoUrl returns the SsoUrl field value if set, zero value otherwise. +func (o *S3ObjectStorageSSO) GetSsoUrl() string { + if o == nil || IsNil(o.SsoUrl) { + var ret string + return ret } - - return o.SsoUrl - + return *o.SsoUrl } -// GetSsoUrlOk returns a tuple with the SsoUrl field value +// GetSsoUrlOk returns a tuple with the SsoUrl 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 *S3ObjectStorageSSO) GetSsoUrlOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.SsoUrl) { return nil, false } - return o.SsoUrl, true } -// SetSsoUrl sets field value -func (o *S3ObjectStorageSSO) SetSsoUrl(v string) { - - o.SsoUrl = &v - -} - // HasSsoUrl returns a boolean if a field has been set. func (o *S3ObjectStorageSSO) HasSsoUrl() bool { - if o != nil && o.SsoUrl != nil { + if o != nil && !IsNil(o.SsoUrl) { return true } return false } +// SetSsoUrl gets a reference to the given string and assigns it to the SsoUrl field. +func (o *S3ObjectStorageSSO) SetSsoUrl(v string) { + o.SsoUrl = &v +} + func (o S3ObjectStorageSSO) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o S3ObjectStorageSSO) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.SsoUrl != nil { + if !IsNil(o.SsoUrl) { toSerialize["ssoUrl"] = o.SsoUrl } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableS3ObjectStorageSSO struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_security_group.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_security_group.go similarity index 63% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_security_group.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_security_group.go index a3bc27e6e..9e4772318 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_security_group.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_security_group.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the SecurityGroup type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SecurityGroup{} + // SecurityGroup struct for SecurityGroup type SecurityGroup struct { // The resource's unique identifier. @@ -23,7 +26,7 @@ type SecurityGroup struct { // The URL to the object representation (absolute path). Href *string `json:"href,omitempty"` Metadata *DatacenterElementMetadata `json:"metadata,omitempty"` - Properties *SecurityGroupProperties `json:"properties"` + Properties SecurityGroupProperties `json:"properties"` Entities *SecurityGroupEntities `json:"entities,omitempty"` } @@ -34,7 +37,7 @@ type SecurityGroup struct { func NewSecurityGroup(properties SecurityGroupProperties) *SecurityGroup { this := SecurityGroup{} - this.Properties = &properties + this.Properties = properties return &this } @@ -47,261 +50,217 @@ func NewSecurityGroupWithDefaults() *SecurityGroup { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *SecurityGroup) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *SecurityGroup) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *SecurityGroup) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *SecurityGroup) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *SecurityGroup) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *SecurityGroup) GetType() *Type { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *SecurityGroup) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *SecurityGroup) GetType() Type { + if o == nil || IsNil(o.Type) { + var ret Type + return ret + } + return *o.Type } -// GetTypeOk returns a tuple with the Type field value +// GetTypeOk returns a tuple with the Type 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 *SecurityGroup) GetTypeOk() (*Type, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *SecurityGroup) SetType(v Type) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *SecurityGroup) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *SecurityGroup) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given Type and assigns it to the Type field. +func (o *SecurityGroup) SetType(v Type) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *SecurityGroup) 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 +// GetHrefOk returns a tuple with the Href 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 *SecurityGroup) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *SecurityGroup) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *SecurityGroup) HasHref() bool { - if o != nil && o.Href != nil { + if o != nil && !IsNil(o.Href) { return true } return false } -// GetMetadata returns the Metadata field value -// If the value is explicit nil, nil is returned -func (o *SecurityGroup) GetMetadata() *DatacenterElementMetadata { - if o == nil { - return nil - } - - return o.Metadata +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *SecurityGroup) SetHref(v string) { + o.Href = &v +} +// GetMetadata returns the Metadata field value if set, zero value otherwise. +func (o *SecurityGroup) GetMetadata() DatacenterElementMetadata { + if o == nil || IsNil(o.Metadata) { + var ret DatacenterElementMetadata + return ret + } + return *o.Metadata } -// GetMetadataOk returns a tuple with the Metadata field value +// GetMetadataOk returns a tuple with the Metadata 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 *SecurityGroup) GetMetadataOk() (*DatacenterElementMetadata, bool) { - if o == nil { + if o == nil || IsNil(o.Metadata) { return nil, false } - return o.Metadata, true } -// SetMetadata sets field value -func (o *SecurityGroup) SetMetadata(v DatacenterElementMetadata) { - - o.Metadata = &v - -} - // HasMetadata returns a boolean if a field has been set. func (o *SecurityGroup) HasMetadata() bool { - if o != nil && o.Metadata != nil { + if o != nil && !IsNil(o.Metadata) { return true } return false } +// SetMetadata gets a reference to the given DatacenterElementMetadata and assigns it to the Metadata field. +func (o *SecurityGroup) SetMetadata(v DatacenterElementMetadata) { + o.Metadata = &v +} + // GetProperties returns the Properties field value -// If the value is explicit nil, nil is returned -func (o *SecurityGroup) GetProperties() *SecurityGroupProperties { +func (o *SecurityGroup) GetProperties() SecurityGroupProperties { if o == nil { - return nil + var ret SecurityGroupProperties + return ret } return o.Properties - } // GetPropertiesOk returns a tuple with the Properties field value // 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 *SecurityGroup) GetPropertiesOk() (*SecurityGroupProperties, bool) { if o == nil { return nil, false } - - return o.Properties, true + return &o.Properties, true } // SetProperties sets field value func (o *SecurityGroup) SetProperties(v SecurityGroupProperties) { - - o.Properties = &v - -} - -// HasProperties returns a boolean if a field has been set. -func (o *SecurityGroup) HasProperties() bool { - if o != nil && o.Properties != nil { - return true - } - - return false + o.Properties = v } -// GetEntities returns the Entities field value -// If the value is explicit nil, nil is returned -func (o *SecurityGroup) GetEntities() *SecurityGroupEntities { - if o == nil { - return nil +// GetEntities returns the Entities field value if set, zero value otherwise. +func (o *SecurityGroup) GetEntities() SecurityGroupEntities { + if o == nil || IsNil(o.Entities) { + var ret SecurityGroupEntities + return ret } - - return o.Entities - + return *o.Entities } -// GetEntitiesOk returns a tuple with the Entities field value +// GetEntitiesOk returns a tuple with the Entities 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 *SecurityGroup) GetEntitiesOk() (*SecurityGroupEntities, bool) { - if o == nil { + if o == nil || IsNil(o.Entities) { return nil, false } - return o.Entities, true } -// SetEntities sets field value -func (o *SecurityGroup) SetEntities(v SecurityGroupEntities) { - - o.Entities = &v - -} - // HasEntities returns a boolean if a field has been set. func (o *SecurityGroup) HasEntities() bool { - if o != nil && o.Entities != nil { + if o != nil && !IsNil(o.Entities) { return true } return false } +// SetEntities gets a reference to the given SecurityGroupEntities and assigns it to the Entities field. +func (o *SecurityGroup) SetEntities(v SecurityGroupEntities) { + o.Entities = &v +} + func (o SecurityGroup) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o SecurityGroup) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Metadata != nil { + if !IsNil(o.Metadata) { toSerialize["metadata"] = o.Metadata } - - if o.Properties != nil { - toSerialize["properties"] = o.Properties - } - - if o.Entities != nil { + toSerialize["properties"] = o.Properties + if !IsNil(o.Entities) { toSerialize["entities"] = o.Entities } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableSecurityGroup struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_security_group_entities.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_security_group_entities.go similarity index 69% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_security_group_entities.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_security_group_entities.go index a861d1700..a05879e7e 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_security_group_entities.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_security_group_entities.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the SecurityGroupEntities type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SecurityGroupEntities{} + // SecurityGroupEntities struct for SecurityGroupEntities type SecurityGroupEntities struct { Rules *FirewallRules `json:"rules,omitempty"` @@ -39,135 +42,122 @@ func NewSecurityGroupEntitiesWithDefaults() *SecurityGroupEntities { return &this } -// GetRules returns the Rules field value -// If the value is explicit nil, nil is returned -func (o *SecurityGroupEntities) GetRules() *FirewallRules { - if o == nil { - return nil +// GetRules returns the Rules field value if set, zero value otherwise. +func (o *SecurityGroupEntities) GetRules() FirewallRules { + if o == nil || IsNil(o.Rules) { + var ret FirewallRules + return ret } - - return o.Rules - + return *o.Rules } -// GetRulesOk returns a tuple with the Rules field value +// GetRulesOk returns a tuple with the Rules 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 *SecurityGroupEntities) GetRulesOk() (*FirewallRules, bool) { - if o == nil { + if o == nil || IsNil(o.Rules) { return nil, false } - return o.Rules, true } -// SetRules sets field value -func (o *SecurityGroupEntities) SetRules(v FirewallRules) { - - o.Rules = &v - -} - // HasRules returns a boolean if a field has been set. func (o *SecurityGroupEntities) HasRules() bool { - if o != nil && o.Rules != nil { + if o != nil && !IsNil(o.Rules) { return true } return false } -// GetNics returns the Nics field value -// If the value is explicit nil, nil is returned -func (o *SecurityGroupEntities) GetNics() *Nics { - if o == nil { - return nil - } - - return o.Nics +// SetRules gets a reference to the given FirewallRules and assigns it to the Rules field. +func (o *SecurityGroupEntities) SetRules(v FirewallRules) { + o.Rules = &v +} +// GetNics returns the Nics field value if set, zero value otherwise. +func (o *SecurityGroupEntities) GetNics() Nics { + if o == nil || IsNil(o.Nics) { + var ret Nics + return ret + } + return *o.Nics } -// GetNicsOk returns a tuple with the Nics field value +// GetNicsOk returns a tuple with the Nics 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 *SecurityGroupEntities) GetNicsOk() (*Nics, bool) { - if o == nil { + if o == nil || IsNil(o.Nics) { return nil, false } - return o.Nics, true } -// SetNics sets field value -func (o *SecurityGroupEntities) SetNics(v Nics) { - - o.Nics = &v - -} - // HasNics returns a boolean if a field has been set. func (o *SecurityGroupEntities) HasNics() bool { - if o != nil && o.Nics != nil { + if o != nil && !IsNil(o.Nics) { return true } return false } -// GetServers returns the Servers field value -// If the value is explicit nil, nil is returned -func (o *SecurityGroupEntities) GetServers() *Servers { - if o == nil { - return nil - } - - return o.Servers +// SetNics gets a reference to the given Nics and assigns it to the Nics field. +func (o *SecurityGroupEntities) SetNics(v Nics) { + o.Nics = &v +} +// GetServers returns the Servers field value if set, zero value otherwise. +func (o *SecurityGroupEntities) GetServers() Servers { + if o == nil || IsNil(o.Servers) { + var ret Servers + return ret + } + return *o.Servers } -// GetServersOk returns a tuple with the Servers field value +// GetServersOk returns a tuple with the Servers 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 *SecurityGroupEntities) GetServersOk() (*Servers, bool) { - if o == nil { + if o == nil || IsNil(o.Servers) { return nil, false } - return o.Servers, true } -// SetServers sets field value -func (o *SecurityGroupEntities) SetServers(v Servers) { - - o.Servers = &v - -} - // HasServers returns a boolean if a field has been set. func (o *SecurityGroupEntities) HasServers() bool { - if o != nil && o.Servers != nil { + if o != nil && !IsNil(o.Servers) { return true } return false } +// SetServers gets a reference to the given Servers and assigns it to the Servers field. +func (o *SecurityGroupEntities) SetServers(v Servers) { + o.Servers = &v +} + func (o SecurityGroupEntities) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o SecurityGroupEntities) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Rules != nil { + if !IsNil(o.Rules) { toSerialize["rules"] = o.Rules } - - if o.Nics != nil { + if !IsNil(o.Nics) { toSerialize["nics"] = o.Nics } - - if o.Servers != nil { + if !IsNil(o.Servers) { toSerialize["servers"] = o.Servers } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableSecurityGroupEntities struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_security_group_entities_request.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_security_group_entities_request.go similarity index 79% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_security_group_entities_request.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_security_group_entities_request.go index 73896bbae..89bc05f10 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_security_group_entities_request.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_security_group_entities_request.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the SecurityGroupEntitiesRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SecurityGroupEntitiesRequest{} + // SecurityGroupEntitiesRequest struct for SecurityGroupEntitiesRequest type SecurityGroupEntitiesRequest struct { Rules *FirewallRules `json:"rules,omitempty"` @@ -37,51 +40,52 @@ func NewSecurityGroupEntitiesRequestWithDefaults() *SecurityGroupEntitiesRequest return &this } -// GetRules returns the Rules field value -// If the value is explicit nil, nil is returned -func (o *SecurityGroupEntitiesRequest) GetRules() *FirewallRules { - if o == nil { - return nil +// GetRules returns the Rules field value if set, zero value otherwise. +func (o *SecurityGroupEntitiesRequest) GetRules() FirewallRules { + if o == nil || IsNil(o.Rules) { + var ret FirewallRules + return ret } - - return o.Rules - + return *o.Rules } -// GetRulesOk returns a tuple with the Rules field value +// GetRulesOk returns a tuple with the Rules 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 *SecurityGroupEntitiesRequest) GetRulesOk() (*FirewallRules, bool) { - if o == nil { + if o == nil || IsNil(o.Rules) { return nil, false } - return o.Rules, true } -// SetRules sets field value -func (o *SecurityGroupEntitiesRequest) SetRules(v FirewallRules) { - - o.Rules = &v - -} - // HasRules returns a boolean if a field has been set. func (o *SecurityGroupEntitiesRequest) HasRules() bool { - if o != nil && o.Rules != nil { + if o != nil && !IsNil(o.Rules) { return true } return false } +// SetRules gets a reference to the given FirewallRules and assigns it to the Rules field. +func (o *SecurityGroupEntitiesRequest) SetRules(v FirewallRules) { + o.Rules = &v +} + func (o SecurityGroupEntitiesRequest) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o SecurityGroupEntitiesRequest) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Rules != nil { + if !IsNil(o.Rules) { toSerialize["rules"] = o.Rules } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableSecurityGroupEntitiesRequest struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_security_group_properties.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_security_group_properties.go similarity index 78% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_security_group_properties.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_security_group_properties.go index 9e5908835..2ec2f161b 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_security_group_properties.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_security_group_properties.go @@ -14,10 +14,13 @@ import ( "encoding/json" ) +// checks if the SecurityGroupProperties type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SecurityGroupProperties{} + // SecurityGroupProperties struct for SecurityGroupProperties type SecurityGroupProperties struct { // The name of the security group. - Name *string `json:"name"` + Name string `json:"name"` // The description of the security group. Description *string `json:"description,omitempty"` } @@ -29,7 +32,7 @@ type SecurityGroupProperties struct { func NewSecurityGroupProperties(name string) *SecurityGroupProperties { this := SecurityGroupProperties{} - this.Name = &name + this.Name = name return &this } @@ -43,92 +46,76 @@ func NewSecurityGroupPropertiesWithDefaults() *SecurityGroupProperties { } // GetName returns the Name field value -// If the value is explicit nil, nil is returned -func (o *SecurityGroupProperties) GetName() *string { +func (o *SecurityGroupProperties) GetName() string { if o == nil { - return 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. -// NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *SecurityGroupProperties) GetNameOk() (*string, bool) { if o == nil { return nil, false } - - return o.Name, true + return &o.Name, true } // SetName sets field value func (o *SecurityGroupProperties) SetName(v string) { - - o.Name = &v - -} - -// HasName returns a boolean if a field has been set. -func (o *SecurityGroupProperties) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false + o.Name = v } -// GetDescription returns the Description field value -// If the value is explicit nil, nil is returned -func (o *SecurityGroupProperties) GetDescription() *string { - if o == nil { - return nil +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *SecurityGroupProperties) GetDescription() string { + if o == nil || IsNil(o.Description) { + var ret string + return ret } - - return o.Description - + return *o.Description } -// GetDescriptionOk returns a tuple with the Description field value +// GetDescriptionOk returns a tuple with the Description 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 *SecurityGroupProperties) GetDescriptionOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Description) { return nil, false } - return o.Description, true } -// SetDescription sets field value -func (o *SecurityGroupProperties) SetDescription(v string) { - - o.Description = &v - -} - // HasDescription returns a boolean if a field has been set. func (o *SecurityGroupProperties) HasDescription() bool { - if o != nil && o.Description != nil { + 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 *SecurityGroupProperties) SetDescription(v string) { + o.Description = &v +} + func (o SecurityGroupProperties) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.Name != nil { - toSerialize["name"] = o.Name + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } + return json.Marshal(toSerialize) +} - if o.Description != nil { +func (o SecurityGroupProperties) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["name"] = o.Name + if !IsNil(o.Description) { toSerialize["description"] = o.Description } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableSecurityGroupProperties struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_security_group_request.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_security_group_request.go similarity index 74% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_security_group_request.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_security_group_request.go index 6b569e359..7102645e0 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_security_group_request.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_security_group_request.go @@ -14,9 +14,12 @@ import ( "encoding/json" ) +// checks if the SecurityGroupRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SecurityGroupRequest{} + // SecurityGroupRequest struct for SecurityGroupRequest type SecurityGroupRequest struct { - Properties *SecurityGroupProperties `json:"properties"` + Properties SecurityGroupProperties `json:"properties"` Entities *SecurityGroupEntitiesRequest `json:"entities,omitempty"` } @@ -27,7 +30,7 @@ type SecurityGroupRequest struct { func NewSecurityGroupRequest(properties SecurityGroupProperties) *SecurityGroupRequest { this := SecurityGroupRequest{} - this.Properties = &properties + this.Properties = properties return &this } @@ -41,92 +44,76 @@ func NewSecurityGroupRequestWithDefaults() *SecurityGroupRequest { } // GetProperties returns the Properties field value -// If the value is explicit nil, nil is returned -func (o *SecurityGroupRequest) GetProperties() *SecurityGroupProperties { +func (o *SecurityGroupRequest) GetProperties() SecurityGroupProperties { if o == nil { - return nil + var ret SecurityGroupProperties + return ret } return o.Properties - } // GetPropertiesOk returns a tuple with the Properties field value // 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 *SecurityGroupRequest) GetPropertiesOk() (*SecurityGroupProperties, bool) { if o == nil { return nil, false } - - return o.Properties, true + return &o.Properties, true } // SetProperties sets field value func (o *SecurityGroupRequest) SetProperties(v SecurityGroupProperties) { - - o.Properties = &v - -} - -// HasProperties returns a boolean if a field has been set. -func (o *SecurityGroupRequest) HasProperties() bool { - if o != nil && o.Properties != nil { - return true - } - - return false + o.Properties = v } -// GetEntities returns the Entities field value -// If the value is explicit nil, nil is returned -func (o *SecurityGroupRequest) GetEntities() *SecurityGroupEntitiesRequest { - if o == nil { - return nil +// GetEntities returns the Entities field value if set, zero value otherwise. +func (o *SecurityGroupRequest) GetEntities() SecurityGroupEntitiesRequest { + if o == nil || IsNil(o.Entities) { + var ret SecurityGroupEntitiesRequest + return ret } - - return o.Entities - + return *o.Entities } -// GetEntitiesOk returns a tuple with the Entities field value +// GetEntitiesOk returns a tuple with the Entities 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 *SecurityGroupRequest) GetEntitiesOk() (*SecurityGroupEntitiesRequest, bool) { - if o == nil { + if o == nil || IsNil(o.Entities) { return nil, false } - return o.Entities, true } -// SetEntities sets field value -func (o *SecurityGroupRequest) SetEntities(v SecurityGroupEntitiesRequest) { - - o.Entities = &v - -} - // HasEntities returns a boolean if a field has been set. func (o *SecurityGroupRequest) HasEntities() bool { - if o != nil && o.Entities != nil { + if o != nil && !IsNil(o.Entities) { return true } return false } +// SetEntities gets a reference to the given SecurityGroupEntitiesRequest and assigns it to the Entities field. +func (o *SecurityGroupRequest) SetEntities(v SecurityGroupEntitiesRequest) { + o.Entities = &v +} + func (o SecurityGroupRequest) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.Properties != nil { - toSerialize["properties"] = o.Properties + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } + return json.Marshal(toSerialize) +} - if o.Entities != nil { +func (o SecurityGroupRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["properties"] = o.Properties + if !IsNil(o.Entities) { toSerialize["entities"] = o.Entities } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableSecurityGroupRequest struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_security_groups.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_security_groups.go similarity index 60% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_security_groups.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_security_groups.go index 27b74dabe..8585104df 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_security_groups.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_security_groups.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the SecurityGroups type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SecurityGroups{} + // SecurityGroups struct for SecurityGroups type SecurityGroups struct { // The resource's unique identifier. @@ -23,7 +26,7 @@ type SecurityGroups struct { // The URL to the object representation (absolute path). Href *string `json:"href,omitempty"` // Array of items in the collection. - Items *[]SecurityGroup `json:"items,omitempty"` + Items []SecurityGroup `json:"items,omitempty"` // The offset (if specified in the request). Offset *float32 `json:"offset,omitempty"` // The limit (if specified in the request). @@ -49,303 +52,262 @@ func NewSecurityGroupsWithDefaults() *SecurityGroups { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *SecurityGroups) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *SecurityGroups) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *SecurityGroups) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *SecurityGroups) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *SecurityGroups) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *SecurityGroups) GetType() *Type { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *SecurityGroups) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *SecurityGroups) GetType() Type { + if o == nil || IsNil(o.Type) { + var ret Type + return ret + } + return *o.Type } -// GetTypeOk returns a tuple with the Type field value +// GetTypeOk returns a tuple with the Type 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 *SecurityGroups) GetTypeOk() (*Type, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *SecurityGroups) SetType(v Type) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *SecurityGroups) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *SecurityGroups) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given Type and assigns it to the Type field. +func (o *SecurityGroups) SetType(v Type) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *SecurityGroups) 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 +// GetHrefOk returns a tuple with the Href 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 *SecurityGroups) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *SecurityGroups) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *SecurityGroups) HasHref() bool { - if o != nil && o.Href != nil { + if o != nil && !IsNil(o.Href) { return true } return false } -// GetItems returns the Items field value -// If the value is explicit nil, nil is returned -func (o *SecurityGroups) GetItems() *[]SecurityGroup { - if o == nil { - return nil - } +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *SecurityGroups) SetHref(v string) { + o.Href = &v +} +// GetItems returns the Items field value if set, zero value otherwise. +func (o *SecurityGroups) GetItems() []SecurityGroup { + if o == nil || IsNil(o.Items) { + var ret []SecurityGroup + return ret + } return o.Items - } -// GetItemsOk returns a tuple with the Items field value +// GetItemsOk returns a tuple with the Items 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 *SecurityGroups) GetItemsOk() (*[]SecurityGroup, bool) { - if o == nil { +func (o *SecurityGroups) GetItemsOk() ([]SecurityGroup, bool) { + if o == nil || IsNil(o.Items) { return nil, false } - return o.Items, true } -// SetItems sets field value -func (o *SecurityGroups) SetItems(v []SecurityGroup) { - - o.Items = &v - -} - // HasItems returns a boolean if a field has been set. func (o *SecurityGroups) HasItems() bool { - if o != nil && o.Items != nil { + if o != nil && !IsNil(o.Items) { return true } return false } -// GetOffset returns the Offset field value -// If the value is explicit nil, nil is returned -func (o *SecurityGroups) GetOffset() *float32 { - if o == nil { - return nil - } - - return o.Offset +// SetItems gets a reference to the given []SecurityGroup and assigns it to the Items field. +func (o *SecurityGroups) SetItems(v []SecurityGroup) { + o.Items = v +} +// GetOffset returns the Offset field value if set, zero value otherwise. +func (o *SecurityGroups) GetOffset() float32 { + if o == nil || IsNil(o.Offset) { + var ret float32 + return ret + } + return *o.Offset } -// GetOffsetOk returns a tuple with the Offset field value +// GetOffsetOk returns a tuple with the Offset 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 *SecurityGroups) GetOffsetOk() (*float32, bool) { - if o == nil { + if o == nil || IsNil(o.Offset) { return nil, false } - return o.Offset, true } -// SetOffset sets field value -func (o *SecurityGroups) SetOffset(v float32) { - - o.Offset = &v - -} - // HasOffset returns a boolean if a field has been set. func (o *SecurityGroups) HasOffset() bool { - if o != nil && o.Offset != nil { + if o != nil && !IsNil(o.Offset) { return true } return false } -// GetLimit returns the Limit field value -// If the value is explicit nil, nil is returned -func (o *SecurityGroups) GetLimit() *float32 { - if o == nil { - return nil - } - - return o.Limit +// SetOffset gets a reference to the given float32 and assigns it to the Offset field. +func (o *SecurityGroups) SetOffset(v float32) { + o.Offset = &v +} +// GetLimit returns the Limit field value if set, zero value otherwise. +func (o *SecurityGroups) GetLimit() float32 { + if o == nil || IsNil(o.Limit) { + var ret float32 + return ret + } + return *o.Limit } -// GetLimitOk returns a tuple with the Limit field value +// GetLimitOk returns a tuple with the Limit 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 *SecurityGroups) GetLimitOk() (*float32, bool) { - if o == nil { + if o == nil || IsNil(o.Limit) { return nil, false } - return o.Limit, true } -// SetLimit sets field value -func (o *SecurityGroups) SetLimit(v float32) { - - o.Limit = &v - -} - // HasLimit returns a boolean if a field has been set. func (o *SecurityGroups) HasLimit() bool { - if o != nil && o.Limit != nil { + if o != nil && !IsNil(o.Limit) { return true } return false } -// GetLinks returns the Links field value -// If the value is explicit nil, nil is returned -func (o *SecurityGroups) GetLinks() *PaginationLinks { - if o == nil { - return nil - } - - return o.Links +// SetLimit gets a reference to the given float32 and assigns it to the Limit field. +func (o *SecurityGroups) SetLimit(v float32) { + o.Limit = &v +} +// GetLinks returns the Links field value if set, zero value otherwise. +func (o *SecurityGroups) GetLinks() PaginationLinks { + if o == nil || IsNil(o.Links) { + var ret PaginationLinks + return ret + } + return *o.Links } -// GetLinksOk returns a tuple with the Links field value +// GetLinksOk returns a tuple with the Links 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 *SecurityGroups) GetLinksOk() (*PaginationLinks, bool) { - if o == nil { + if o == nil || IsNil(o.Links) { return nil, false } - return o.Links, true } -// SetLinks sets field value -func (o *SecurityGroups) SetLinks(v PaginationLinks) { - - o.Links = &v - -} - // HasLinks returns a boolean if a field has been set. func (o *SecurityGroups) HasLinks() bool { - if o != nil && o.Links != nil { + if o != nil && !IsNil(o.Links) { return true } return false } +// SetLinks gets a reference to the given PaginationLinks and assigns it to the Links field. +func (o *SecurityGroups) SetLinks(v PaginationLinks) { + o.Links = &v +} + func (o SecurityGroups) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o SecurityGroups) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Items != nil { + if !IsNil(o.Items) { toSerialize["items"] = o.Items } - - if o.Offset != nil { + if !IsNil(o.Offset) { toSerialize["offset"] = o.Offset } - - if o.Limit != nil { + if !IsNil(o.Limit) { toSerialize["limit"] = o.Limit } - - if o.Links != nil { + if !IsNil(o.Links) { toSerialize["_links"] = o.Links } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableSecurityGroups struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_server.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_server.go similarity index 62% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_server.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_server.go index d521f9a1d..0cd1173b7 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_server.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_server.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the Server type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Server{} + // Server struct for Server type Server struct { // The resource's unique identifier. @@ -23,7 +26,7 @@ type Server struct { // URL to the object representation (absolute path). Href *string `json:"href,omitempty"` Metadata *DatacenterElementMetadata `json:"metadata,omitempty"` - Properties *ServerProperties `json:"properties"` + Properties ServerProperties `json:"properties"` Entities *ServerEntities `json:"entities,omitempty"` } @@ -34,7 +37,7 @@ type Server struct { func NewServer(properties ServerProperties) *Server { this := Server{} - this.Properties = &properties + this.Properties = properties return &this } @@ -47,261 +50,217 @@ func NewServerWithDefaults() *Server { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *Server) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *Server) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *Server) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *Server) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *Server) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *Server) GetType() *Type { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Server) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *Server) GetType() Type { + if o == nil || IsNil(o.Type) { + var ret Type + return ret + } + return *o.Type } -// GetTypeOk returns a tuple with the Type field value +// GetTypeOk returns a tuple with the Type 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 *Server) GetTypeOk() (*Type, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *Server) SetType(v Type) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *Server) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *Server) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given Type and assigns it to the Type field. +func (o *Server) SetType(v Type) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *Server) 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 +// GetHrefOk returns a tuple with the Href 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 *Server) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *Server) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *Server) HasHref() bool { - if o != nil && o.Href != nil { + if o != nil && !IsNil(o.Href) { return true } return false } -// GetMetadata returns the Metadata field value -// If the value is explicit nil, nil is returned -func (o *Server) GetMetadata() *DatacenterElementMetadata { - if o == nil { - return nil - } - - return o.Metadata +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *Server) SetHref(v string) { + o.Href = &v +} +// GetMetadata returns the Metadata field value if set, zero value otherwise. +func (o *Server) GetMetadata() DatacenterElementMetadata { + if o == nil || IsNil(o.Metadata) { + var ret DatacenterElementMetadata + return ret + } + return *o.Metadata } -// GetMetadataOk returns a tuple with the Metadata field value +// GetMetadataOk returns a tuple with the Metadata 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 *Server) GetMetadataOk() (*DatacenterElementMetadata, bool) { - if o == nil { + if o == nil || IsNil(o.Metadata) { return nil, false } - return o.Metadata, true } -// SetMetadata sets field value -func (o *Server) SetMetadata(v DatacenterElementMetadata) { - - o.Metadata = &v - -} - // HasMetadata returns a boolean if a field has been set. func (o *Server) HasMetadata() bool { - if o != nil && o.Metadata != nil { + if o != nil && !IsNil(o.Metadata) { return true } return false } +// SetMetadata gets a reference to the given DatacenterElementMetadata and assigns it to the Metadata field. +func (o *Server) SetMetadata(v DatacenterElementMetadata) { + o.Metadata = &v +} + // GetProperties returns the Properties field value -// If the value is explicit nil, nil is returned -func (o *Server) GetProperties() *ServerProperties { +func (o *Server) GetProperties() ServerProperties { if o == nil { - return nil + var ret ServerProperties + return ret } return o.Properties - } // GetPropertiesOk returns a tuple with the Properties field value // 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 *Server) GetPropertiesOk() (*ServerProperties, bool) { if o == nil { return nil, false } - - return o.Properties, true + return &o.Properties, true } // SetProperties sets field value func (o *Server) SetProperties(v ServerProperties) { - - o.Properties = &v - -} - -// HasProperties returns a boolean if a field has been set. -func (o *Server) HasProperties() bool { - if o != nil && o.Properties != nil { - return true - } - - return false + o.Properties = v } -// GetEntities returns the Entities field value -// If the value is explicit nil, nil is returned -func (o *Server) GetEntities() *ServerEntities { - if o == nil { - return nil +// GetEntities returns the Entities field value if set, zero value otherwise. +func (o *Server) GetEntities() ServerEntities { + if o == nil || IsNil(o.Entities) { + var ret ServerEntities + return ret } - - return o.Entities - + return *o.Entities } -// GetEntitiesOk returns a tuple with the Entities field value +// GetEntitiesOk returns a tuple with the Entities 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 *Server) GetEntitiesOk() (*ServerEntities, bool) { - if o == nil { + if o == nil || IsNil(o.Entities) { return nil, false } - return o.Entities, true } -// SetEntities sets field value -func (o *Server) SetEntities(v ServerEntities) { - - o.Entities = &v - -} - // HasEntities returns a boolean if a field has been set. func (o *Server) HasEntities() bool { - if o != nil && o.Entities != nil { + if o != nil && !IsNil(o.Entities) { return true } return false } +// SetEntities gets a reference to the given ServerEntities and assigns it to the Entities field. +func (o *Server) SetEntities(v ServerEntities) { + o.Entities = &v +} + func (o Server) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Server) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Metadata != nil { + if !IsNil(o.Metadata) { toSerialize["metadata"] = o.Metadata } - - if o.Properties != nil { - toSerialize["properties"] = o.Properties - } - - if o.Entities != nil { + toSerialize["properties"] = o.Properties + if !IsNil(o.Entities) { toSerialize["entities"] = o.Entities } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableServer struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_server_entities.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_server_entities.go similarity index 65% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_server_entities.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_server_entities.go index d888bead7..bf34b54f0 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_server_entities.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_server_entities.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the ServerEntities type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ServerEntities{} + // ServerEntities struct for ServerEntities type ServerEntities struct { Cdroms *Cdroms `json:"cdroms,omitempty"` @@ -40,177 +43,157 @@ func NewServerEntitiesWithDefaults() *ServerEntities { return &this } -// GetCdroms returns the Cdroms field value -// If the value is explicit nil, nil is returned -func (o *ServerEntities) GetCdroms() *Cdroms { - if o == nil { - return nil +// GetCdroms returns the Cdroms field value if set, zero value otherwise. +func (o *ServerEntities) GetCdroms() Cdroms { + if o == nil || IsNil(o.Cdroms) { + var ret Cdroms + return ret } - - return o.Cdroms - + return *o.Cdroms } -// GetCdromsOk returns a tuple with the Cdroms field value +// GetCdromsOk returns a tuple with the Cdroms 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 *ServerEntities) GetCdromsOk() (*Cdroms, bool) { - if o == nil { + if o == nil || IsNil(o.Cdroms) { return nil, false } - return o.Cdroms, true } -// SetCdroms sets field value -func (o *ServerEntities) SetCdroms(v Cdroms) { - - o.Cdroms = &v - -} - // HasCdroms returns a boolean if a field has been set. func (o *ServerEntities) HasCdroms() bool { - if o != nil && o.Cdroms != nil { + if o != nil && !IsNil(o.Cdroms) { return true } return false } -// GetVolumes returns the Volumes field value -// If the value is explicit nil, nil is returned -func (o *ServerEntities) GetVolumes() *AttachedVolumes { - if o == nil { - return nil - } - - return o.Volumes +// SetCdroms gets a reference to the given Cdroms and assigns it to the Cdroms field. +func (o *ServerEntities) SetCdroms(v Cdroms) { + o.Cdroms = &v +} +// GetVolumes returns the Volumes field value if set, zero value otherwise. +func (o *ServerEntities) GetVolumes() AttachedVolumes { + if o == nil || IsNil(o.Volumes) { + var ret AttachedVolumes + return ret + } + return *o.Volumes } -// GetVolumesOk returns a tuple with the Volumes field value +// GetVolumesOk returns a tuple with the Volumes 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 *ServerEntities) GetVolumesOk() (*AttachedVolumes, bool) { - if o == nil { + if o == nil || IsNil(o.Volumes) { return nil, false } - return o.Volumes, true } -// SetVolumes sets field value -func (o *ServerEntities) SetVolumes(v AttachedVolumes) { - - o.Volumes = &v - -} - // HasVolumes returns a boolean if a field has been set. func (o *ServerEntities) HasVolumes() bool { - if o != nil && o.Volumes != nil { + if o != nil && !IsNil(o.Volumes) { return true } return false } -// GetNics returns the Nics field value -// If the value is explicit nil, nil is returned -func (o *ServerEntities) GetNics() *Nics { - if o == nil { - return nil - } - - return o.Nics +// SetVolumes gets a reference to the given AttachedVolumes and assigns it to the Volumes field. +func (o *ServerEntities) SetVolumes(v AttachedVolumes) { + o.Volumes = &v +} +// GetNics returns the Nics field value if set, zero value otherwise. +func (o *ServerEntities) GetNics() Nics { + if o == nil || IsNil(o.Nics) { + var ret Nics + return ret + } + return *o.Nics } -// GetNicsOk returns a tuple with the Nics field value +// GetNicsOk returns a tuple with the Nics 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 *ServerEntities) GetNicsOk() (*Nics, bool) { - if o == nil { + if o == nil || IsNil(o.Nics) { return nil, false } - return o.Nics, true } -// SetNics sets field value -func (o *ServerEntities) SetNics(v Nics) { - - o.Nics = &v - -} - // HasNics returns a boolean if a field has been set. func (o *ServerEntities) HasNics() bool { - if o != nil && o.Nics != nil { + if o != nil && !IsNil(o.Nics) { return true } return false } -// GetSecuritygroups returns the Securitygroups field value -// If the value is explicit nil, nil is returned -func (o *ServerEntities) GetSecuritygroups() *SecurityGroups { - if o == nil { - return nil - } - - return o.Securitygroups +// SetNics gets a reference to the given Nics and assigns it to the Nics field. +func (o *ServerEntities) SetNics(v Nics) { + o.Nics = &v +} +// GetSecuritygroups returns the Securitygroups field value if set, zero value otherwise. +func (o *ServerEntities) GetSecuritygroups() SecurityGroups { + if o == nil || IsNil(o.Securitygroups) { + var ret SecurityGroups + return ret + } + return *o.Securitygroups } -// GetSecuritygroupsOk returns a tuple with the Securitygroups field value +// GetSecuritygroupsOk returns a tuple with the Securitygroups 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 *ServerEntities) GetSecuritygroupsOk() (*SecurityGroups, bool) { - if o == nil { + if o == nil || IsNil(o.Securitygroups) { return nil, false } - return o.Securitygroups, true } -// SetSecuritygroups sets field value -func (o *ServerEntities) SetSecuritygroups(v SecurityGroups) { - - o.Securitygroups = &v - -} - // HasSecuritygroups returns a boolean if a field has been set. func (o *ServerEntities) HasSecuritygroups() bool { - if o != nil && o.Securitygroups != nil { + if o != nil && !IsNil(o.Securitygroups) { return true } return false } +// SetSecuritygroups gets a reference to the given SecurityGroups and assigns it to the Securitygroups field. +func (o *ServerEntities) SetSecuritygroups(v SecurityGroups) { + o.Securitygroups = &v +} + func (o ServerEntities) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ServerEntities) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Cdroms != nil { + if !IsNil(o.Cdroms) { toSerialize["cdroms"] = o.Cdroms } - - if o.Volumes != nil { + if !IsNil(o.Volumes) { toSerialize["volumes"] = o.Volumes } - - if o.Nics != nil { + if !IsNil(o.Nics) { toSerialize["nics"] = o.Nics } - - if o.Securitygroups != nil { + if !IsNil(o.Securitygroups) { toSerialize["securitygroups"] = o.Securitygroups } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableServerEntities struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_server_properties.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_server_properties.go similarity index 56% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_server_properties.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_server_properties.go index 094c1df55..5e69458cb 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_server_properties.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_server_properties.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the ServerProperties type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ServerProperties{} + // ServerProperties struct for ServerProperties type ServerProperties struct { // The ID of the template for creating a CUBE server; the available templates for CUBE servers can be found on the templates resource. @@ -38,6 +41,8 @@ type ServerProperties struct { Type *string `json:"type,omitempty"` // The placement group ID that belongs to this server; Requires system privileges, for internal usage only PlacementGroupId *string `json:"placementGroupId,omitempty"` + // Activate or deactivate the Multi Queue feature on all NICs of this server. This feature is beneficial to enable when the NICs are experiencing performance issues (e.g. low throughput). Toggling this feature will also initiate a restart of the server. If the specified value is `true`, the feature will be activated; if it is not specified or set to `false`, the feature will be deactivated. It is not allowed for servers of type Cube. + NicMultiQueue *bool `json:"nicMultiQueue,omitempty"` } // NewServerProperties instantiates a new ServerProperties object @@ -47,6 +52,9 @@ type ServerProperties struct { func NewServerProperties() *ServerProperties { this := ServerProperties{} + var nicMultiQueue bool = false + this.NicMultiQueue = &nicMultiQueue + return &this } @@ -55,516 +63,477 @@ func NewServerProperties() *ServerProperties { // but it doesn't guarantee that properties required by API are set func NewServerPropertiesWithDefaults() *ServerProperties { this := ServerProperties{} + var nicMultiQueue bool = false + this.NicMultiQueue = &nicMultiQueue return &this } -// GetTemplateUuid returns the TemplateUuid field value -// If the value is explicit nil, nil is returned -func (o *ServerProperties) GetTemplateUuid() *string { - if o == nil { - return nil +// GetTemplateUuid returns the TemplateUuid field value if set, zero value otherwise. +func (o *ServerProperties) GetTemplateUuid() string { + if o == nil || IsNil(o.TemplateUuid) { + var ret string + return ret } - - return o.TemplateUuid - + return *o.TemplateUuid } -// GetTemplateUuidOk returns a tuple with the TemplateUuid field value +// GetTemplateUuidOk returns a tuple with the TemplateUuid 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 *ServerProperties) GetTemplateUuidOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.TemplateUuid) { return nil, false } - return o.TemplateUuid, true } -// SetTemplateUuid sets field value -func (o *ServerProperties) SetTemplateUuid(v string) { - - o.TemplateUuid = &v - -} - // HasTemplateUuid returns a boolean if a field has been set. func (o *ServerProperties) HasTemplateUuid() bool { - if o != nil && o.TemplateUuid != nil { + if o != nil && !IsNil(o.TemplateUuid) { return true } return false } -// GetName returns the Name field value -// If the value is explicit nil, nil is returned -func (o *ServerProperties) GetName() *string { - if o == nil { - return nil - } - - return o.Name +// SetTemplateUuid gets a reference to the given string and assigns it to the TemplateUuid field. +func (o *ServerProperties) SetTemplateUuid(v string) { + o.TemplateUuid = &v +} +// GetName returns the Name field value if set, zero value otherwise. +func (o *ServerProperties) 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 +// GetNameOk returns a tuple with the Name 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 *ServerProperties) GetNameOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Name) { return nil, false } - return o.Name, true } -// SetName sets field value -func (o *ServerProperties) SetName(v string) { - - o.Name = &v - -} - // HasName returns a boolean if a field has been set. func (o *ServerProperties) HasName() bool { - if o != nil && o.Name != nil { + if o != nil && !IsNil(o.Name) { return true } return false } -// GetHostname returns the Hostname field value -// If the value is explicit nil, nil is returned -func (o *ServerProperties) GetHostname() *string { - if o == nil { - return nil - } - - return o.Hostname +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *ServerProperties) SetName(v string) { + o.Name = &v +} +// GetHostname returns the Hostname field value if set, zero value otherwise. +func (o *ServerProperties) 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 +// GetHostnameOk returns a tuple with the Hostname 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 *ServerProperties) GetHostnameOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Hostname) { return nil, false } - return o.Hostname, true } -// SetHostname sets field value -func (o *ServerProperties) SetHostname(v string) { - - o.Hostname = &v - -} - // HasHostname returns a boolean if a field has been set. func (o *ServerProperties) HasHostname() bool { - if o != nil && o.Hostname != nil { + if o != nil && !IsNil(o.Hostname) { return true } return false } -// GetCores returns the Cores field value -// If the value is explicit nil, nil is returned -func (o *ServerProperties) GetCores() *int32 { - if o == nil { - return nil - } - - return o.Cores +// SetHostname gets a reference to the given string and assigns it to the Hostname field. +func (o *ServerProperties) SetHostname(v string) { + o.Hostname = &v +} +// GetCores returns the Cores field value if set, zero value otherwise. +func (o *ServerProperties) GetCores() int32 { + if o == nil || IsNil(o.Cores) { + var ret int32 + return ret + } + return *o.Cores } -// GetCoresOk returns a tuple with the Cores field value +// GetCoresOk returns a tuple with the Cores 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 *ServerProperties) GetCoresOk() (*int32, bool) { - if o == nil { + if o == nil || IsNil(o.Cores) { return nil, false } - return o.Cores, true } -// SetCores sets field value -func (o *ServerProperties) SetCores(v int32) { - - o.Cores = &v - -} - // HasCores returns a boolean if a field has been set. func (o *ServerProperties) HasCores() bool { - if o != nil && o.Cores != nil { + if o != nil && !IsNil(o.Cores) { return true } return false } -// GetRam returns the Ram field value -// If the value is explicit nil, nil is returned -func (o *ServerProperties) GetRam() *int32 { - if o == nil { - return nil - } - - return o.Ram +// SetCores gets a reference to the given int32 and assigns it to the Cores field. +func (o *ServerProperties) SetCores(v int32) { + o.Cores = &v +} +// GetRam returns the Ram field value if set, zero value otherwise. +func (o *ServerProperties) GetRam() int32 { + if o == nil || IsNil(o.Ram) { + var ret int32 + return ret + } + return *o.Ram } -// GetRamOk returns a tuple with the Ram field value +// GetRamOk returns a tuple with the Ram 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 *ServerProperties) GetRamOk() (*int32, bool) { - if o == nil { + if o == nil || IsNil(o.Ram) { return nil, false } - return o.Ram, true } -// SetRam sets field value -func (o *ServerProperties) SetRam(v int32) { - - o.Ram = &v - -} - // HasRam returns a boolean if a field has been set. func (o *ServerProperties) HasRam() bool { - if o != nil && o.Ram != nil { + if o != nil && !IsNil(o.Ram) { return true } return false } -// GetAvailabilityZone returns the AvailabilityZone field value -// If the value is explicit nil, nil is returned -func (o *ServerProperties) GetAvailabilityZone() *string { - if o == nil { - return nil - } - - return o.AvailabilityZone +// SetRam gets a reference to the given int32 and assigns it to the Ram field. +func (o *ServerProperties) SetRam(v int32) { + o.Ram = &v +} +// GetAvailabilityZone returns the AvailabilityZone field value if set, zero value otherwise. +func (o *ServerProperties) GetAvailabilityZone() string { + if o == nil || IsNil(o.AvailabilityZone) { + var ret string + return ret + } + return *o.AvailabilityZone } -// GetAvailabilityZoneOk returns a tuple with the AvailabilityZone field value +// GetAvailabilityZoneOk returns a tuple with the AvailabilityZone 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 *ServerProperties) GetAvailabilityZoneOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.AvailabilityZone) { return nil, false } - return o.AvailabilityZone, true } -// SetAvailabilityZone sets field value -func (o *ServerProperties) SetAvailabilityZone(v string) { - - o.AvailabilityZone = &v - -} - // HasAvailabilityZone returns a boolean if a field has been set. func (o *ServerProperties) HasAvailabilityZone() bool { - if o != nil && o.AvailabilityZone != nil { + if o != nil && !IsNil(o.AvailabilityZone) { return true } return false } -// GetVmState returns the VmState field value -// If the value is explicit nil, nil is returned -func (o *ServerProperties) GetVmState() *string { - if o == nil { - return nil - } - - return o.VmState +// SetAvailabilityZone gets a reference to the given string and assigns it to the AvailabilityZone field. +func (o *ServerProperties) SetAvailabilityZone(v string) { + o.AvailabilityZone = &v +} +// GetVmState returns the VmState field value if set, zero value otherwise. +func (o *ServerProperties) GetVmState() string { + if o == nil || IsNil(o.VmState) { + var ret string + return ret + } + return *o.VmState } -// GetVmStateOk returns a tuple with the VmState field value +// GetVmStateOk returns a tuple with the VmState 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 *ServerProperties) GetVmStateOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.VmState) { return nil, false } - return o.VmState, true } -// SetVmState sets field value -func (o *ServerProperties) SetVmState(v string) { - - o.VmState = &v - -} - // HasVmState returns a boolean if a field has been set. func (o *ServerProperties) HasVmState() bool { - if o != nil && o.VmState != nil { + if o != nil && !IsNil(o.VmState) { return true } return false } -// GetBootCdrom returns the BootCdrom field value -// If the value is explicit nil, nil is returned -func (o *ServerProperties) GetBootCdrom() *ResourceReference { - if o == nil { - return nil - } - - return o.BootCdrom +// SetVmState gets a reference to the given string and assigns it to the VmState field. +func (o *ServerProperties) SetVmState(v string) { + o.VmState = &v +} +// GetBootCdrom returns the BootCdrom field value if set, zero value otherwise. +func (o *ServerProperties) GetBootCdrom() ResourceReference { + if o == nil || IsNil(o.BootCdrom) { + var ret ResourceReference + return ret + } + return *o.BootCdrom } -// GetBootCdromOk returns a tuple with the BootCdrom field value +// GetBootCdromOk returns a tuple with the BootCdrom 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 *ServerProperties) GetBootCdromOk() (*ResourceReference, bool) { - if o == nil { + if o == nil || IsNil(o.BootCdrom) { return nil, false } - return o.BootCdrom, true } -// SetBootCdrom sets field value -func (o *ServerProperties) SetBootCdrom(v ResourceReference) { - - o.BootCdrom = &v - -} - // HasBootCdrom returns a boolean if a field has been set. func (o *ServerProperties) HasBootCdrom() bool { - if o != nil && o.BootCdrom != nil { + if o != nil && !IsNil(o.BootCdrom) { return true } return false } -// GetBootVolume returns the BootVolume field value -// If the value is explicit nil, nil is returned -func (o *ServerProperties) GetBootVolume() *ResourceReference { - if o == nil { - return nil - } - - return o.BootVolume +// SetBootCdrom gets a reference to the given ResourceReference and assigns it to the BootCdrom field. +func (o *ServerProperties) SetBootCdrom(v ResourceReference) { + o.BootCdrom = &v +} +// GetBootVolume returns the BootVolume field value if set, zero value otherwise. +func (o *ServerProperties) GetBootVolume() ResourceReference { + if o == nil || IsNil(o.BootVolume) { + var ret ResourceReference + return ret + } + return *o.BootVolume } -// GetBootVolumeOk returns a tuple with the BootVolume field value +// GetBootVolumeOk returns a tuple with the BootVolume 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 *ServerProperties) GetBootVolumeOk() (*ResourceReference, bool) { - if o == nil { + if o == nil || IsNil(o.BootVolume) { return nil, false } - return o.BootVolume, true } -// SetBootVolume sets field value -func (o *ServerProperties) SetBootVolume(v ResourceReference) { - - o.BootVolume = &v - -} - // HasBootVolume returns a boolean if a field has been set. func (o *ServerProperties) HasBootVolume() bool { - if o != nil && o.BootVolume != nil { + if o != nil && !IsNil(o.BootVolume) { return true } return false } -// GetCpuFamily returns the CpuFamily field value -// If the value is explicit nil, nil is returned -func (o *ServerProperties) GetCpuFamily() *string { - if o == nil { - return nil - } - - return o.CpuFamily +// SetBootVolume gets a reference to the given ResourceReference and assigns it to the BootVolume field. +func (o *ServerProperties) SetBootVolume(v ResourceReference) { + o.BootVolume = &v +} +// GetCpuFamily returns the CpuFamily field value if set, zero value otherwise. +func (o *ServerProperties) GetCpuFamily() string { + if o == nil || IsNil(o.CpuFamily) { + var ret string + return ret + } + return *o.CpuFamily } -// GetCpuFamilyOk returns a tuple with the CpuFamily field value +// GetCpuFamilyOk returns a tuple with the CpuFamily 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 *ServerProperties) GetCpuFamilyOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.CpuFamily) { return nil, false } - return o.CpuFamily, true } -// SetCpuFamily sets field value -func (o *ServerProperties) SetCpuFamily(v string) { - - o.CpuFamily = &v - -} - // HasCpuFamily returns a boolean if a field has been set. func (o *ServerProperties) HasCpuFamily() bool { - if o != nil && o.CpuFamily != nil { + if o != nil && !IsNil(o.CpuFamily) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *ServerProperties) GetType() *string { - if o == nil { - return nil - } - - return o.Type +// SetCpuFamily gets a reference to the given string and assigns it to the CpuFamily field. +func (o *ServerProperties) SetCpuFamily(v string) { + o.CpuFamily = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *ServerProperties) 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 +// GetTypeOk returns a tuple with the Type 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 *ServerProperties) GetTypeOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *ServerProperties) SetType(v string) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *ServerProperties) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetPlacementGroupId returns the PlacementGroupId field value -// If the value is explicit nil, nil is returned -func (o *ServerProperties) GetPlacementGroupId() *string { - if o == nil { - return nil - } - - return o.PlacementGroupId +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *ServerProperties) SetType(v string) { + o.Type = &v +} +// GetPlacementGroupId returns the PlacementGroupId field value if set, zero value otherwise. +func (o *ServerProperties) GetPlacementGroupId() string { + if o == nil || IsNil(o.PlacementGroupId) { + var ret string + return ret + } + return *o.PlacementGroupId } -// GetPlacementGroupIdOk returns a tuple with the PlacementGroupId field value +// GetPlacementGroupIdOk returns a tuple with the PlacementGroupId 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 *ServerProperties) GetPlacementGroupIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.PlacementGroupId) { return nil, false } - return o.PlacementGroupId, true } -// SetPlacementGroupId sets field value -func (o *ServerProperties) SetPlacementGroupId(v string) { +// HasPlacementGroupId returns a boolean if a field has been set. +func (o *ServerProperties) HasPlacementGroupId() bool { + if o != nil && !IsNil(o.PlacementGroupId) { + return true + } + + return false +} +// SetPlacementGroupId gets a reference to the given string and assigns it to the PlacementGroupId field. +func (o *ServerProperties) SetPlacementGroupId(v string) { o.PlacementGroupId = &v +} +// GetNicMultiQueue returns the NicMultiQueue field value if set, zero value otherwise. +func (o *ServerProperties) GetNicMultiQueue() bool { + if o == nil || IsNil(o.NicMultiQueue) { + var ret bool + return ret + } + return *o.NicMultiQueue } -// HasPlacementGroupId returns a boolean if a field has been set. -func (o *ServerProperties) HasPlacementGroupId() bool { - if o != nil && o.PlacementGroupId != nil { +// GetNicMultiQueueOk returns a tuple with the NicMultiQueue field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServerProperties) GetNicMultiQueueOk() (*bool, bool) { + if o == nil || IsNil(o.NicMultiQueue) { + return nil, false + } + return o.NicMultiQueue, true +} + +// HasNicMultiQueue returns a boolean if a field has been set. +func (o *ServerProperties) HasNicMultiQueue() bool { + if o != nil && !IsNil(o.NicMultiQueue) { return true } return false } +// SetNicMultiQueue gets a reference to the given bool and assigns it to the NicMultiQueue field. +func (o *ServerProperties) SetNicMultiQueue(v bool) { + o.NicMultiQueue = &v +} + func (o ServerProperties) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ServerProperties) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.TemplateUuid != nil { + if !IsNil(o.TemplateUuid) { toSerialize["templateUuid"] = o.TemplateUuid } - - if o.Name != nil { + if !IsNil(o.Name) { toSerialize["name"] = o.Name } - - if o.Hostname != nil { + if !IsNil(o.Hostname) { toSerialize["hostname"] = o.Hostname } - - if o.Cores != nil { + if !IsNil(o.Cores) { toSerialize["cores"] = o.Cores } - - if o.Ram != nil { + if !IsNil(o.Ram) { toSerialize["ram"] = o.Ram } - - if o.AvailabilityZone != nil { + if !IsNil(o.AvailabilityZone) { toSerialize["availabilityZone"] = o.AvailabilityZone } - - if o.VmState != nil { + if !IsNil(o.VmState) { toSerialize["vmState"] = o.VmState } - - if o.BootCdrom != nil { + if !IsNil(o.BootCdrom) { toSerialize["bootCdrom"] = o.BootCdrom } - - if o.BootVolume != nil { + if !IsNil(o.BootVolume) { toSerialize["bootVolume"] = o.BootVolume } - - if o.CpuFamily != nil { + if !IsNil(o.CpuFamily) { toSerialize["cpuFamily"] = o.CpuFamily } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.PlacementGroupId != nil { + if !IsNil(o.PlacementGroupId) { toSerialize["placementGroupId"] = o.PlacementGroupId } - - return json.Marshal(toSerialize) + if !IsNil(o.NicMultiQueue) { + toSerialize["nicMultiQueue"] = o.NicMultiQueue + } + return toSerialize, nil } type NullableServerProperties struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_servers.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_servers.go similarity index 59% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_servers.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_servers.go index c6c5bc70c..f46c5e6d0 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_servers.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_servers.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the Servers type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Servers{} + // Servers struct for Servers type Servers struct { // The resource's unique identifier. @@ -23,7 +26,7 @@ type Servers struct { // URL to the object representation (absolute path). Href *string `json:"href,omitempty"` // Array of items in the collection. - Items *[]Server `json:"items,omitempty"` + Items []Server `json:"items,omitempty"` // The offset (if specified in the request). Offset *float32 `json:"offset,omitempty"` // The limit (if specified in the request). @@ -49,303 +52,262 @@ func NewServersWithDefaults() *Servers { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *Servers) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *Servers) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *Servers) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *Servers) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *Servers) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *Servers) GetType() *Type { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Servers) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *Servers) GetType() Type { + if o == nil || IsNil(o.Type) { + var ret Type + return ret + } + return *o.Type } -// GetTypeOk returns a tuple with the Type field value +// GetTypeOk returns a tuple with the Type 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 *Servers) GetTypeOk() (*Type, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *Servers) SetType(v Type) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *Servers) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *Servers) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given Type and assigns it to the Type field. +func (o *Servers) SetType(v Type) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *Servers) 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 +// GetHrefOk returns a tuple with the Href 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 *Servers) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *Servers) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *Servers) HasHref() bool { - if o != nil && o.Href != nil { + if o != nil && !IsNil(o.Href) { return true } return false } -// GetItems returns the Items field value -// If the value is explicit nil, nil is returned -func (o *Servers) GetItems() *[]Server { - if o == nil { - return nil - } +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *Servers) SetHref(v string) { + o.Href = &v +} +// GetItems returns the Items field value if set, zero value otherwise. +func (o *Servers) GetItems() []Server { + if o == nil || IsNil(o.Items) { + var ret []Server + return ret + } return o.Items - } -// GetItemsOk returns a tuple with the Items field value +// GetItemsOk returns a tuple with the Items 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 *Servers) GetItemsOk() (*[]Server, bool) { - if o == nil { +func (o *Servers) GetItemsOk() ([]Server, bool) { + if o == nil || IsNil(o.Items) { return nil, false } - return o.Items, true } -// SetItems sets field value -func (o *Servers) SetItems(v []Server) { - - o.Items = &v - -} - // HasItems returns a boolean if a field has been set. func (o *Servers) HasItems() bool { - if o != nil && o.Items != nil { + if o != nil && !IsNil(o.Items) { return true } return false } -// GetOffset returns the Offset field value -// If the value is explicit nil, nil is returned -func (o *Servers) GetOffset() *float32 { - if o == nil { - return nil - } - - return o.Offset +// SetItems gets a reference to the given []Server and assigns it to the Items field. +func (o *Servers) SetItems(v []Server) { + o.Items = v +} +// GetOffset returns the Offset field value if set, zero value otherwise. +func (o *Servers) GetOffset() float32 { + if o == nil || IsNil(o.Offset) { + var ret float32 + return ret + } + return *o.Offset } -// GetOffsetOk returns a tuple with the Offset field value +// GetOffsetOk returns a tuple with the Offset 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 *Servers) GetOffsetOk() (*float32, bool) { - if o == nil { + if o == nil || IsNil(o.Offset) { return nil, false } - return o.Offset, true } -// SetOffset sets field value -func (o *Servers) SetOffset(v float32) { - - o.Offset = &v - -} - // HasOffset returns a boolean if a field has been set. func (o *Servers) HasOffset() bool { - if o != nil && o.Offset != nil { + if o != nil && !IsNil(o.Offset) { return true } return false } -// GetLimit returns the Limit field value -// If the value is explicit nil, nil is returned -func (o *Servers) GetLimit() *float32 { - if o == nil { - return nil - } - - return o.Limit +// SetOffset gets a reference to the given float32 and assigns it to the Offset field. +func (o *Servers) SetOffset(v float32) { + o.Offset = &v +} +// GetLimit returns the Limit field value if set, zero value otherwise. +func (o *Servers) GetLimit() float32 { + if o == nil || IsNil(o.Limit) { + var ret float32 + return ret + } + return *o.Limit } -// GetLimitOk returns a tuple with the Limit field value +// GetLimitOk returns a tuple with the Limit 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 *Servers) GetLimitOk() (*float32, bool) { - if o == nil { + if o == nil || IsNil(o.Limit) { return nil, false } - return o.Limit, true } -// SetLimit sets field value -func (o *Servers) SetLimit(v float32) { - - o.Limit = &v - -} - // HasLimit returns a boolean if a field has been set. func (o *Servers) HasLimit() bool { - if o != nil && o.Limit != nil { + if o != nil && !IsNil(o.Limit) { return true } return false } -// GetLinks returns the Links field value -// If the value is explicit nil, nil is returned -func (o *Servers) GetLinks() *PaginationLinks { - if o == nil { - return nil - } - - return o.Links +// SetLimit gets a reference to the given float32 and assigns it to the Limit field. +func (o *Servers) SetLimit(v float32) { + o.Limit = &v +} +// GetLinks returns the Links field value if set, zero value otherwise. +func (o *Servers) GetLinks() PaginationLinks { + if o == nil || IsNil(o.Links) { + var ret PaginationLinks + return ret + } + return *o.Links } -// GetLinksOk returns a tuple with the Links field value +// GetLinksOk returns a tuple with the Links 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 *Servers) GetLinksOk() (*PaginationLinks, bool) { - if o == nil { + if o == nil || IsNil(o.Links) { return nil, false } - return o.Links, true } -// SetLinks sets field value -func (o *Servers) SetLinks(v PaginationLinks) { - - o.Links = &v - -} - // HasLinks returns a boolean if a field has been set. func (o *Servers) HasLinks() bool { - if o != nil && o.Links != nil { + if o != nil && !IsNil(o.Links) { return true } return false } +// SetLinks gets a reference to the given PaginationLinks and assigns it to the Links field. +func (o *Servers) SetLinks(v PaginationLinks) { + o.Links = &v +} + func (o Servers) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Servers) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Items != nil { + if !IsNil(o.Items) { toSerialize["items"] = o.Items } - - if o.Offset != nil { + if !IsNil(o.Offset) { toSerialize["offset"] = o.Offset } - - if o.Limit != nil { + if !IsNil(o.Limit) { toSerialize["limit"] = o.Limit } - - if o.Links != nil { + if !IsNil(o.Links) { toSerialize["_links"] = o.Links } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableServers struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_snapshot.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_snapshot.go similarity index 65% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_snapshot.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_snapshot.go index 9c0bf04d6..3dee8585d 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_snapshot.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_snapshot.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the Snapshot type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Snapshot{} + // Snapshot struct for Snapshot type Snapshot struct { // The resource's unique identifier. @@ -23,7 +26,7 @@ type Snapshot struct { // URL to the object representation (absolute path). Href *string `json:"href,omitempty"` Metadata *DatacenterElementMetadata `json:"metadata,omitempty"` - Properties *SnapshotProperties `json:"properties"` + Properties SnapshotProperties `json:"properties"` } // NewSnapshot instantiates a new Snapshot object @@ -33,7 +36,7 @@ type Snapshot struct { func NewSnapshot(properties SnapshotProperties) *Snapshot { this := Snapshot{} - this.Properties = &properties + this.Properties = properties return &this } @@ -46,219 +49,182 @@ func NewSnapshotWithDefaults() *Snapshot { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *Snapshot) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *Snapshot) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *Snapshot) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *Snapshot) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *Snapshot) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *Snapshot) GetType() *Type { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Snapshot) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *Snapshot) GetType() Type { + if o == nil || IsNil(o.Type) { + var ret Type + return ret + } + return *o.Type } -// GetTypeOk returns a tuple with the Type field value +// GetTypeOk returns a tuple with the Type 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 *Snapshot) GetTypeOk() (*Type, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *Snapshot) SetType(v Type) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *Snapshot) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *Snapshot) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given Type and assigns it to the Type field. +func (o *Snapshot) SetType(v Type) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *Snapshot) 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 +// GetHrefOk returns a tuple with the Href 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 *Snapshot) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *Snapshot) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *Snapshot) HasHref() bool { - if o != nil && o.Href != nil { + if o != nil && !IsNil(o.Href) { return true } return false } -// GetMetadata returns the Metadata field value -// If the value is explicit nil, nil is returned -func (o *Snapshot) GetMetadata() *DatacenterElementMetadata { - if o == nil { - return nil - } - - return o.Metadata +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *Snapshot) SetHref(v string) { + o.Href = &v +} +// GetMetadata returns the Metadata field value if set, zero value otherwise. +func (o *Snapshot) GetMetadata() DatacenterElementMetadata { + if o == nil || IsNil(o.Metadata) { + var ret DatacenterElementMetadata + return ret + } + return *o.Metadata } -// GetMetadataOk returns a tuple with the Metadata field value +// GetMetadataOk returns a tuple with the Metadata 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 *Snapshot) GetMetadataOk() (*DatacenterElementMetadata, bool) { - if o == nil { + if o == nil || IsNil(o.Metadata) { return nil, false } - return o.Metadata, true } -// SetMetadata sets field value -func (o *Snapshot) SetMetadata(v DatacenterElementMetadata) { - - o.Metadata = &v - -} - // HasMetadata returns a boolean if a field has been set. func (o *Snapshot) HasMetadata() bool { - if o != nil && o.Metadata != nil { + if o != nil && !IsNil(o.Metadata) { return true } return false } +// SetMetadata gets a reference to the given DatacenterElementMetadata and assigns it to the Metadata field. +func (o *Snapshot) SetMetadata(v DatacenterElementMetadata) { + o.Metadata = &v +} + // GetProperties returns the Properties field value -// If the value is explicit nil, nil is returned -func (o *Snapshot) GetProperties() *SnapshotProperties { +func (o *Snapshot) GetProperties() SnapshotProperties { if o == nil { - return nil + var ret SnapshotProperties + return ret } return o.Properties - } // GetPropertiesOk returns a tuple with the Properties field value // 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 *Snapshot) GetPropertiesOk() (*SnapshotProperties, bool) { if o == nil { return nil, false } - - return o.Properties, true + return &o.Properties, true } // SetProperties sets field value func (o *Snapshot) SetProperties(v SnapshotProperties) { - - o.Properties = &v - + o.Properties = v } -// HasProperties returns a boolean if a field has been set. -func (o *Snapshot) HasProperties() bool { - if o != nil && o.Properties != nil { - return true +func (o Snapshot) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } - - return false + return json.Marshal(toSerialize) } -func (o Snapshot) MarshalJSON() ([]byte, error) { +func (o Snapshot) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Metadata != nil { + if !IsNil(o.Metadata) { toSerialize["metadata"] = o.Metadata } - - if o.Properties != nil { - toSerialize["properties"] = o.Properties - } - - return json.Marshal(toSerialize) + toSerialize["properties"] = o.Properties + return toSerialize, nil } type NullableSnapshot struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_snapshot_properties.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_snapshot_properties.go similarity index 62% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_snapshot_properties.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_snapshot_properties.go index 9111ccba4..956b05235 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_snapshot_properties.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_snapshot_properties.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the SnapshotProperties type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SnapshotProperties{} + // SnapshotProperties struct for SnapshotProperties type SnapshotProperties struct { // The name of the resource. @@ -75,723 +78,612 @@ func NewSnapshotPropertiesWithDefaults() *SnapshotProperties { return &this } -// GetName returns the Name field value -// If the value is explicit nil, nil is returned -func (o *SnapshotProperties) GetName() *string { - if o == nil { - return nil +// GetName returns the Name field value if set, zero value otherwise. +func (o *SnapshotProperties) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret } - - return o.Name - + return *o.Name } -// GetNameOk returns a tuple with the Name field value +// GetNameOk returns a tuple with the Name 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 *SnapshotProperties) GetNameOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Name) { return nil, false } - return o.Name, true } -// SetName sets field value -func (o *SnapshotProperties) SetName(v string) { - - o.Name = &v - -} - // HasName returns a boolean if a field has been set. func (o *SnapshotProperties) HasName() bool { - if o != nil && o.Name != nil { + if o != nil && !IsNil(o.Name) { return true } return false } -// GetDescription returns the Description field value -// If the value is explicit nil, nil is returned -func (o *SnapshotProperties) GetDescription() *string { - if o == nil { - return nil - } - - return o.Description +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *SnapshotProperties) SetName(v string) { + o.Name = &v +} +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *SnapshotProperties) 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 +// GetDescriptionOk returns a tuple with the Description 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 *SnapshotProperties) GetDescriptionOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Description) { return nil, false } - return o.Description, true } -// SetDescription sets field value -func (o *SnapshotProperties) SetDescription(v string) { - - o.Description = &v - -} - // HasDescription returns a boolean if a field has been set. func (o *SnapshotProperties) HasDescription() bool { - if o != nil && o.Description != nil { + if o != nil && !IsNil(o.Description) { return true } return false } -// GetLocation returns the Location field value -// If the value is explicit nil, nil is returned -func (o *SnapshotProperties) GetLocation() *string { - if o == nil { - return nil - } - - return o.Location +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *SnapshotProperties) SetDescription(v string) { + o.Description = &v +} +// GetLocation returns the Location field value if set, zero value otherwise. +func (o *SnapshotProperties) GetLocation() string { + if o == nil || IsNil(o.Location) { + var ret string + return ret + } + return *o.Location } -// GetLocationOk returns a tuple with the Location field value +// GetLocationOk returns a tuple with the Location 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 *SnapshotProperties) GetLocationOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Location) { return nil, false } - return o.Location, true } -// SetLocation sets field value -func (o *SnapshotProperties) SetLocation(v string) { - - o.Location = &v - -} - // HasLocation returns a boolean if a field has been set. func (o *SnapshotProperties) HasLocation() bool { - if o != nil && o.Location != nil { + if o != nil && !IsNil(o.Location) { return true } return false } -// GetSize returns the Size field value -// If the value is explicit nil, nil is returned -func (o *SnapshotProperties) GetSize() *float32 { - if o == nil { - return nil - } - - return o.Size +// SetLocation gets a reference to the given string and assigns it to the Location field. +func (o *SnapshotProperties) SetLocation(v string) { + o.Location = &v +} +// GetSize returns the Size field value if set, zero value otherwise. +func (o *SnapshotProperties) 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 +// GetSizeOk returns a tuple with the Size 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 *SnapshotProperties) GetSizeOk() (*float32, bool) { - if o == nil { + if o == nil || IsNil(o.Size) { return nil, false } - return o.Size, true } -// SetSize sets field value -func (o *SnapshotProperties) SetSize(v float32) { - - o.Size = &v - -} - // HasSize returns a boolean if a field has been set. func (o *SnapshotProperties) HasSize() bool { - if o != nil && o.Size != nil { + if o != nil && !IsNil(o.Size) { return true } return false } -// GetSecAuthProtection returns the SecAuthProtection field value -// If the value is explicit nil, nil is returned -func (o *SnapshotProperties) GetSecAuthProtection() *bool { - if o == nil { - return nil - } - - return o.SecAuthProtection +// SetSize gets a reference to the given float32 and assigns it to the Size field. +func (o *SnapshotProperties) SetSize(v float32) { + o.Size = &v +} +// GetSecAuthProtection returns the SecAuthProtection field value if set, zero value otherwise. +func (o *SnapshotProperties) GetSecAuthProtection() bool { + if o == nil || IsNil(o.SecAuthProtection) { + var ret bool + return ret + } + return *o.SecAuthProtection } -// GetSecAuthProtectionOk returns a tuple with the SecAuthProtection field value +// GetSecAuthProtectionOk returns a tuple with the SecAuthProtection 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 *SnapshotProperties) GetSecAuthProtectionOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.SecAuthProtection) { return nil, false } - return o.SecAuthProtection, true } -// SetSecAuthProtection sets field value -func (o *SnapshotProperties) SetSecAuthProtection(v bool) { - - o.SecAuthProtection = &v - -} - // HasSecAuthProtection returns a boolean if a field has been set. func (o *SnapshotProperties) HasSecAuthProtection() bool { - if o != nil && o.SecAuthProtection != nil { + if o != nil && !IsNil(o.SecAuthProtection) { return true } return false } -// GetCpuHotPlug returns the CpuHotPlug field value -// If the value is explicit nil, nil is returned -func (o *SnapshotProperties) GetCpuHotPlug() *bool { - if o == nil { - return nil - } - - return o.CpuHotPlug +// SetSecAuthProtection gets a reference to the given bool and assigns it to the SecAuthProtection field. +func (o *SnapshotProperties) SetSecAuthProtection(v bool) { + o.SecAuthProtection = &v +} +// GetCpuHotPlug returns the CpuHotPlug field value if set, zero value otherwise. +func (o *SnapshotProperties) GetCpuHotPlug() bool { + if o == nil || IsNil(o.CpuHotPlug) { + var ret bool + return ret + } + return *o.CpuHotPlug } -// GetCpuHotPlugOk returns a tuple with the CpuHotPlug field value +// GetCpuHotPlugOk returns a tuple with the CpuHotPlug 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 *SnapshotProperties) GetCpuHotPlugOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.CpuHotPlug) { return nil, false } - return o.CpuHotPlug, true } -// SetCpuHotPlug sets field value -func (o *SnapshotProperties) SetCpuHotPlug(v bool) { - - o.CpuHotPlug = &v - -} - // HasCpuHotPlug returns a boolean if a field has been set. func (o *SnapshotProperties) HasCpuHotPlug() bool { - if o != nil && o.CpuHotPlug != nil { + if o != nil && !IsNil(o.CpuHotPlug) { return true } return false } -// GetCpuHotUnplug returns the CpuHotUnplug field value -// If the value is explicit nil, nil is returned -func (o *SnapshotProperties) GetCpuHotUnplug() *bool { - if o == nil { - return nil - } - - return o.CpuHotUnplug +// SetCpuHotPlug gets a reference to the given bool and assigns it to the CpuHotPlug field. +func (o *SnapshotProperties) SetCpuHotPlug(v bool) { + o.CpuHotPlug = &v +} +// GetCpuHotUnplug returns the CpuHotUnplug field value if set, zero value otherwise. +func (o *SnapshotProperties) GetCpuHotUnplug() bool { + if o == nil || IsNil(o.CpuHotUnplug) { + var ret bool + return ret + } + return *o.CpuHotUnplug } -// GetCpuHotUnplugOk returns a tuple with the CpuHotUnplug field value +// GetCpuHotUnplugOk returns a tuple with the CpuHotUnplug 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 *SnapshotProperties) GetCpuHotUnplugOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.CpuHotUnplug) { return nil, false } - return o.CpuHotUnplug, true } -// SetCpuHotUnplug sets field value -func (o *SnapshotProperties) SetCpuHotUnplug(v bool) { - - o.CpuHotUnplug = &v - -} - // HasCpuHotUnplug returns a boolean if a field has been set. func (o *SnapshotProperties) HasCpuHotUnplug() bool { - if o != nil && o.CpuHotUnplug != nil { + if o != nil && !IsNil(o.CpuHotUnplug) { return true } return false } -// GetRamHotPlug returns the RamHotPlug field value -// If the value is explicit nil, nil is returned -func (o *SnapshotProperties) GetRamHotPlug() *bool { - if o == nil { - return nil - } - - return o.RamHotPlug +// SetCpuHotUnplug gets a reference to the given bool and assigns it to the CpuHotUnplug field. +func (o *SnapshotProperties) SetCpuHotUnplug(v bool) { + o.CpuHotUnplug = &v +} +// GetRamHotPlug returns the RamHotPlug field value if set, zero value otherwise. +func (o *SnapshotProperties) GetRamHotPlug() bool { + if o == nil || IsNil(o.RamHotPlug) { + var ret bool + return ret + } + return *o.RamHotPlug } -// GetRamHotPlugOk returns a tuple with the RamHotPlug field value +// GetRamHotPlugOk returns a tuple with the RamHotPlug 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 *SnapshotProperties) GetRamHotPlugOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.RamHotPlug) { return nil, false } - return o.RamHotPlug, true } -// SetRamHotPlug sets field value -func (o *SnapshotProperties) SetRamHotPlug(v bool) { - - o.RamHotPlug = &v - -} - // HasRamHotPlug returns a boolean if a field has been set. func (o *SnapshotProperties) HasRamHotPlug() bool { - if o != nil && o.RamHotPlug != nil { + if o != nil && !IsNil(o.RamHotPlug) { return true } return false } -// GetRamHotUnplug returns the RamHotUnplug field value -// If the value is explicit nil, nil is returned -func (o *SnapshotProperties) GetRamHotUnplug() *bool { - if o == nil { - return nil - } - - return o.RamHotUnplug +// SetRamHotPlug gets a reference to the given bool and assigns it to the RamHotPlug field. +func (o *SnapshotProperties) SetRamHotPlug(v bool) { + o.RamHotPlug = &v +} +// GetRamHotUnplug returns the RamHotUnplug field value if set, zero value otherwise. +func (o *SnapshotProperties) GetRamHotUnplug() bool { + if o == nil || IsNil(o.RamHotUnplug) { + var ret bool + return ret + } + return *o.RamHotUnplug } -// GetRamHotUnplugOk returns a tuple with the RamHotUnplug field value +// GetRamHotUnplugOk returns a tuple with the RamHotUnplug 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 *SnapshotProperties) GetRamHotUnplugOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.RamHotUnplug) { return nil, false } - return o.RamHotUnplug, true } -// SetRamHotUnplug sets field value -func (o *SnapshotProperties) SetRamHotUnplug(v bool) { - - o.RamHotUnplug = &v - -} - // HasRamHotUnplug returns a boolean if a field has been set. func (o *SnapshotProperties) HasRamHotUnplug() bool { - if o != nil && o.RamHotUnplug != nil { + if o != nil && !IsNil(o.RamHotUnplug) { return true } return false } -// GetNicHotPlug returns the NicHotPlug field value -// If the value is explicit nil, nil is returned -func (o *SnapshotProperties) GetNicHotPlug() *bool { - if o == nil { - return nil - } - - return o.NicHotPlug +// SetRamHotUnplug gets a reference to the given bool and assigns it to the RamHotUnplug field. +func (o *SnapshotProperties) SetRamHotUnplug(v bool) { + o.RamHotUnplug = &v +} +// GetNicHotPlug returns the NicHotPlug field value if set, zero value otherwise. +func (o *SnapshotProperties) GetNicHotPlug() bool { + if o == nil || IsNil(o.NicHotPlug) { + var ret bool + return ret + } + return *o.NicHotPlug } -// GetNicHotPlugOk returns a tuple with the NicHotPlug field value +// GetNicHotPlugOk returns a tuple with the NicHotPlug 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 *SnapshotProperties) GetNicHotPlugOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.NicHotPlug) { return nil, false } - return o.NicHotPlug, true } -// SetNicHotPlug sets field value -func (o *SnapshotProperties) SetNicHotPlug(v bool) { - - o.NicHotPlug = &v - -} - // HasNicHotPlug returns a boolean if a field has been set. func (o *SnapshotProperties) HasNicHotPlug() bool { - if o != nil && o.NicHotPlug != nil { + if o != nil && !IsNil(o.NicHotPlug) { return true } return false } -// GetNicHotUnplug returns the NicHotUnplug field value -// If the value is explicit nil, nil is returned -func (o *SnapshotProperties) GetNicHotUnplug() *bool { - if o == nil { - return nil - } - - return o.NicHotUnplug +// SetNicHotPlug gets a reference to the given bool and assigns it to the NicHotPlug field. +func (o *SnapshotProperties) SetNicHotPlug(v bool) { + o.NicHotPlug = &v +} +// GetNicHotUnplug returns the NicHotUnplug field value if set, zero value otherwise. +func (o *SnapshotProperties) GetNicHotUnplug() bool { + if o == nil || IsNil(o.NicHotUnplug) { + var ret bool + return ret + } + return *o.NicHotUnplug } -// GetNicHotUnplugOk returns a tuple with the NicHotUnplug field value +// GetNicHotUnplugOk returns a tuple with the NicHotUnplug 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 *SnapshotProperties) GetNicHotUnplugOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.NicHotUnplug) { return nil, false } - return o.NicHotUnplug, true } -// SetNicHotUnplug sets field value -func (o *SnapshotProperties) SetNicHotUnplug(v bool) { - - o.NicHotUnplug = &v - -} - // HasNicHotUnplug returns a boolean if a field has been set. func (o *SnapshotProperties) HasNicHotUnplug() bool { - if o != nil && o.NicHotUnplug != nil { + if o != nil && !IsNil(o.NicHotUnplug) { return true } return false } -// GetDiscVirtioHotPlug returns the DiscVirtioHotPlug field value -// If the value is explicit nil, nil is returned -func (o *SnapshotProperties) GetDiscVirtioHotPlug() *bool { - if o == nil { - return nil - } - - return o.DiscVirtioHotPlug +// SetNicHotUnplug gets a reference to the given bool and assigns it to the NicHotUnplug field. +func (o *SnapshotProperties) SetNicHotUnplug(v bool) { + o.NicHotUnplug = &v +} +// GetDiscVirtioHotPlug returns the DiscVirtioHotPlug field value if set, zero value otherwise. +func (o *SnapshotProperties) GetDiscVirtioHotPlug() bool { + if o == nil || IsNil(o.DiscVirtioHotPlug) { + var ret bool + return ret + } + return *o.DiscVirtioHotPlug } -// GetDiscVirtioHotPlugOk returns a tuple with the DiscVirtioHotPlug field value +// GetDiscVirtioHotPlugOk returns a tuple with the DiscVirtioHotPlug 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 *SnapshotProperties) GetDiscVirtioHotPlugOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.DiscVirtioHotPlug) { return nil, false } - return o.DiscVirtioHotPlug, true } -// SetDiscVirtioHotPlug sets field value -func (o *SnapshotProperties) SetDiscVirtioHotPlug(v bool) { - - o.DiscVirtioHotPlug = &v - -} - // HasDiscVirtioHotPlug returns a boolean if a field has been set. func (o *SnapshotProperties) HasDiscVirtioHotPlug() bool { - if o != nil && o.DiscVirtioHotPlug != nil { + if o != nil && !IsNil(o.DiscVirtioHotPlug) { return true } return false } -// GetDiscVirtioHotUnplug returns the DiscVirtioHotUnplug field value -// If the value is explicit nil, nil is returned -func (o *SnapshotProperties) GetDiscVirtioHotUnplug() *bool { - if o == nil { - return nil - } - - return o.DiscVirtioHotUnplug +// SetDiscVirtioHotPlug gets a reference to the given bool and assigns it to the DiscVirtioHotPlug field. +func (o *SnapshotProperties) SetDiscVirtioHotPlug(v bool) { + o.DiscVirtioHotPlug = &v +} +// GetDiscVirtioHotUnplug returns the DiscVirtioHotUnplug field value if set, zero value otherwise. +func (o *SnapshotProperties) GetDiscVirtioHotUnplug() bool { + if o == nil || IsNil(o.DiscVirtioHotUnplug) { + var ret bool + return ret + } + return *o.DiscVirtioHotUnplug } -// GetDiscVirtioHotUnplugOk returns a tuple with the DiscVirtioHotUnplug field value +// GetDiscVirtioHotUnplugOk returns a tuple with the DiscVirtioHotUnplug 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 *SnapshotProperties) GetDiscVirtioHotUnplugOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.DiscVirtioHotUnplug) { return nil, false } - return o.DiscVirtioHotUnplug, true } -// SetDiscVirtioHotUnplug sets field value -func (o *SnapshotProperties) SetDiscVirtioHotUnplug(v bool) { - - o.DiscVirtioHotUnplug = &v - -} - // HasDiscVirtioHotUnplug returns a boolean if a field has been set. func (o *SnapshotProperties) HasDiscVirtioHotUnplug() bool { - if o != nil && o.DiscVirtioHotUnplug != nil { + if o != nil && !IsNil(o.DiscVirtioHotUnplug) { return true } return false } -// GetDiscScsiHotPlug returns the DiscScsiHotPlug field value -// If the value is explicit nil, nil is returned -func (o *SnapshotProperties) GetDiscScsiHotPlug() *bool { - if o == nil { - return nil - } - - return o.DiscScsiHotPlug +// SetDiscVirtioHotUnplug gets a reference to the given bool and assigns it to the DiscVirtioHotUnplug field. +func (o *SnapshotProperties) SetDiscVirtioHotUnplug(v bool) { + o.DiscVirtioHotUnplug = &v +} +// GetDiscScsiHotPlug returns the DiscScsiHotPlug field value if set, zero value otherwise. +func (o *SnapshotProperties) GetDiscScsiHotPlug() bool { + if o == nil || IsNil(o.DiscScsiHotPlug) { + var ret bool + return ret + } + return *o.DiscScsiHotPlug } -// GetDiscScsiHotPlugOk returns a tuple with the DiscScsiHotPlug field value +// GetDiscScsiHotPlugOk returns a tuple with the DiscScsiHotPlug 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 *SnapshotProperties) GetDiscScsiHotPlugOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.DiscScsiHotPlug) { return nil, false } - return o.DiscScsiHotPlug, true } -// SetDiscScsiHotPlug sets field value -func (o *SnapshotProperties) SetDiscScsiHotPlug(v bool) { - - o.DiscScsiHotPlug = &v - -} - // HasDiscScsiHotPlug returns a boolean if a field has been set. func (o *SnapshotProperties) HasDiscScsiHotPlug() bool { - if o != nil && o.DiscScsiHotPlug != nil { + if o != nil && !IsNil(o.DiscScsiHotPlug) { return true } return false } -// GetExposeSerial returns the ExposeSerial field value -// If the value is explicit nil, nil is returned -func (o *SnapshotProperties) GetExposeSerial() *bool { - if o == nil { - return nil - } - - return o.ExposeSerial +// SetDiscScsiHotPlug gets a reference to the given bool and assigns it to the DiscScsiHotPlug field. +func (o *SnapshotProperties) SetDiscScsiHotPlug(v bool) { + o.DiscScsiHotPlug = &v +} +// GetExposeSerial returns the ExposeSerial field value if set, zero value otherwise. +func (o *SnapshotProperties) GetExposeSerial() bool { + if o == nil || IsNil(o.ExposeSerial) { + var ret bool + return ret + } + return *o.ExposeSerial } -// GetExposeSerialOk returns a tuple with the ExposeSerial field value +// GetExposeSerialOk returns a tuple with the ExposeSerial 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 *SnapshotProperties) GetExposeSerialOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.ExposeSerial) { return nil, false } - return o.ExposeSerial, true } -// SetExposeSerial sets field value -func (o *SnapshotProperties) SetExposeSerial(v bool) { - - o.ExposeSerial = &v - -} - // HasExposeSerial returns a boolean if a field has been set. func (o *SnapshotProperties) HasExposeSerial() bool { - if o != nil && o.ExposeSerial != nil { + if o != nil && !IsNil(o.ExposeSerial) { return true } return false } -// GetDiscScsiHotUnplug returns the DiscScsiHotUnplug field value -// If the value is explicit nil, nil is returned -func (o *SnapshotProperties) GetDiscScsiHotUnplug() *bool { - if o == nil { - return nil - } - - return o.DiscScsiHotUnplug +// SetExposeSerial gets a reference to the given bool and assigns it to the ExposeSerial field. +func (o *SnapshotProperties) SetExposeSerial(v bool) { + o.ExposeSerial = &v +} +// GetDiscScsiHotUnplug returns the DiscScsiHotUnplug field value if set, zero value otherwise. +func (o *SnapshotProperties) GetDiscScsiHotUnplug() bool { + if o == nil || IsNil(o.DiscScsiHotUnplug) { + var ret bool + return ret + } + return *o.DiscScsiHotUnplug } -// GetDiscScsiHotUnplugOk returns a tuple with the DiscScsiHotUnplug field value +// GetDiscScsiHotUnplugOk returns a tuple with the DiscScsiHotUnplug 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 *SnapshotProperties) GetDiscScsiHotUnplugOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.DiscScsiHotUnplug) { return nil, false } - return o.DiscScsiHotUnplug, true } -// SetDiscScsiHotUnplug sets field value -func (o *SnapshotProperties) SetDiscScsiHotUnplug(v bool) { - - o.DiscScsiHotUnplug = &v - -} - // HasDiscScsiHotUnplug returns a boolean if a field has been set. func (o *SnapshotProperties) HasDiscScsiHotUnplug() bool { - if o != nil && o.DiscScsiHotUnplug != nil { + if o != nil && !IsNil(o.DiscScsiHotUnplug) { return true } return false } -// GetLicenceType returns the LicenceType field value -// If the value is explicit nil, nil is returned -func (o *SnapshotProperties) GetLicenceType() *string { - if o == nil { - return nil - } - - return o.LicenceType +// SetDiscScsiHotUnplug gets a reference to the given bool and assigns it to the DiscScsiHotUnplug field. +func (o *SnapshotProperties) SetDiscScsiHotUnplug(v bool) { + o.DiscScsiHotUnplug = &v +} +// GetLicenceType returns the LicenceType field value if set, zero value otherwise. +func (o *SnapshotProperties) GetLicenceType() string { + if o == nil || IsNil(o.LicenceType) { + var ret string + return ret + } + return *o.LicenceType } -// GetLicenceTypeOk returns a tuple with the LicenceType field value +// GetLicenceTypeOk returns a tuple with the LicenceType 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 *SnapshotProperties) GetLicenceTypeOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.LicenceType) { return nil, false } - return o.LicenceType, true } -// SetLicenceType sets field value -func (o *SnapshotProperties) SetLicenceType(v string) { - - o.LicenceType = &v - -} - // HasLicenceType returns a boolean if a field has been set. func (o *SnapshotProperties) HasLicenceType() bool { - if o != nil && o.LicenceType != nil { + if o != nil && !IsNil(o.LicenceType) { return true } return false } +// SetLicenceType gets a reference to the given string and assigns it to the LicenceType field. +func (o *SnapshotProperties) SetLicenceType(v string) { + o.LicenceType = &v +} + func (o SnapshotProperties) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o SnapshotProperties) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Name != nil { + if !IsNil(o.Name) { toSerialize["name"] = o.Name } - - if o.Description != nil { + if !IsNil(o.Description) { toSerialize["description"] = o.Description } - - if o.Location != nil { + if !IsNil(o.Location) { toSerialize["location"] = o.Location } - - if o.Size != nil { + if !IsNil(o.Size) { toSerialize["size"] = o.Size } - - if o.SecAuthProtection != nil { + if !IsNil(o.SecAuthProtection) { toSerialize["secAuthProtection"] = o.SecAuthProtection } - - if o.CpuHotPlug != nil { + if !IsNil(o.CpuHotPlug) { toSerialize["cpuHotPlug"] = o.CpuHotPlug } - - if o.CpuHotUnplug != nil { + if !IsNil(o.CpuHotUnplug) { toSerialize["cpuHotUnplug"] = o.CpuHotUnplug } - - if o.RamHotPlug != nil { + if !IsNil(o.RamHotPlug) { toSerialize["ramHotPlug"] = o.RamHotPlug } - - if o.RamHotUnplug != nil { + if !IsNil(o.RamHotUnplug) { toSerialize["ramHotUnplug"] = o.RamHotUnplug } - - if o.NicHotPlug != nil { + if !IsNil(o.NicHotPlug) { toSerialize["nicHotPlug"] = o.NicHotPlug } - - if o.NicHotUnplug != nil { + if !IsNil(o.NicHotUnplug) { toSerialize["nicHotUnplug"] = o.NicHotUnplug } - - if o.DiscVirtioHotPlug != nil { + if !IsNil(o.DiscVirtioHotPlug) { toSerialize["discVirtioHotPlug"] = o.DiscVirtioHotPlug } - - if o.DiscVirtioHotUnplug != nil { + if !IsNil(o.DiscVirtioHotUnplug) { toSerialize["discVirtioHotUnplug"] = o.DiscVirtioHotUnplug } - - if o.DiscScsiHotPlug != nil { + if !IsNil(o.DiscScsiHotPlug) { toSerialize["discScsiHotPlug"] = o.DiscScsiHotPlug } - - if o.ExposeSerial != nil { + if !IsNil(o.ExposeSerial) { toSerialize["exposeSerial"] = o.ExposeSerial } - - if o.DiscScsiHotUnplug != nil { + if !IsNil(o.DiscScsiHotUnplug) { toSerialize["discScsiHotUnplug"] = o.DiscScsiHotUnplug } - - if o.LicenceType != nil { + if !IsNil(o.LicenceType) { toSerialize["licenceType"] = o.LicenceType } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableSnapshotProperties struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_snapshots.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_snapshots.go similarity index 64% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_snapshots.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_snapshots.go index d6726e731..22be6d682 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_snapshots.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_snapshots.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the Snapshots type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Snapshots{} + // Snapshots struct for Snapshots type Snapshots struct { // The resource's unique identifier. @@ -23,7 +26,7 @@ type Snapshots struct { // URL to the object representation (absolute path). Href *string `json:"href,omitempty"` // Array of items in the collection. - Items *[]Snapshot `json:"items,omitempty"` + Items []Snapshot `json:"items,omitempty"` } // NewSnapshots instantiates a new Snapshots object @@ -44,177 +47,157 @@ func NewSnapshotsWithDefaults() *Snapshots { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *Snapshots) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *Snapshots) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *Snapshots) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *Snapshots) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *Snapshots) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *Snapshots) GetType() *Type { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Snapshots) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *Snapshots) GetType() Type { + if o == nil || IsNil(o.Type) { + var ret Type + return ret + } + return *o.Type } -// GetTypeOk returns a tuple with the Type field value +// GetTypeOk returns a tuple with the Type 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 *Snapshots) GetTypeOk() (*Type, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *Snapshots) SetType(v Type) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *Snapshots) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *Snapshots) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given Type and assigns it to the Type field. +func (o *Snapshots) SetType(v Type) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *Snapshots) 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 +// GetHrefOk returns a tuple with the Href 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 *Snapshots) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *Snapshots) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *Snapshots) HasHref() bool { - if o != nil && o.Href != nil { + if o != nil && !IsNil(o.Href) { return true } return false } -// GetItems returns the Items field value -// If the value is explicit nil, nil is returned -func (o *Snapshots) GetItems() *[]Snapshot { - if o == nil { - return nil - } +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *Snapshots) SetHref(v string) { + o.Href = &v +} +// GetItems returns the Items field value if set, zero value otherwise. +func (o *Snapshots) GetItems() []Snapshot { + if o == nil || IsNil(o.Items) { + var ret []Snapshot + return ret + } return o.Items - } -// GetItemsOk returns a tuple with the Items field value +// GetItemsOk returns a tuple with the Items 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 *Snapshots) GetItemsOk() (*[]Snapshot, bool) { - if o == nil { +func (o *Snapshots) GetItemsOk() ([]Snapshot, bool) { + if o == nil || IsNil(o.Items) { return nil, false } - return o.Items, true } -// SetItems sets field value -func (o *Snapshots) SetItems(v []Snapshot) { - - o.Items = &v - -} - // HasItems returns a boolean if a field has been set. func (o *Snapshots) HasItems() bool { - if o != nil && o.Items != nil { + if o != nil && !IsNil(o.Items) { return true } return false } +// SetItems gets a reference to the given []Snapshot and assigns it to the Items field. +func (o *Snapshots) SetItems(v []Snapshot) { + o.Items = v +} + func (o Snapshots) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Snapshots) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Items != nil { + if !IsNil(o.Items) { toSerialize["items"] = o.Items } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableSnapshots struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_target_group.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_target_group.go similarity index 65% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_target_group.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_target_group.go index ed83d9b31..2974ae729 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_target_group.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_target_group.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the TargetGroup type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &TargetGroup{} + // TargetGroup struct for TargetGroup type TargetGroup struct { // The resource's unique identifier. @@ -23,7 +26,7 @@ type TargetGroup struct { // The URL to the object representation (absolute path). Href *string `json:"href,omitempty"` Metadata *DatacenterElementMetadata `json:"metadata,omitempty"` - Properties *TargetGroupProperties `json:"properties"` + Properties TargetGroupProperties `json:"properties"` } // NewTargetGroup instantiates a new TargetGroup object @@ -33,7 +36,7 @@ type TargetGroup struct { func NewTargetGroup(properties TargetGroupProperties) *TargetGroup { this := TargetGroup{} - this.Properties = &properties + this.Properties = properties return &this } @@ -46,219 +49,182 @@ func NewTargetGroupWithDefaults() *TargetGroup { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *TargetGroup) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *TargetGroup) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *TargetGroup) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *TargetGroup) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *TargetGroup) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *TargetGroup) GetType() *Type { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *TargetGroup) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *TargetGroup) GetType() Type { + if o == nil || IsNil(o.Type) { + var ret Type + return ret + } + return *o.Type } -// GetTypeOk returns a tuple with the Type field value +// GetTypeOk returns a tuple with the Type 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 *TargetGroup) GetTypeOk() (*Type, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *TargetGroup) SetType(v Type) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *TargetGroup) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *TargetGroup) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given Type and assigns it to the Type field. +func (o *TargetGroup) SetType(v Type) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *TargetGroup) 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 +// GetHrefOk returns a tuple with the Href 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 *TargetGroup) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *TargetGroup) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *TargetGroup) HasHref() bool { - if o != nil && o.Href != nil { + if o != nil && !IsNil(o.Href) { return true } return false } -// GetMetadata returns the Metadata field value -// If the value is explicit nil, nil is returned -func (o *TargetGroup) GetMetadata() *DatacenterElementMetadata { - if o == nil { - return nil - } - - return o.Metadata +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *TargetGroup) SetHref(v string) { + o.Href = &v +} +// GetMetadata returns the Metadata field value if set, zero value otherwise. +func (o *TargetGroup) GetMetadata() DatacenterElementMetadata { + if o == nil || IsNil(o.Metadata) { + var ret DatacenterElementMetadata + return ret + } + return *o.Metadata } -// GetMetadataOk returns a tuple with the Metadata field value +// GetMetadataOk returns a tuple with the Metadata 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 *TargetGroup) GetMetadataOk() (*DatacenterElementMetadata, bool) { - if o == nil { + if o == nil || IsNil(o.Metadata) { return nil, false } - return o.Metadata, true } -// SetMetadata sets field value -func (o *TargetGroup) SetMetadata(v DatacenterElementMetadata) { - - o.Metadata = &v - -} - // HasMetadata returns a boolean if a field has been set. func (o *TargetGroup) HasMetadata() bool { - if o != nil && o.Metadata != nil { + if o != nil && !IsNil(o.Metadata) { return true } return false } +// SetMetadata gets a reference to the given DatacenterElementMetadata and assigns it to the Metadata field. +func (o *TargetGroup) SetMetadata(v DatacenterElementMetadata) { + o.Metadata = &v +} + // GetProperties returns the Properties field value -// If the value is explicit nil, nil is returned -func (o *TargetGroup) GetProperties() *TargetGroupProperties { +func (o *TargetGroup) GetProperties() TargetGroupProperties { if o == nil { - return nil + var ret TargetGroupProperties + return ret } return o.Properties - } // GetPropertiesOk returns a tuple with the Properties field value // 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 *TargetGroup) GetPropertiesOk() (*TargetGroupProperties, bool) { if o == nil { return nil, false } - - return o.Properties, true + return &o.Properties, true } // SetProperties sets field value func (o *TargetGroup) SetProperties(v TargetGroupProperties) { - - o.Properties = &v - + o.Properties = v } -// HasProperties returns a boolean if a field has been set. -func (o *TargetGroup) HasProperties() bool { - if o != nil && o.Properties != nil { - return true +func (o TargetGroup) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } - - return false + return json.Marshal(toSerialize) } -func (o TargetGroup) MarshalJSON() ([]byte, error) { +func (o TargetGroup) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Metadata != nil { + if !IsNil(o.Metadata) { toSerialize["metadata"] = o.Metadata } - - if o.Properties != nil { - toSerialize["properties"] = o.Properties - } - - return json.Marshal(toSerialize) + toSerialize["properties"] = o.Properties + return toSerialize, nil } type NullableTargetGroup struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_target_group_health_check.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_target_group_health_check.go similarity index 72% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_target_group_health_check.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_target_group_health_check.go index 93c4839a1..938cab538 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_target_group_health_check.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_target_group_health_check.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the TargetGroupHealthCheck type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &TargetGroupHealthCheck{} + // TargetGroupHealthCheck struct for TargetGroupHealthCheck type TargetGroupHealthCheck struct { // The maximum time in milliseconds is to wait for a target to respond to a check. For target VMs with a 'Check Interval' set, the smaller of the two values is used once the TCP connection is established. @@ -42,135 +45,122 @@ func NewTargetGroupHealthCheckWithDefaults() *TargetGroupHealthCheck { return &this } -// GetCheckTimeout returns the CheckTimeout field value -// If the value is explicit nil, nil is returned -func (o *TargetGroupHealthCheck) GetCheckTimeout() *int32 { - if o == nil { - return nil +// GetCheckTimeout returns the CheckTimeout field value if set, zero value otherwise. +func (o *TargetGroupHealthCheck) GetCheckTimeout() int32 { + if o == nil || IsNil(o.CheckTimeout) { + var ret int32 + return ret } - - return o.CheckTimeout - + return *o.CheckTimeout } -// GetCheckTimeoutOk returns a tuple with the CheckTimeout field value +// GetCheckTimeoutOk returns a tuple with the CheckTimeout 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 *TargetGroupHealthCheck) GetCheckTimeoutOk() (*int32, bool) { - if o == nil { + if o == nil || IsNil(o.CheckTimeout) { return nil, false } - return o.CheckTimeout, true } -// SetCheckTimeout sets field value -func (o *TargetGroupHealthCheck) SetCheckTimeout(v int32) { - - o.CheckTimeout = &v - -} - // HasCheckTimeout returns a boolean if a field has been set. func (o *TargetGroupHealthCheck) HasCheckTimeout() bool { - if o != nil && o.CheckTimeout != nil { + if o != nil && !IsNil(o.CheckTimeout) { return true } return false } -// GetCheckInterval returns the CheckInterval field value -// If the value is explicit nil, nil is returned -func (o *TargetGroupHealthCheck) GetCheckInterval() *int32 { - if o == nil { - return nil - } - - return o.CheckInterval +// SetCheckTimeout gets a reference to the given int32 and assigns it to the CheckTimeout field. +func (o *TargetGroupHealthCheck) SetCheckTimeout(v int32) { + o.CheckTimeout = &v +} +// GetCheckInterval returns the CheckInterval field value if set, zero value otherwise. +func (o *TargetGroupHealthCheck) GetCheckInterval() int32 { + if o == nil || IsNil(o.CheckInterval) { + var ret int32 + return ret + } + return *o.CheckInterval } -// GetCheckIntervalOk returns a tuple with the CheckInterval field value +// GetCheckIntervalOk returns a tuple with the CheckInterval 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 *TargetGroupHealthCheck) GetCheckIntervalOk() (*int32, bool) { - if o == nil { + if o == nil || IsNil(o.CheckInterval) { return nil, false } - return o.CheckInterval, true } -// SetCheckInterval sets field value -func (o *TargetGroupHealthCheck) SetCheckInterval(v int32) { - - o.CheckInterval = &v - -} - // HasCheckInterval returns a boolean if a field has been set. func (o *TargetGroupHealthCheck) HasCheckInterval() bool { - if o != nil && o.CheckInterval != nil { + if o != nil && !IsNil(o.CheckInterval) { return true } return false } -// GetRetries returns the Retries field value -// If the value is explicit nil, nil is returned -func (o *TargetGroupHealthCheck) GetRetries() *int32 { - if o == nil { - return nil - } - - return o.Retries +// SetCheckInterval gets a reference to the given int32 and assigns it to the CheckInterval field. +func (o *TargetGroupHealthCheck) SetCheckInterval(v int32) { + o.CheckInterval = &v +} +// GetRetries returns the Retries field value if set, zero value otherwise. +func (o *TargetGroupHealthCheck) GetRetries() int32 { + if o == nil || IsNil(o.Retries) { + var ret int32 + return ret + } + return *o.Retries } -// GetRetriesOk returns a tuple with the Retries field value +// GetRetriesOk returns a tuple with the Retries 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 *TargetGroupHealthCheck) GetRetriesOk() (*int32, bool) { - if o == nil { + if o == nil || IsNil(o.Retries) { return nil, false } - return o.Retries, true } -// SetRetries sets field value -func (o *TargetGroupHealthCheck) SetRetries(v int32) { - - o.Retries = &v - -} - // HasRetries returns a boolean if a field has been set. func (o *TargetGroupHealthCheck) HasRetries() bool { - if o != nil && o.Retries != nil { + if o != nil && !IsNil(o.Retries) { return true } return false } +// SetRetries gets a reference to the given int32 and assigns it to the Retries field. +func (o *TargetGroupHealthCheck) SetRetries(v int32) { + o.Retries = &v +} + func (o TargetGroupHealthCheck) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o TargetGroupHealthCheck) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.CheckTimeout != nil { + if !IsNil(o.CheckTimeout) { toSerialize["checkTimeout"] = o.CheckTimeout } - - if o.CheckInterval != nil { + if !IsNil(o.CheckInterval) { toSerialize["checkInterval"] = o.CheckInterval } - - if o.Retries != nil { + if !IsNil(o.Retries) { toSerialize["retries"] = o.Retries } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableTargetGroupHealthCheck struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_target_group_http_health_check.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_target_group_http_health_check.go similarity index 67% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_target_group_http_health_check.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_target_group_http_health_check.go index da465fa6a..b2bcdea49 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_target_group_http_health_check.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_target_group_http_health_check.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the TargetGroupHttpHealthCheck type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &TargetGroupHttpHealthCheck{} + // TargetGroupHttpHealthCheck struct for TargetGroupHttpHealthCheck type TargetGroupHttpHealthCheck struct { // The destination URL for HTTP the health check; the default is '/'. @@ -21,9 +24,9 @@ type TargetGroupHttpHealthCheck struct { // The method used for the health check request. Method *string `json:"method,omitempty"` // Specify the target's response type to match ALB's request. - MatchType *string `json:"matchType"` + MatchType string `json:"matchType"` // The response returned by the request. It can be a status code or a response body depending on the definition of 'matchType'. - Response *string `json:"response"` + Response string `json:"response"` // Specifies whether to use a regular expression to parse the response body; the default value is 'FALSE'. By using regular expressions, you can flexibly customize the expected response from a healthy server. Regex *bool `json:"regex,omitempty"` // Specifies whether to negate an individual entry; the default value is 'FALSE'. @@ -37,8 +40,8 @@ type TargetGroupHttpHealthCheck struct { func NewTargetGroupHttpHealthCheck(matchType string, response string) *TargetGroupHttpHealthCheck { this := TargetGroupHttpHealthCheck{} - this.MatchType = &matchType - this.Response = &response + this.MatchType = matchType + this.Response = response return &this } @@ -51,261 +54,207 @@ func NewTargetGroupHttpHealthCheckWithDefaults() *TargetGroupHttpHealthCheck { return &this } -// GetPath returns the Path field value -// If the value is explicit nil, nil is returned -func (o *TargetGroupHttpHealthCheck) GetPath() *string { - if o == nil { - return nil +// GetPath returns the Path field value if set, zero value otherwise. +func (o *TargetGroupHttpHealthCheck) GetPath() string { + if o == nil || IsNil(o.Path) { + var ret string + return ret } - - return o.Path - + return *o.Path } -// GetPathOk returns a tuple with the Path field value +// GetPathOk returns a tuple with the Path 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 *TargetGroupHttpHealthCheck) GetPathOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Path) { return nil, false } - return o.Path, true } -// SetPath sets field value -func (o *TargetGroupHttpHealthCheck) SetPath(v string) { - - o.Path = &v - -} - // HasPath returns a boolean if a field has been set. func (o *TargetGroupHttpHealthCheck) HasPath() bool { - if o != nil && o.Path != nil { + if o != nil && !IsNil(o.Path) { return true } return false } -// GetMethod returns the Method field value -// If the value is explicit nil, nil is returned -func (o *TargetGroupHttpHealthCheck) GetMethod() *string { - if o == nil { - return nil - } - - return o.Method +// SetPath gets a reference to the given string and assigns it to the Path field. +func (o *TargetGroupHttpHealthCheck) SetPath(v string) { + o.Path = &v +} +// GetMethod returns the Method field value if set, zero value otherwise. +func (o *TargetGroupHttpHealthCheck) GetMethod() string { + if o == nil || IsNil(o.Method) { + var ret string + return ret + } + return *o.Method } -// GetMethodOk returns a tuple with the Method field value +// GetMethodOk returns a tuple with the Method 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 *TargetGroupHttpHealthCheck) GetMethodOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Method) { return nil, false } - return o.Method, true } -// SetMethod sets field value -func (o *TargetGroupHttpHealthCheck) SetMethod(v string) { - - o.Method = &v - -} - // HasMethod returns a boolean if a field has been set. func (o *TargetGroupHttpHealthCheck) HasMethod() bool { - if o != nil && o.Method != nil { + if o != nil && !IsNil(o.Method) { return true } return false } +// SetMethod gets a reference to the given string and assigns it to the Method field. +func (o *TargetGroupHttpHealthCheck) SetMethod(v string) { + o.Method = &v +} + // GetMatchType returns the MatchType field value -// If the value is explicit nil, nil is returned -func (o *TargetGroupHttpHealthCheck) GetMatchType() *string { +func (o *TargetGroupHttpHealthCheck) GetMatchType() string { if o == nil { - return nil + var ret string + return ret } return o.MatchType - } // GetMatchTypeOk returns a tuple with the MatchType field value // 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 *TargetGroupHttpHealthCheck) GetMatchTypeOk() (*string, bool) { if o == nil { return nil, false } - - return o.MatchType, true + return &o.MatchType, true } // SetMatchType sets field value func (o *TargetGroupHttpHealthCheck) SetMatchType(v string) { - - o.MatchType = &v - -} - -// HasMatchType returns a boolean if a field has been set. -func (o *TargetGroupHttpHealthCheck) HasMatchType() bool { - if o != nil && o.MatchType != nil { - return true - } - - return false + o.MatchType = v } // GetResponse returns the Response field value -// If the value is explicit nil, nil is returned -func (o *TargetGroupHttpHealthCheck) GetResponse() *string { +func (o *TargetGroupHttpHealthCheck) GetResponse() string { if o == nil { - return nil + var ret string + return ret } return o.Response - } // GetResponseOk returns a tuple with the Response field value // 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 *TargetGroupHttpHealthCheck) GetResponseOk() (*string, bool) { if o == nil { return nil, false } - - return o.Response, true + return &o.Response, true } // SetResponse sets field value func (o *TargetGroupHttpHealthCheck) SetResponse(v string) { - - o.Response = &v - -} - -// HasResponse returns a boolean if a field has been set. -func (o *TargetGroupHttpHealthCheck) HasResponse() bool { - if o != nil && o.Response != nil { - return true - } - - return false + o.Response = v } -// GetRegex returns the Regex field value -// If the value is explicit nil, nil is returned -func (o *TargetGroupHttpHealthCheck) GetRegex() *bool { - if o == nil { - return nil +// GetRegex returns the Regex field value if set, zero value otherwise. +func (o *TargetGroupHttpHealthCheck) GetRegex() bool { + if o == nil || IsNil(o.Regex) { + var ret bool + return ret } - - return o.Regex - + return *o.Regex } -// GetRegexOk returns a tuple with the Regex field value +// GetRegexOk returns a tuple with the Regex 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 *TargetGroupHttpHealthCheck) GetRegexOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.Regex) { return nil, false } - return o.Regex, true } -// SetRegex sets field value -func (o *TargetGroupHttpHealthCheck) SetRegex(v bool) { - - o.Regex = &v - -} - // HasRegex returns a boolean if a field has been set. func (o *TargetGroupHttpHealthCheck) HasRegex() bool { - if o != nil && o.Regex != nil { + if o != nil && !IsNil(o.Regex) { return true } return false } -// GetNegate returns the Negate field value -// If the value is explicit nil, nil is returned -func (o *TargetGroupHttpHealthCheck) GetNegate() *bool { - if o == nil { - return nil - } - - return o.Negate +// SetRegex gets a reference to the given bool and assigns it to the Regex field. +func (o *TargetGroupHttpHealthCheck) SetRegex(v bool) { + o.Regex = &v +} +// GetNegate returns the Negate field value if set, zero value otherwise. +func (o *TargetGroupHttpHealthCheck) GetNegate() bool { + if o == nil || IsNil(o.Negate) { + var ret bool + return ret + } + return *o.Negate } -// GetNegateOk returns a tuple with the Negate field value +// GetNegateOk returns a tuple with the Negate 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 *TargetGroupHttpHealthCheck) GetNegateOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.Negate) { return nil, false } - return o.Negate, true } -// SetNegate sets field value -func (o *TargetGroupHttpHealthCheck) SetNegate(v bool) { - - o.Negate = &v - -} - // HasNegate returns a boolean if a field has been set. func (o *TargetGroupHttpHealthCheck) HasNegate() bool { - if o != nil && o.Negate != nil { + if o != nil && !IsNil(o.Negate) { return true } return false } +// SetNegate gets a reference to the given bool and assigns it to the Negate field. +func (o *TargetGroupHttpHealthCheck) SetNegate(v bool) { + o.Negate = &v +} + func (o TargetGroupHttpHealthCheck) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o TargetGroupHttpHealthCheck) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Path != nil { + if !IsNil(o.Path) { toSerialize["path"] = o.Path } - - if o.Method != nil { + if !IsNil(o.Method) { toSerialize["method"] = o.Method } - - if o.MatchType != nil { - toSerialize["matchType"] = o.MatchType - } - - if o.Response != nil { - toSerialize["response"] = o.Response - } - - if o.Regex != nil { + toSerialize["matchType"] = o.MatchType + toSerialize["response"] = o.Response + if !IsNil(o.Regex) { toSerialize["regex"] = o.Regex } - - if o.Negate != nil { + if !IsNil(o.Negate) { toSerialize["negate"] = o.Negate } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableTargetGroupHttpHealthCheck struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_target_group_properties.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_target_group_properties.go similarity index 65% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_target_group_properties.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_target_group_properties.go index 66552c059..8edb1c8bd 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_target_group_properties.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_target_group_properties.go @@ -14,18 +14,21 @@ import ( "encoding/json" ) +// checks if the TargetGroupProperties type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &TargetGroupProperties{} + // TargetGroupProperties struct for TargetGroupProperties type TargetGroupProperties struct { // The target group name. - Name *string `json:"name"` + Name string `json:"name"` // The balancing algorithm. A balancing algorithm consists of predefined rules with the logic that a load balancer uses to distribute network traffic between servers. - **Round Robin**: Targets are served alternately according to their weighting. - **Least Connection**: The target with the least active connection is served. - **Random**: The targets are served based on a consistent pseudorandom algorithm. - **Source IP**: It is ensured that the same client IP address reaches the same target. - Algorithm *string `json:"algorithm"` + Algorithm string `json:"algorithm"` // The forwarding protocol. Only the value 'HTTP' is allowed. - Protocol *string `json:"protocol"` + Protocol string `json:"protocol"` // The forwarding protocol version. Value is ignored when protocol is not 'HTTP'. ProtocolVersion *string `json:"protocolVersion,omitempty"` // Array of items in the collection. - Targets *[]TargetGroupTarget `json:"targets,omitempty"` + Targets []TargetGroupTarget `json:"targets,omitempty"` HealthCheck *TargetGroupHealthCheck `json:"healthCheck,omitempty"` HttpHealthCheck *TargetGroupHttpHealthCheck `json:"httpHealthCheck,omitempty"` } @@ -37,9 +40,9 @@ type TargetGroupProperties struct { func NewTargetGroupProperties(name string, algorithm string, protocol string) *TargetGroupProperties { this := TargetGroupProperties{} - this.Name = &name - this.Algorithm = &algorithm - this.Protocol = &protocol + this.Name = name + this.Algorithm = algorithm + this.Protocol = protocol return &this } @@ -53,302 +56,231 @@ func NewTargetGroupPropertiesWithDefaults() *TargetGroupProperties { } // GetName returns the Name field value -// If the value is explicit nil, nil is returned -func (o *TargetGroupProperties) GetName() *string { +func (o *TargetGroupProperties) GetName() string { if o == nil { - return 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. -// NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *TargetGroupProperties) GetNameOk() (*string, bool) { if o == nil { return nil, false } - - return o.Name, true + return &o.Name, true } // SetName sets field value func (o *TargetGroupProperties) SetName(v string) { - - o.Name = &v - -} - -// HasName returns a boolean if a field has been set. -func (o *TargetGroupProperties) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false + o.Name = v } // GetAlgorithm returns the Algorithm field value -// If the value is explicit nil, nil is returned -func (o *TargetGroupProperties) GetAlgorithm() *string { +func (o *TargetGroupProperties) GetAlgorithm() string { if o == nil { - return nil + var ret string + return ret } return o.Algorithm - } // GetAlgorithmOk returns a tuple with the Algorithm field value // 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 *TargetGroupProperties) GetAlgorithmOk() (*string, bool) { if o == nil { return nil, false } - - return o.Algorithm, true + return &o.Algorithm, true } // SetAlgorithm sets field value func (o *TargetGroupProperties) SetAlgorithm(v string) { - - o.Algorithm = &v - -} - -// HasAlgorithm returns a boolean if a field has been set. -func (o *TargetGroupProperties) HasAlgorithm() bool { - if o != nil && o.Algorithm != nil { - return true - } - - return false + o.Algorithm = v } // GetProtocol returns the Protocol field value -// If the value is explicit nil, nil is returned -func (o *TargetGroupProperties) GetProtocol() *string { +func (o *TargetGroupProperties) GetProtocol() string { if o == nil { - return nil + var ret string + return ret } return o.Protocol - } // GetProtocolOk returns a tuple with the Protocol field value // 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 *TargetGroupProperties) GetProtocolOk() (*string, bool) { if o == nil { return nil, false } - - return o.Protocol, true + return &o.Protocol, true } // SetProtocol sets field value func (o *TargetGroupProperties) SetProtocol(v string) { - - o.Protocol = &v - + o.Protocol = v } -// HasProtocol returns a boolean if a field has been set. -func (o *TargetGroupProperties) HasProtocol() bool { - if o != nil && o.Protocol != nil { - return true +// GetProtocolVersion returns the ProtocolVersion field value if set, zero value otherwise. +func (o *TargetGroupProperties) GetProtocolVersion() string { + if o == nil || IsNil(o.ProtocolVersion) { + var ret string + return ret } - - return false + return *o.ProtocolVersion } -// GetProtocolVersion returns the ProtocolVersion field value -// If the value is explicit nil, nil is returned -func (o *TargetGroupProperties) GetProtocolVersion() *string { - if o == nil { - return nil - } - - return o.ProtocolVersion - -} - -// GetProtocolVersionOk returns a tuple with the ProtocolVersion field value +// GetProtocolVersionOk returns a tuple with the ProtocolVersion 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 *TargetGroupProperties) GetProtocolVersionOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.ProtocolVersion) { return nil, false } - return o.ProtocolVersion, true } -// SetProtocolVersion sets field value -func (o *TargetGroupProperties) SetProtocolVersion(v string) { - - o.ProtocolVersion = &v - -} - // HasProtocolVersion returns a boolean if a field has been set. func (o *TargetGroupProperties) HasProtocolVersion() bool { - if o != nil && o.ProtocolVersion != nil { + if o != nil && !IsNil(o.ProtocolVersion) { return true } return false } -// GetTargets returns the Targets field value -// If the value is explicit nil, nil is returned -func (o *TargetGroupProperties) GetTargets() *[]TargetGroupTarget { - if o == nil { - return nil - } +// SetProtocolVersion gets a reference to the given string and assigns it to the ProtocolVersion field. +func (o *TargetGroupProperties) SetProtocolVersion(v string) { + o.ProtocolVersion = &v +} +// GetTargets returns the Targets field value if set, zero value otherwise. +func (o *TargetGroupProperties) GetTargets() []TargetGroupTarget { + if o == nil || IsNil(o.Targets) { + var ret []TargetGroupTarget + return ret + } return o.Targets - } -// GetTargetsOk returns a tuple with the Targets field value +// GetTargetsOk returns a tuple with the Targets 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 *TargetGroupProperties) GetTargetsOk() (*[]TargetGroupTarget, bool) { - if o == nil { +func (o *TargetGroupProperties) GetTargetsOk() ([]TargetGroupTarget, bool) { + if o == nil || IsNil(o.Targets) { return nil, false } - return o.Targets, true } -// SetTargets sets field value -func (o *TargetGroupProperties) SetTargets(v []TargetGroupTarget) { - - o.Targets = &v - -} - // HasTargets returns a boolean if a field has been set. func (o *TargetGroupProperties) HasTargets() bool { - if o != nil && o.Targets != nil { + if o != nil && !IsNil(o.Targets) { return true } return false } -// GetHealthCheck returns the HealthCheck field value -// If the value is explicit nil, nil is returned -func (o *TargetGroupProperties) GetHealthCheck() *TargetGroupHealthCheck { - if o == nil { - return nil - } - - return o.HealthCheck +// SetTargets gets a reference to the given []TargetGroupTarget and assigns it to the Targets field. +func (o *TargetGroupProperties) SetTargets(v []TargetGroupTarget) { + o.Targets = v +} +// GetHealthCheck returns the HealthCheck field value if set, zero value otherwise. +func (o *TargetGroupProperties) GetHealthCheck() TargetGroupHealthCheck { + if o == nil || IsNil(o.HealthCheck) { + var ret TargetGroupHealthCheck + return ret + } + return *o.HealthCheck } -// GetHealthCheckOk returns a tuple with the HealthCheck field value +// GetHealthCheckOk returns a tuple with the HealthCheck 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 *TargetGroupProperties) GetHealthCheckOk() (*TargetGroupHealthCheck, bool) { - if o == nil { + if o == nil || IsNil(o.HealthCheck) { return nil, false } - return o.HealthCheck, true } -// SetHealthCheck sets field value -func (o *TargetGroupProperties) SetHealthCheck(v TargetGroupHealthCheck) { - - o.HealthCheck = &v - -} - // HasHealthCheck returns a boolean if a field has been set. func (o *TargetGroupProperties) HasHealthCheck() bool { - if o != nil && o.HealthCheck != nil { + if o != nil && !IsNil(o.HealthCheck) { return true } return false } -// GetHttpHealthCheck returns the HttpHealthCheck field value -// If the value is explicit nil, nil is returned -func (o *TargetGroupProperties) GetHttpHealthCheck() *TargetGroupHttpHealthCheck { - if o == nil { - return nil - } - - return o.HttpHealthCheck +// SetHealthCheck gets a reference to the given TargetGroupHealthCheck and assigns it to the HealthCheck field. +func (o *TargetGroupProperties) SetHealthCheck(v TargetGroupHealthCheck) { + o.HealthCheck = &v +} +// GetHttpHealthCheck returns the HttpHealthCheck field value if set, zero value otherwise. +func (o *TargetGroupProperties) GetHttpHealthCheck() TargetGroupHttpHealthCheck { + if o == nil || IsNil(o.HttpHealthCheck) { + var ret TargetGroupHttpHealthCheck + return ret + } + return *o.HttpHealthCheck } -// GetHttpHealthCheckOk returns a tuple with the HttpHealthCheck field value +// GetHttpHealthCheckOk returns a tuple with the HttpHealthCheck 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 *TargetGroupProperties) GetHttpHealthCheckOk() (*TargetGroupHttpHealthCheck, bool) { - if o == nil { + if o == nil || IsNil(o.HttpHealthCheck) { return nil, false } - return o.HttpHealthCheck, true } -// SetHttpHealthCheck sets field value -func (o *TargetGroupProperties) SetHttpHealthCheck(v TargetGroupHttpHealthCheck) { - - o.HttpHealthCheck = &v - -} - // HasHttpHealthCheck returns a boolean if a field has been set. func (o *TargetGroupProperties) HasHttpHealthCheck() bool { - if o != nil && o.HttpHealthCheck != nil { + if o != nil && !IsNil(o.HttpHealthCheck) { return true } return false } -func (o TargetGroupProperties) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.Name != nil { - toSerialize["name"] = o.Name - } - - if o.Algorithm != nil { - toSerialize["algorithm"] = o.Algorithm - } +// SetHttpHealthCheck gets a reference to the given TargetGroupHttpHealthCheck and assigns it to the HttpHealthCheck field. +func (o *TargetGroupProperties) SetHttpHealthCheck(v TargetGroupHttpHealthCheck) { + o.HttpHealthCheck = &v +} - if o.Protocol != nil { - toSerialize["protocol"] = o.Protocol +func (o TargetGroupProperties) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } + return json.Marshal(toSerialize) +} - if o.ProtocolVersion != nil { +func (o TargetGroupProperties) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["name"] = o.Name + toSerialize["algorithm"] = o.Algorithm + toSerialize["protocol"] = o.Protocol + if !IsNil(o.ProtocolVersion) { toSerialize["protocolVersion"] = o.ProtocolVersion } - - if o.Targets != nil { + if !IsNil(o.Targets) { toSerialize["targets"] = o.Targets } - - if o.HealthCheck != nil { + if !IsNil(o.HealthCheck) { toSerialize["healthCheck"] = o.HealthCheck } - - if o.HttpHealthCheck != nil { + if !IsNil(o.HttpHealthCheck) { toSerialize["httpHealthCheck"] = o.HttpHealthCheck } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableTargetGroupProperties struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_target_group_put.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_target_group_put.go similarity index 68% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_target_group_put.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_target_group_put.go index e7aad4fec..ac5502280 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_target_group_put.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_target_group_put.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the TargetGroupPut type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &TargetGroupPut{} + // TargetGroupPut struct for TargetGroupPut type TargetGroupPut struct { // The resource's unique identifier. @@ -21,8 +24,8 @@ type TargetGroupPut struct { // The type of object that has been created. Type *Type `json:"type,omitempty"` // The URL to the object representation (absolute path). - Href *string `json:"href,omitempty"` - Properties *TargetGroupProperties `json:"properties"` + Href *string `json:"href,omitempty"` + Properties TargetGroupProperties `json:"properties"` } // NewTargetGroupPut instantiates a new TargetGroupPut object @@ -32,7 +35,7 @@ type TargetGroupPut struct { func NewTargetGroupPut(properties TargetGroupProperties) *TargetGroupPut { this := TargetGroupPut{} - this.Properties = &properties + this.Properties = properties return &this } @@ -45,177 +48,147 @@ func NewTargetGroupPutWithDefaults() *TargetGroupPut { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *TargetGroupPut) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *TargetGroupPut) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *TargetGroupPut) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *TargetGroupPut) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *TargetGroupPut) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *TargetGroupPut) GetType() *Type { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *TargetGroupPut) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *TargetGroupPut) GetType() Type { + if o == nil || IsNil(o.Type) { + var ret Type + return ret + } + return *o.Type } -// GetTypeOk returns a tuple with the Type field value +// GetTypeOk returns a tuple with the Type 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 *TargetGroupPut) GetTypeOk() (*Type, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *TargetGroupPut) SetType(v Type) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *TargetGroupPut) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *TargetGroupPut) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given Type and assigns it to the Type field. +func (o *TargetGroupPut) SetType(v Type) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *TargetGroupPut) 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 +// GetHrefOk returns a tuple with the Href 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 *TargetGroupPut) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *TargetGroupPut) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *TargetGroupPut) HasHref() bool { - if o != nil && o.Href != nil { + 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 *TargetGroupPut) SetHref(v string) { + o.Href = &v +} + // GetProperties returns the Properties field value -// If the value is explicit nil, nil is returned -func (o *TargetGroupPut) GetProperties() *TargetGroupProperties { +func (o *TargetGroupPut) GetProperties() TargetGroupProperties { if o == nil { - return nil + var ret TargetGroupProperties + return ret } return o.Properties - } // GetPropertiesOk returns a tuple with the Properties field value // 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 *TargetGroupPut) GetPropertiesOk() (*TargetGroupProperties, bool) { if o == nil { return nil, false } - - return o.Properties, true + return &o.Properties, true } // SetProperties sets field value func (o *TargetGroupPut) SetProperties(v TargetGroupProperties) { - - o.Properties = &v - + o.Properties = v } -// HasProperties returns a boolean if a field has been set. -func (o *TargetGroupPut) HasProperties() bool { - if o != nil && o.Properties != nil { - return true +func (o TargetGroupPut) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } - - return false + return json.Marshal(toSerialize) } -func (o TargetGroupPut) MarshalJSON() ([]byte, error) { +func (o TargetGroupPut) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Properties != nil { - toSerialize["properties"] = o.Properties - } - - return json.Marshal(toSerialize) + toSerialize["properties"] = o.Properties + return toSerialize, nil } type NullableTargetGroupPut struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_target_group_target.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_target_group_target.go similarity index 70% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_target_group_target.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_target_group_target.go index 624c70d01..a442e24ed 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_target_group_target.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_target_group_target.go @@ -14,14 +14,17 @@ import ( "encoding/json" ) +// checks if the TargetGroupTarget type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &TargetGroupTarget{} + // TargetGroupTarget struct for TargetGroupTarget type TargetGroupTarget struct { // The IP address of the balanced target. - Ip *string `json:"ip"` + Ip string `json:"ip"` // The port of the balanced target service; the valid range is 1 to 65535. - Port *int32 `json:"port"` + Port int32 `json:"port"` // The traffic is distributed proportionally to target weight, which is the ratio of the total weight of all targets. A target with higher weight receives a larger share of traffic. The valid range is from 0 to 256; the default value is '1'. Targets with a weight of '0' do not participate in load balancing but still accept persistent connections. We recommend using values in the middle range to leave room for later adjustments. - Weight *int32 `json:"weight"` + Weight int32 `json:"weight"` // Proxy protocol version. ProxyProtocol *string `json:"proxyProtocol,omitempty"` // When the health check is enabled, the target is available only when it accepts regular TCP or HTTP connection attempts for state checking. The state check consists of one connection attempt with the target's address and port. The default value is 'TRUE'. @@ -37,9 +40,9 @@ type TargetGroupTarget struct { func NewTargetGroupTarget(ip string, port int32, weight int32) *TargetGroupTarget { this := TargetGroupTarget{} - this.Ip = &ip - this.Port = &port - this.Weight = &weight + this.Ip = ip + this.Port = port + this.Weight = weight var proxyProtocol string = "none" this.ProxyProtocol = &proxyProtocol @@ -57,260 +60,196 @@ func NewTargetGroupTargetWithDefaults() *TargetGroupTarget { } // GetIp returns the Ip field value -// If the value is explicit nil, nil is returned -func (o *TargetGroupTarget) GetIp() *string { +func (o *TargetGroupTarget) GetIp() string { if o == nil { - return nil + var ret string + return ret } return o.Ip - } // GetIpOk returns a tuple with the Ip field value // 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 *TargetGroupTarget) GetIpOk() (*string, bool) { if o == nil { return nil, false } - - return o.Ip, true + return &o.Ip, true } // SetIp sets field value func (o *TargetGroupTarget) SetIp(v string) { - - o.Ip = &v - -} - -// HasIp returns a boolean if a field has been set. -func (o *TargetGroupTarget) HasIp() bool { - if o != nil && o.Ip != nil { - return true - } - - return false + o.Ip = v } // GetPort returns the Port field value -// If the value is explicit nil, nil is returned -func (o *TargetGroupTarget) GetPort() *int32 { +func (o *TargetGroupTarget) GetPort() int32 { if o == nil { - return nil + var ret int32 + return ret } return o.Port - } // GetPortOk returns a tuple with the Port field value // 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 *TargetGroupTarget) GetPortOk() (*int32, bool) { if o == nil { return nil, false } - - return o.Port, true + return &o.Port, true } // SetPort sets field value func (o *TargetGroupTarget) SetPort(v int32) { - - o.Port = &v - -} - -// HasPort returns a boolean if a field has been set. -func (o *TargetGroupTarget) HasPort() bool { - if o != nil && o.Port != nil { - return true - } - - return false + o.Port = v } // GetWeight returns the Weight field value -// If the value is explicit nil, nil is returned -func (o *TargetGroupTarget) GetWeight() *int32 { +func (o *TargetGroupTarget) GetWeight() int32 { if o == nil { - return 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. -// NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *TargetGroupTarget) GetWeightOk() (*int32, bool) { if o == nil { return nil, false } - - return o.Weight, true + return &o.Weight, true } // SetWeight sets field value func (o *TargetGroupTarget) SetWeight(v int32) { - - o.Weight = &v - + o.Weight = v } -// HasWeight returns a boolean if a field has been set. -func (o *TargetGroupTarget) HasWeight() bool { - if o != nil && o.Weight != nil { - return true +// GetProxyProtocol returns the ProxyProtocol field value if set, zero value otherwise. +func (o *TargetGroupTarget) GetProxyProtocol() string { + if o == nil || IsNil(o.ProxyProtocol) { + var ret string + return ret } - - return false -} - -// GetProxyProtocol returns the ProxyProtocol field value -// If the value is explicit nil, nil is returned -func (o *TargetGroupTarget) GetProxyProtocol() *string { - if o == nil { - return nil - } - - return o.ProxyProtocol - + return *o.ProxyProtocol } -// GetProxyProtocolOk returns a tuple with the ProxyProtocol field value +// GetProxyProtocolOk returns a tuple with the ProxyProtocol 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 *TargetGroupTarget) GetProxyProtocolOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.ProxyProtocol) { return nil, false } - return o.ProxyProtocol, true } -// SetProxyProtocol sets field value -func (o *TargetGroupTarget) SetProxyProtocol(v string) { - - o.ProxyProtocol = &v - -} - // HasProxyProtocol returns a boolean if a field has been set. func (o *TargetGroupTarget) HasProxyProtocol() bool { - if o != nil && o.ProxyProtocol != nil { + if o != nil && !IsNil(o.ProxyProtocol) { return true } return false } -// GetHealthCheckEnabled returns the HealthCheckEnabled field value -// If the value is explicit nil, nil is returned -func (o *TargetGroupTarget) GetHealthCheckEnabled() *bool { - if o == nil { - return nil - } - - return o.HealthCheckEnabled +// SetProxyProtocol gets a reference to the given string and assigns it to the ProxyProtocol field. +func (o *TargetGroupTarget) SetProxyProtocol(v string) { + o.ProxyProtocol = &v +} +// GetHealthCheckEnabled returns the HealthCheckEnabled field value if set, zero value otherwise. +func (o *TargetGroupTarget) GetHealthCheckEnabled() bool { + if o == nil || IsNil(o.HealthCheckEnabled) { + var ret bool + return ret + } + return *o.HealthCheckEnabled } -// GetHealthCheckEnabledOk returns a tuple with the HealthCheckEnabled field value +// GetHealthCheckEnabledOk returns a tuple with the HealthCheckEnabled 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 *TargetGroupTarget) GetHealthCheckEnabledOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.HealthCheckEnabled) { return nil, false } - return o.HealthCheckEnabled, true } -// SetHealthCheckEnabled sets field value -func (o *TargetGroupTarget) SetHealthCheckEnabled(v bool) { - - o.HealthCheckEnabled = &v - -} - // HasHealthCheckEnabled returns a boolean if a field has been set. func (o *TargetGroupTarget) HasHealthCheckEnabled() bool { - if o != nil && o.HealthCheckEnabled != nil { + if o != nil && !IsNil(o.HealthCheckEnabled) { return true } return false } -// GetMaintenanceEnabled returns the MaintenanceEnabled field value -// If the value is explicit nil, nil is returned -func (o *TargetGroupTarget) GetMaintenanceEnabled() *bool { - if o == nil { - return nil - } - - return o.MaintenanceEnabled +// SetHealthCheckEnabled gets a reference to the given bool and assigns it to the HealthCheckEnabled field. +func (o *TargetGroupTarget) SetHealthCheckEnabled(v bool) { + o.HealthCheckEnabled = &v +} +// GetMaintenanceEnabled returns the MaintenanceEnabled field value if set, zero value otherwise. +func (o *TargetGroupTarget) GetMaintenanceEnabled() bool { + if o == nil || IsNil(o.MaintenanceEnabled) { + var ret bool + return ret + } + return *o.MaintenanceEnabled } -// GetMaintenanceEnabledOk returns a tuple with the MaintenanceEnabled field value +// GetMaintenanceEnabledOk returns a tuple with the MaintenanceEnabled 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 *TargetGroupTarget) GetMaintenanceEnabledOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.MaintenanceEnabled) { return nil, false } - return o.MaintenanceEnabled, true } -// SetMaintenanceEnabled sets field value -func (o *TargetGroupTarget) SetMaintenanceEnabled(v bool) { - - o.MaintenanceEnabled = &v - -} - // HasMaintenanceEnabled returns a boolean if a field has been set. func (o *TargetGroupTarget) HasMaintenanceEnabled() bool { - if o != nil && o.MaintenanceEnabled != nil { + if o != nil && !IsNil(o.MaintenanceEnabled) { return true } return false } -func (o TargetGroupTarget) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.Ip != nil { - toSerialize["ip"] = o.Ip - } - - if o.Port != nil { - toSerialize["port"] = o.Port - } +// SetMaintenanceEnabled gets a reference to the given bool and assigns it to the MaintenanceEnabled field. +func (o *TargetGroupTarget) SetMaintenanceEnabled(v bool) { + o.MaintenanceEnabled = &v +} - if o.Weight != nil { - toSerialize["weight"] = o.Weight +func (o TargetGroupTarget) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } + return json.Marshal(toSerialize) +} - if o.ProxyProtocol != nil { +func (o TargetGroupTarget) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["ip"] = o.Ip + toSerialize["port"] = o.Port + toSerialize["weight"] = o.Weight + if !IsNil(o.ProxyProtocol) { toSerialize["proxyProtocol"] = o.ProxyProtocol } - - if o.HealthCheckEnabled != nil { + if !IsNil(o.HealthCheckEnabled) { toSerialize["healthCheckEnabled"] = o.HealthCheckEnabled } - - if o.MaintenanceEnabled != nil { + if !IsNil(o.MaintenanceEnabled) { toSerialize["maintenanceEnabled"] = o.MaintenanceEnabled } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableTargetGroupTarget struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_target_groups.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_target_groups.go similarity index 60% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_target_groups.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_target_groups.go index 02ebe41a2..3cc061a93 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_target_groups.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_target_groups.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the TargetGroups type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &TargetGroups{} + // TargetGroups struct for TargetGroups type TargetGroups struct { // The resource's unique identifier. @@ -23,7 +26,7 @@ type TargetGroups struct { // The URL to the object representation (absolute path). Href *string `json:"href,omitempty"` // Array of items in the collection. - Items *[]TargetGroup `json:"items,omitempty"` + Items []TargetGroup `json:"items,omitempty"` // The offset, specified in the request (if not is specified, 0 is used by default). Offset *float32 `json:"offset,omitempty"` // The limit, specified in the request (if not specified, the endpoint's default pagination limit is used). @@ -49,303 +52,262 @@ func NewTargetGroupsWithDefaults() *TargetGroups { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *TargetGroups) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *TargetGroups) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *TargetGroups) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *TargetGroups) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *TargetGroups) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *TargetGroups) GetType() *Type { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *TargetGroups) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *TargetGroups) GetType() Type { + if o == nil || IsNil(o.Type) { + var ret Type + return ret + } + return *o.Type } -// GetTypeOk returns a tuple with the Type field value +// GetTypeOk returns a tuple with the Type 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 *TargetGroups) GetTypeOk() (*Type, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *TargetGroups) SetType(v Type) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *TargetGroups) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *TargetGroups) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given Type and assigns it to the Type field. +func (o *TargetGroups) SetType(v Type) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *TargetGroups) 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 +// GetHrefOk returns a tuple with the Href 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 *TargetGroups) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *TargetGroups) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *TargetGroups) HasHref() bool { - if o != nil && o.Href != nil { + if o != nil && !IsNil(o.Href) { return true } return false } -// GetItems returns the Items field value -// If the value is explicit nil, nil is returned -func (o *TargetGroups) GetItems() *[]TargetGroup { - if o == nil { - return nil - } +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *TargetGroups) SetHref(v string) { + o.Href = &v +} +// GetItems returns the Items field value if set, zero value otherwise. +func (o *TargetGroups) GetItems() []TargetGroup { + if o == nil || IsNil(o.Items) { + var ret []TargetGroup + return ret + } return o.Items - } -// GetItemsOk returns a tuple with the Items field value +// GetItemsOk returns a tuple with the Items 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 *TargetGroups) GetItemsOk() (*[]TargetGroup, bool) { - if o == nil { +func (o *TargetGroups) GetItemsOk() ([]TargetGroup, bool) { + if o == nil || IsNil(o.Items) { return nil, false } - return o.Items, true } -// SetItems sets field value -func (o *TargetGroups) SetItems(v []TargetGroup) { - - o.Items = &v - -} - // HasItems returns a boolean if a field has been set. func (o *TargetGroups) HasItems() bool { - if o != nil && o.Items != nil { + if o != nil && !IsNil(o.Items) { return true } return false } -// GetOffset returns the Offset field value -// If the value is explicit nil, nil is returned -func (o *TargetGroups) GetOffset() *float32 { - if o == nil { - return nil - } - - return o.Offset +// SetItems gets a reference to the given []TargetGroup and assigns it to the Items field. +func (o *TargetGroups) SetItems(v []TargetGroup) { + o.Items = v +} +// GetOffset returns the Offset field value if set, zero value otherwise. +func (o *TargetGroups) GetOffset() float32 { + if o == nil || IsNil(o.Offset) { + var ret float32 + return ret + } + return *o.Offset } -// GetOffsetOk returns a tuple with the Offset field value +// GetOffsetOk returns a tuple with the Offset 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 *TargetGroups) GetOffsetOk() (*float32, bool) { - if o == nil { + if o == nil || IsNil(o.Offset) { return nil, false } - return o.Offset, true } -// SetOffset sets field value -func (o *TargetGroups) SetOffset(v float32) { - - o.Offset = &v - -} - // HasOffset returns a boolean if a field has been set. func (o *TargetGroups) HasOffset() bool { - if o != nil && o.Offset != nil { + if o != nil && !IsNil(o.Offset) { return true } return false } -// GetLimit returns the Limit field value -// If the value is explicit nil, nil is returned -func (o *TargetGroups) GetLimit() *float32 { - if o == nil { - return nil - } - - return o.Limit +// SetOffset gets a reference to the given float32 and assigns it to the Offset field. +func (o *TargetGroups) SetOffset(v float32) { + o.Offset = &v +} +// GetLimit returns the Limit field value if set, zero value otherwise. +func (o *TargetGroups) GetLimit() float32 { + if o == nil || IsNil(o.Limit) { + var ret float32 + return ret + } + return *o.Limit } -// GetLimitOk returns a tuple with the Limit field value +// GetLimitOk returns a tuple with the Limit 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 *TargetGroups) GetLimitOk() (*float32, bool) { - if o == nil { + if o == nil || IsNil(o.Limit) { return nil, false } - return o.Limit, true } -// SetLimit sets field value -func (o *TargetGroups) SetLimit(v float32) { - - o.Limit = &v - -} - // HasLimit returns a boolean if a field has been set. func (o *TargetGroups) HasLimit() bool { - if o != nil && o.Limit != nil { + if o != nil && !IsNil(o.Limit) { return true } return false } -// GetLinks returns the Links field value -// If the value is explicit nil, nil is returned -func (o *TargetGroups) GetLinks() *PaginationLinks { - if o == nil { - return nil - } - - return o.Links +// SetLimit gets a reference to the given float32 and assigns it to the Limit field. +func (o *TargetGroups) SetLimit(v float32) { + o.Limit = &v +} +// GetLinks returns the Links field value if set, zero value otherwise. +func (o *TargetGroups) GetLinks() PaginationLinks { + if o == nil || IsNil(o.Links) { + var ret PaginationLinks + return ret + } + return *o.Links } -// GetLinksOk returns a tuple with the Links field value +// GetLinksOk returns a tuple with the Links 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 *TargetGroups) GetLinksOk() (*PaginationLinks, bool) { - if o == nil { + if o == nil || IsNil(o.Links) { return nil, false } - return o.Links, true } -// SetLinks sets field value -func (o *TargetGroups) SetLinks(v PaginationLinks) { - - o.Links = &v - -} - // HasLinks returns a boolean if a field has been set. func (o *TargetGroups) HasLinks() bool { - if o != nil && o.Links != nil { + if o != nil && !IsNil(o.Links) { return true } return false } +// SetLinks gets a reference to the given PaginationLinks and assigns it to the Links field. +func (o *TargetGroups) SetLinks(v PaginationLinks) { + o.Links = &v +} + func (o TargetGroups) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o TargetGroups) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Items != nil { + if !IsNil(o.Items) { toSerialize["items"] = o.Items } - - if o.Offset != nil { + if !IsNil(o.Offset) { toSerialize["offset"] = o.Offset } - - if o.Limit != nil { + if !IsNil(o.Limit) { toSerialize["limit"] = o.Limit } - - if o.Links != nil { + if !IsNil(o.Links) { toSerialize["_links"] = o.Links } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableTargetGroups struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_target_port_range.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_target_port_range.go similarity index 73% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_target_port_range.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_target_port_range.go index 901f9129c..df6384c2c 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_target_port_range.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_target_port_range.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the TargetPortRange type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &TargetPortRange{} + // TargetPortRange struct for TargetPortRange type TargetPortRange struct { // Target port range start associated with the NAT Gateway rule. @@ -40,93 +43,87 @@ func NewTargetPortRangeWithDefaults() *TargetPortRange { return &this } -// GetStart returns the Start field value -// If the value is explicit nil, nil is returned -func (o *TargetPortRange) GetStart() *int32 { - if o == nil { - return nil +// GetStart returns the Start field value if set, zero value otherwise. +func (o *TargetPortRange) GetStart() int32 { + if o == nil || IsNil(o.Start) { + var ret int32 + return ret } - - return o.Start - + return *o.Start } -// GetStartOk returns a tuple with the Start field value +// GetStartOk returns a tuple with the Start 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 *TargetPortRange) GetStartOk() (*int32, bool) { - if o == nil { + if o == nil || IsNil(o.Start) { return nil, false } - return o.Start, true } -// SetStart sets field value -func (o *TargetPortRange) SetStart(v int32) { - - o.Start = &v - -} - // HasStart returns a boolean if a field has been set. func (o *TargetPortRange) HasStart() bool { - if o != nil && o.Start != nil { + if o != nil && !IsNil(o.Start) { return true } return false } -// GetEnd returns the End field value -// If the value is explicit nil, nil is returned -func (o *TargetPortRange) GetEnd() *int32 { - if o == nil { - return nil - } - - return o.End +// SetStart gets a reference to the given int32 and assigns it to the Start field. +func (o *TargetPortRange) SetStart(v int32) { + o.Start = &v +} +// GetEnd returns the End field value if set, zero value otherwise. +func (o *TargetPortRange) GetEnd() int32 { + if o == nil || IsNil(o.End) { + var ret int32 + return ret + } + return *o.End } -// GetEndOk returns a tuple with the End field value +// GetEndOk returns a tuple with the End 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 *TargetPortRange) GetEndOk() (*int32, bool) { - if o == nil { + if o == nil || IsNil(o.End) { return nil, false } - return o.End, true } -// SetEnd sets field value -func (o *TargetPortRange) SetEnd(v int32) { - - o.End = &v - -} - // HasEnd returns a boolean if a field has been set. func (o *TargetPortRange) HasEnd() bool { - if o != nil && o.End != nil { + if o != nil && !IsNil(o.End) { return true } return false } +// SetEnd gets a reference to the given int32 and assigns it to the End field. +func (o *TargetPortRange) SetEnd(v int32) { + o.End = &v +} + func (o TargetPortRange) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o TargetPortRange) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Start != nil { + if !IsNil(o.Start) { toSerialize["start"] = o.Start } - - if o.End != nil { + if !IsNil(o.End) { toSerialize["end"] = o.End } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableTargetPortRange struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_template.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_template.go similarity index 65% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_template.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_template.go index 8a776ca5a..8c790c1f1 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_template.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_template.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the Template type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Template{} + // Template struct for Template type Template struct { // The resource's unique identifier. @@ -23,7 +26,7 @@ type Template struct { // The URL to the object representation (absolute path). Href *string `json:"href,omitempty"` Metadata *DatacenterElementMetadata `json:"metadata,omitempty"` - Properties *TemplateProperties `json:"properties"` + Properties TemplateProperties `json:"properties"` } // NewTemplate instantiates a new Template object @@ -33,7 +36,7 @@ type Template struct { func NewTemplate(properties TemplateProperties) *Template { this := Template{} - this.Properties = &properties + this.Properties = properties return &this } @@ -46,219 +49,182 @@ func NewTemplateWithDefaults() *Template { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *Template) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *Template) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *Template) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *Template) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *Template) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *Template) GetType() *Type { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Template) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *Template) GetType() Type { + if o == nil || IsNil(o.Type) { + var ret Type + return ret + } + return *o.Type } -// GetTypeOk returns a tuple with the Type field value +// GetTypeOk returns a tuple with the Type 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 *Template) GetTypeOk() (*Type, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *Template) SetType(v Type) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *Template) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *Template) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given Type and assigns it to the Type field. +func (o *Template) SetType(v Type) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *Template) 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 +// GetHrefOk returns a tuple with the Href 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 *Template) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *Template) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *Template) HasHref() bool { - if o != nil && o.Href != nil { + if o != nil && !IsNil(o.Href) { return true } return false } -// GetMetadata returns the Metadata field value -// If the value is explicit nil, nil is returned -func (o *Template) GetMetadata() *DatacenterElementMetadata { - if o == nil { - return nil - } - - return o.Metadata +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *Template) SetHref(v string) { + o.Href = &v +} +// GetMetadata returns the Metadata field value if set, zero value otherwise. +func (o *Template) GetMetadata() DatacenterElementMetadata { + if o == nil || IsNil(o.Metadata) { + var ret DatacenterElementMetadata + return ret + } + return *o.Metadata } -// GetMetadataOk returns a tuple with the Metadata field value +// GetMetadataOk returns a tuple with the Metadata 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 *Template) GetMetadataOk() (*DatacenterElementMetadata, bool) { - if o == nil { + if o == nil || IsNil(o.Metadata) { return nil, false } - return o.Metadata, true } -// SetMetadata sets field value -func (o *Template) SetMetadata(v DatacenterElementMetadata) { - - o.Metadata = &v - -} - // HasMetadata returns a boolean if a field has been set. func (o *Template) HasMetadata() bool { - if o != nil && o.Metadata != nil { + if o != nil && !IsNil(o.Metadata) { return true } return false } +// SetMetadata gets a reference to the given DatacenterElementMetadata and assigns it to the Metadata field. +func (o *Template) SetMetadata(v DatacenterElementMetadata) { + o.Metadata = &v +} + // GetProperties returns the Properties field value -// If the value is explicit nil, nil is returned -func (o *Template) GetProperties() *TemplateProperties { +func (o *Template) GetProperties() TemplateProperties { if o == nil { - return nil + var ret TemplateProperties + return ret } return o.Properties - } // GetPropertiesOk returns a tuple with the Properties field value // 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 *Template) GetPropertiesOk() (*TemplateProperties, bool) { if o == nil { return nil, false } - - return o.Properties, true + return &o.Properties, true } // SetProperties sets field value func (o *Template) SetProperties(v TemplateProperties) { - - o.Properties = &v - + o.Properties = v } -// HasProperties returns a boolean if a field has been set. -func (o *Template) HasProperties() bool { - if o != nil && o.Properties != nil { - return true +func (o Template) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } - - return false + return json.Marshal(toSerialize) } -func (o Template) MarshalJSON() ([]byte, error) { +func (o Template) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Metadata != nil { + if !IsNil(o.Metadata) { toSerialize["metadata"] = o.Metadata } - - if o.Properties != nil { - toSerialize["properties"] = o.Properties - } - - return json.Marshal(toSerialize) + toSerialize["properties"] = o.Properties + return toSerialize, nil } type NullableTemplate struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_template_properties.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_template_properties.go similarity index 63% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_template_properties.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_template_properties.go index 1abe6a258..597af30ea 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_template_properties.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_template_properties.go @@ -14,18 +14,21 @@ import ( "encoding/json" ) +// checks if the TemplateProperties type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &TemplateProperties{} + // TemplateProperties struct for TemplateProperties type TemplateProperties struct { // The resource name. - Name *string `json:"name"` + Name string `json:"name"` // The CPU cores count. - Cores *float32 `json:"cores"` + Cores float32 `json:"cores"` // The RAM size in MB. - Ram *float32 `json:"ram"` + Ram float32 `json:"ram"` // The storage size in GB. - StorageSize *float32 `json:"storageSize"` + StorageSize float32 `json:"storageSize"` // The description of the template. - Category *string `json:"category"` + Category string `json:"category"` } // NewTemplateProperties instantiates a new TemplateProperties object @@ -35,11 +38,11 @@ type TemplateProperties struct { func NewTemplateProperties(name string, cores float32, ram float32, storageSize float32, category string) *TemplateProperties { this := TemplateProperties{} - this.Name = &name - this.Cores = &cores - this.Ram = &ram - this.StorageSize = &storageSize - this.Category = &category + this.Name = name + this.Cores = cores + this.Ram = ram + this.StorageSize = storageSize + this.Category = category return &this } @@ -53,218 +56,141 @@ func NewTemplatePropertiesWithDefaults() *TemplateProperties { } // GetName returns the Name field value -// If the value is explicit nil, nil is returned -func (o *TemplateProperties) GetName() *string { +func (o *TemplateProperties) GetName() string { if o == nil { - return 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. -// NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *TemplateProperties) GetNameOk() (*string, bool) { if o == nil { return nil, false } - - return o.Name, true + return &o.Name, true } // SetName sets field value func (o *TemplateProperties) SetName(v string) { - - o.Name = &v - -} - -// HasName returns a boolean if a field has been set. -func (o *TemplateProperties) HasName() bool { - if o != nil && o.Name != nil { - return true - } - - return false + o.Name = v } // GetCores returns the Cores field value -// If the value is explicit nil, nil is returned -func (o *TemplateProperties) GetCores() *float32 { +func (o *TemplateProperties) GetCores() float32 { if o == nil { - return nil + var ret float32 + return ret } return o.Cores - } // GetCoresOk returns a tuple with the Cores field value // 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 *TemplateProperties) GetCoresOk() (*float32, bool) { if o == nil { return nil, false } - - return o.Cores, true + return &o.Cores, true } // SetCores sets field value func (o *TemplateProperties) SetCores(v float32) { - - o.Cores = &v - -} - -// HasCores returns a boolean if a field has been set. -func (o *TemplateProperties) HasCores() bool { - if o != nil && o.Cores != nil { - return true - } - - return false + o.Cores = v } // GetRam returns the Ram field value -// If the value is explicit nil, nil is returned -func (o *TemplateProperties) GetRam() *float32 { +func (o *TemplateProperties) GetRam() float32 { if o == nil { - return nil + var ret float32 + return ret } return o.Ram - } // GetRamOk returns a tuple with the Ram field value // 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 *TemplateProperties) GetRamOk() (*float32, bool) { if o == nil { return nil, false } - - return o.Ram, true + return &o.Ram, true } // SetRam sets field value func (o *TemplateProperties) SetRam(v float32) { - - o.Ram = &v - -} - -// HasRam returns a boolean if a field has been set. -func (o *TemplateProperties) HasRam() bool { - if o != nil && o.Ram != nil { - return true - } - - return false + o.Ram = v } // GetStorageSize returns the StorageSize field value -// If the value is explicit nil, nil is returned -func (o *TemplateProperties) GetStorageSize() *float32 { +func (o *TemplateProperties) GetStorageSize() float32 { if o == nil { - return nil + var ret float32 + return ret } return o.StorageSize - } // GetStorageSizeOk returns a tuple with the StorageSize field value // 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 *TemplateProperties) GetStorageSizeOk() (*float32, bool) { if o == nil { return nil, false } - - return o.StorageSize, true + return &o.StorageSize, true } // SetStorageSize sets field value func (o *TemplateProperties) SetStorageSize(v float32) { - - o.StorageSize = &v - -} - -// HasStorageSize returns a boolean if a field has been set. -func (o *TemplateProperties) HasStorageSize() bool { - if o != nil && o.StorageSize != nil { - return true - } - - return false + o.StorageSize = v } // GetCategory returns the Category field value -// If the value is explicit nil, nil is returned -func (o *TemplateProperties) GetCategory() *string { +func (o *TemplateProperties) GetCategory() string { if o == nil { - return nil + var ret string + return ret } return o.Category - } // GetCategoryOk returns a tuple with the Category field value // 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 *TemplateProperties) GetCategoryOk() (*string, bool) { if o == nil { return nil, false } - - return o.Category, true + return &o.Category, true } // SetCategory sets field value func (o *TemplateProperties) SetCategory(v string) { - - o.Category = &v - + o.Category = v } -// HasCategory returns a boolean if a field has been set. -func (o *TemplateProperties) HasCategory() bool { - if o != nil && o.Category != nil { - return true +func (o TemplateProperties) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } - - return false + return json.Marshal(toSerialize) } -func (o TemplateProperties) MarshalJSON() ([]byte, error) { +func (o TemplateProperties) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Name != nil { - toSerialize["name"] = o.Name - } - - if o.Cores != nil { - toSerialize["cores"] = o.Cores - } - - if o.Ram != nil { - toSerialize["ram"] = o.Ram - } - - if o.StorageSize != nil { - toSerialize["storageSize"] = o.StorageSize - } - - if o.Category != nil { - toSerialize["category"] = o.Category - } - - return json.Marshal(toSerialize) + toSerialize["name"] = o.Name + toSerialize["cores"] = o.Cores + toSerialize["ram"] = o.Ram + toSerialize["storageSize"] = o.StorageSize + toSerialize["category"] = o.Category + return toSerialize, nil } type NullableTemplateProperties struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_templates.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_templates.go similarity index 64% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_templates.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_templates.go index 4f7b789d7..023f3c4dd 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_templates.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_templates.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the Templates type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Templates{} + // Templates struct for Templates type Templates struct { // The resource's unique identifier. @@ -23,7 +26,7 @@ type Templates struct { // The URL to the object representation (absolute path). Href *string `json:"href,omitempty"` // Array of items in the collection. - Items *[]Template `json:"items,omitempty"` + Items []Template `json:"items,omitempty"` } // NewTemplates instantiates a new Templates object @@ -44,177 +47,157 @@ func NewTemplatesWithDefaults() *Templates { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *Templates) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *Templates) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *Templates) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *Templates) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *Templates) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *Templates) GetType() *Type { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Templates) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *Templates) GetType() Type { + if o == nil || IsNil(o.Type) { + var ret Type + return ret + } + return *o.Type } -// GetTypeOk returns a tuple with the Type field value +// GetTypeOk returns a tuple with the Type 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 *Templates) GetTypeOk() (*Type, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *Templates) SetType(v Type) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *Templates) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *Templates) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given Type and assigns it to the Type field. +func (o *Templates) SetType(v Type) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *Templates) 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 +// GetHrefOk returns a tuple with the Href 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 *Templates) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *Templates) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *Templates) HasHref() bool { - if o != nil && o.Href != nil { + if o != nil && !IsNil(o.Href) { return true } return false } -// GetItems returns the Items field value -// If the value is explicit nil, nil is returned -func (o *Templates) GetItems() *[]Template { - if o == nil { - return nil - } +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *Templates) SetHref(v string) { + o.Href = &v +} +// GetItems returns the Items field value if set, zero value otherwise. +func (o *Templates) GetItems() []Template { + if o == nil || IsNil(o.Items) { + var ret []Template + return ret + } return o.Items - } -// GetItemsOk returns a tuple with the Items field value +// GetItemsOk returns a tuple with the Items 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 *Templates) GetItemsOk() (*[]Template, bool) { - if o == nil { +func (o *Templates) GetItemsOk() ([]Template, bool) { + if o == nil || IsNil(o.Items) { return nil, false } - return o.Items, true } -// SetItems sets field value -func (o *Templates) SetItems(v []Template) { - - o.Items = &v - -} - // HasItems returns a boolean if a field has been set. func (o *Templates) HasItems() bool { - if o != nil && o.Items != nil { + if o != nil && !IsNil(o.Items) { return true } return false } +// SetItems gets a reference to the given []Template and assigns it to the Items field. +func (o *Templates) SetItems(v []Template) { + o.Items = v +} + func (o Templates) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Templates) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Items != nil { + if !IsNil(o.Items) { toSerialize["items"] = o.Items } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableTemplates struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_token.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_token.go similarity index 77% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_token.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_token.go index dc86c6ea0..8ef55e0b4 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_token.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_token.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the Token type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Token{} + // Token struct for Token type Token struct { // The jwToken for the server. @@ -38,51 +41,52 @@ func NewTokenWithDefaults() *Token { return &this } -// GetToken returns the Token field value -// If the value is explicit nil, nil is returned -func (o *Token) GetToken() *string { - if o == nil { - return nil +// GetToken returns the Token field value if set, zero value otherwise. +func (o *Token) GetToken() string { + if o == nil || IsNil(o.Token) { + var ret string + return ret } - - return o.Token - + return *o.Token } -// GetTokenOk returns a tuple with the Token field value +// GetTokenOk returns a tuple with the Token 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 *Token) GetTokenOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Token) { return nil, false } - return o.Token, true } -// SetToken sets field value -func (o *Token) SetToken(v string) { - - o.Token = &v - -} - // HasToken returns a boolean if a field has been set. func (o *Token) HasToken() bool { - if o != nil && o.Token != nil { + 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 *Token) SetToken(v string) { + o.Token = &v +} + func (o Token) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Token) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Token != nil { + if !IsNil(o.Token) { toSerialize["token"] = o.Token } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableToken struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_type.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_type.go similarity index 99% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_type.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_type.go index 6e1bb9c00..54277466c 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_type.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_type.go @@ -12,6 +12,7 @@ package ionoscloud import ( "encoding/json" + "fmt" ) diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_user.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_user.go similarity index 60% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_user.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_user.go index 2e69861e7..0f5776722 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_user.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_user.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the User type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &User{} + // User struct for User type User struct { // The resource's unique identifier. @@ -21,10 +24,10 @@ type User struct { // The type of object that has been created. Type *Type `json:"type,omitempty"` // URL to the object representation (absolute path). - Href *string `json:"href,omitempty"` - Metadata *UserMetadata `json:"metadata,omitempty"` - Properties *UserProperties `json:"properties"` - Entities *UsersEntities `json:"entities,omitempty"` + Href *string `json:"href,omitempty"` + Metadata *UserMetadata `json:"metadata,omitempty"` + Properties UserProperties `json:"properties"` + Entities *UsersEntities `json:"entities,omitempty"` } // NewUser instantiates a new User object @@ -34,7 +37,7 @@ type User struct { func NewUser(properties UserProperties) *User { this := User{} - this.Properties = &properties + this.Properties = properties return &this } @@ -47,261 +50,217 @@ func NewUserWithDefaults() *User { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *User) GetId() *string { - if o == nil { - return nil +// 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 - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *User) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *User) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *User) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *User) GetType() *Type { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *User) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *User) GetType() Type { + if o == nil || IsNil(o.Type) { + var ret Type + return ret + } + return *o.Type } -// GetTypeOk returns a tuple with the Type field value +// GetTypeOk returns a tuple with the Type 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 *User) GetTypeOk() (*Type, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *User) SetType(v Type) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *User) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *User) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given Type and assigns it to the Type field. +func (o *User) SetType(v Type) { + o.Type = &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 +// GetHrefOk returns a tuple with the Href 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 *User) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *User) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *User) HasHref() bool { - if o != nil && o.Href != nil { + if o != nil && !IsNil(o.Href) { return true } return false } -// GetMetadata returns the Metadata field value -// If the value is explicit nil, nil is returned -func (o *User) GetMetadata() *UserMetadata { - if o == nil { - return nil - } - - return o.Metadata +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *User) SetHref(v string) { + o.Href = &v +} +// GetMetadata returns the Metadata field value if set, zero value otherwise. +func (o *User) GetMetadata() UserMetadata { + if o == nil || IsNil(o.Metadata) { + var ret UserMetadata + return ret + } + return *o.Metadata } -// GetMetadataOk returns a tuple with the Metadata field value +// GetMetadataOk returns a tuple with the Metadata 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 *User) GetMetadataOk() (*UserMetadata, bool) { - if o == nil { + if o == nil || IsNil(o.Metadata) { return nil, false } - return o.Metadata, true } -// SetMetadata sets field value -func (o *User) SetMetadata(v UserMetadata) { - - o.Metadata = &v - -} - // HasMetadata returns a boolean if a field has been set. func (o *User) HasMetadata() bool { - if o != nil && o.Metadata != nil { + if o != nil && !IsNil(o.Metadata) { return true } return false } +// SetMetadata gets a reference to the given UserMetadata and assigns it to the Metadata field. +func (o *User) SetMetadata(v UserMetadata) { + o.Metadata = &v +} + // GetProperties returns the Properties field value -// If the value is explicit nil, nil is returned -func (o *User) GetProperties() *UserProperties { +func (o *User) GetProperties() UserProperties { if o == nil { - return nil + var ret UserProperties + return ret } return o.Properties - } // GetPropertiesOk returns a tuple with the Properties field value // 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 *User) GetPropertiesOk() (*UserProperties, bool) { if o == nil { return nil, false } - - return o.Properties, true + return &o.Properties, true } // SetProperties sets field value func (o *User) SetProperties(v UserProperties) { - - o.Properties = &v - -} - -// HasProperties returns a boolean if a field has been set. -func (o *User) HasProperties() bool { - if o != nil && o.Properties != nil { - return true - } - - return false + o.Properties = v } -// GetEntities returns the Entities field value -// If the value is explicit nil, nil is returned -func (o *User) GetEntities() *UsersEntities { - if o == nil { - return nil +// GetEntities returns the Entities field value if set, zero value otherwise. +func (o *User) GetEntities() UsersEntities { + if o == nil || IsNil(o.Entities) { + var ret UsersEntities + return ret } - - return o.Entities - + return *o.Entities } -// GetEntitiesOk returns a tuple with the Entities field value +// GetEntitiesOk returns a tuple with the Entities 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 *User) GetEntitiesOk() (*UsersEntities, bool) { - if o == nil { + if o == nil || IsNil(o.Entities) { return nil, false } - return o.Entities, true } -// SetEntities sets field value -func (o *User) SetEntities(v UsersEntities) { - - o.Entities = &v - -} - // HasEntities returns a boolean if a field has been set. func (o *User) HasEntities() bool { - if o != nil && o.Entities != nil { + if o != nil && !IsNil(o.Entities) { return true } return false } +// SetEntities gets a reference to the given UsersEntities and assigns it to the Entities field. +func (o *User) SetEntities(v UsersEntities) { + o.Entities = &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 o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Metadata != nil { + if !IsNil(o.Metadata) { toSerialize["metadata"] = o.Metadata } - - if o.Properties != nil { - toSerialize["properties"] = o.Properties - } - - if o.Entities != nil { + toSerialize["properties"] = o.Properties + if !IsNil(o.Entities) { toSerialize["entities"] = o.Entities } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableUser struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_user_group_post.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_user_group_post.go similarity index 85% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_user_group_post.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_user_group_post.go index dea6edca7..417dd4348 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_user_group_post.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_user_group_post.go @@ -14,10 +14,13 @@ import ( "encoding/json" ) +// checks if the UserGroupPost type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UserGroupPost{} + // UserGroupPost struct for UserGroupPost type UserGroupPost struct { // The resource's unique identifier. - Id *string `json:"id"` + Id string `json:"id"` } // NewUserGroupPost instantiates a new UserGroupPost object @@ -27,7 +30,7 @@ type UserGroupPost struct { func NewUserGroupPost(id string) *UserGroupPost { this := UserGroupPost{} - this.Id = &id + this.Id = id return &this } @@ -41,50 +44,41 @@ func NewUserGroupPostWithDefaults() *UserGroupPost { } // GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *UserGroupPost) GetId() *string { +func (o *UserGroupPost) GetId() string { if o == nil { - return 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. -// NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *UserGroupPost) GetIdOk() (*string, bool) { if o == nil { return nil, false } - - return o.Id, true + return &o.Id, true } // SetId sets field value func (o *UserGroupPost) SetId(v string) { - - o.Id = &v - + o.Id = v } -// HasId returns a boolean if a field has been set. -func (o *UserGroupPost) HasId() bool { - if o != nil && o.Id != nil { - return true +func (o UserGroupPost) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } - - return false + return json.Marshal(toSerialize) } -func (o UserGroupPost) MarshalJSON() ([]byte, error) { +func (o UserGroupPost) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { - toSerialize["id"] = o.Id - } - - return json.Marshal(toSerialize) + toSerialize["id"] = o.Id + return toSerialize, nil } type NullableUserGroupPost struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_user_metadata.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_user_metadata.go similarity index 62% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_user_metadata.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_user_metadata.go index 64fff33a6..b826b2cae 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_user_metadata.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_user_metadata.go @@ -12,27 +12,31 @@ package ionoscloud import ( "encoding/json" + "time" ) +// checks if the UserMetadata type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UserMetadata{} + // UserMetadata struct for UserMetadata type UserMetadata struct { // Resource's Entity Tag as defined in http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.11 Entity Tag is also added as an 'ETag response header to requests which don't use 'depth' parameter. Etag *string `json:"etag,omitempty"` // The time the user was created. - CreatedDate *IonosTime + CreatedDate *IonosTime `json:"createdDate,omitempty"` // The user who has created the resource. CreatedBy *string `json:"createdBy,omitempty"` // The unique ID of the user who created the resource. CreatedByUserId *string `json:"createdByUserId,omitempty"` // The last time the resource was modified. - LastModifiedDate *IonosTime + LastModifiedDate *IonosTime `json:"lastModifiedDate,omitempty"` // The user who last modified the resource. LastModifiedBy *string `json:"lastModifiedBy,omitempty"` // The unique ID of the user who last modified the resource. LastModifiedByUserId *string `json:"lastModifiedByUserId,omitempty"` // The time of the last login by the user. - LastLogin *IonosTime + LastLogin *IonosTime `json:"lastLogin,omitempty"` } // NewUserMetadata instantiates a new UserMetadata object @@ -53,366 +57,297 @@ func NewUserMetadataWithDefaults() *UserMetadata { return &this } -// GetEtag returns the Etag field value -// If the value is explicit nil, nil is returned -func (o *UserMetadata) GetEtag() *string { - if o == nil { - return nil +// GetEtag returns the Etag field value if set, zero value otherwise. +func (o *UserMetadata) GetEtag() string { + if o == nil || IsNil(o.Etag) { + var ret string + return ret } - - return o.Etag - + return *o.Etag } -// GetEtagOk returns a tuple with the Etag field value +// GetEtagOk returns a tuple with the Etag 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 *UserMetadata) GetEtagOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Etag) { return nil, false } - return o.Etag, true } -// SetEtag sets field value -func (o *UserMetadata) SetEtag(v string) { - - o.Etag = &v - -} - // HasEtag returns a boolean if a field has been set. func (o *UserMetadata) HasEtag() bool { - if o != nil && o.Etag != nil { + if o != nil && !IsNil(o.Etag) { return true } return false } -// GetCreatedDate returns the CreatedDate field value -// If the value is explicit nil, nil is returned -func (o *UserMetadata) GetCreatedDate() *time.Time { - if o == nil { - return nil - } +// SetEtag gets a reference to the given string and assigns it to the Etag field. +func (o *UserMetadata) SetEtag(v string) { + o.Etag = &v +} - if o.CreatedDate == nil { - return nil +// GetCreatedDate returns the CreatedDate field value if set, zero value otherwise. +func (o *UserMetadata) GetCreatedDate() time.Time { + if o == nil || IsNil(o.CreatedDate) { + var ret time.Time + return ret } - return &o.CreatedDate.Time - + return o.CreatedDate.Time } -// GetCreatedDateOk returns a tuple with the CreatedDate field value +// GetCreatedDateOk returns a tuple with the CreatedDate 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 *UserMetadata) GetCreatedDateOk() (*time.Time, bool) { - if o == nil { - return nil, false - } - - if o.CreatedDate == nil { + if o == nil || IsNil(o.CreatedDate) { return nil, false } return &o.CreatedDate.Time, true - -} - -// SetCreatedDate sets field value -func (o *UserMetadata) SetCreatedDate(v time.Time) { - - o.CreatedDate = &IonosTime{v} - } // HasCreatedDate returns a boolean if a field has been set. func (o *UserMetadata) HasCreatedDate() bool { - if o != nil && o.CreatedDate != nil { + if o != nil && !IsNil(o.CreatedDate) { return true } return false } -// GetCreatedBy returns the CreatedBy field value -// If the value is explicit nil, nil is returned -func (o *UserMetadata) GetCreatedBy() *string { - if o == nil { - return nil - } - - return o.CreatedBy +// SetCreatedDate gets a reference to the given time.Time and assigns it to the CreatedDate field. +func (o *UserMetadata) SetCreatedDate(v time.Time) { + o.CreatedDate = &IonosTime{v} +} +// GetCreatedBy returns the CreatedBy field value if set, zero value otherwise. +func (o *UserMetadata) GetCreatedBy() string { + if o == nil || IsNil(o.CreatedBy) { + var ret string + return ret + } + return *o.CreatedBy } -// GetCreatedByOk returns a tuple with the CreatedBy field value +// GetCreatedByOk returns a tuple with the CreatedBy 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 *UserMetadata) GetCreatedByOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.CreatedBy) { return nil, false } - return o.CreatedBy, true } -// SetCreatedBy sets field value -func (o *UserMetadata) SetCreatedBy(v string) { - - o.CreatedBy = &v - -} - // HasCreatedBy returns a boolean if a field has been set. func (o *UserMetadata) HasCreatedBy() bool { - if o != nil && o.CreatedBy != nil { + if o != nil && !IsNil(o.CreatedBy) { return true } return false } -// GetCreatedByUserId returns the CreatedByUserId field value -// If the value is explicit nil, nil is returned -func (o *UserMetadata) GetCreatedByUserId() *string { - if o == nil { - return nil - } - - return o.CreatedByUserId +// SetCreatedBy gets a reference to the given string and assigns it to the CreatedBy field. +func (o *UserMetadata) SetCreatedBy(v string) { + o.CreatedBy = &v +} +// GetCreatedByUserId returns the CreatedByUserId field value if set, zero value otherwise. +func (o *UserMetadata) GetCreatedByUserId() string { + if o == nil || IsNil(o.CreatedByUserId) { + var ret string + return ret + } + return *o.CreatedByUserId } -// GetCreatedByUserIdOk returns a tuple with the CreatedByUserId field value +// GetCreatedByUserIdOk returns a tuple with the CreatedByUserId 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 *UserMetadata) GetCreatedByUserIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.CreatedByUserId) { return nil, false } - return o.CreatedByUserId, true } -// SetCreatedByUserId sets field value -func (o *UserMetadata) SetCreatedByUserId(v string) { - - o.CreatedByUserId = &v - -} - // HasCreatedByUserId returns a boolean if a field has been set. func (o *UserMetadata) HasCreatedByUserId() bool { - if o != nil && o.CreatedByUserId != nil { + if o != nil && !IsNil(o.CreatedByUserId) { return true } return false } -// GetLastModifiedDate returns the LastModifiedDate field value -// If the value is explicit nil, nil is returned -func (o *UserMetadata) GetLastModifiedDate() *time.Time { - if o == nil { - return nil - } +// SetCreatedByUserId gets a reference to the given string and assigns it to the CreatedByUserId field. +func (o *UserMetadata) SetCreatedByUserId(v string) { + o.CreatedByUserId = &v +} - if o.LastModifiedDate == nil { - return nil +// GetLastModifiedDate returns the LastModifiedDate field value if set, zero value otherwise. +func (o *UserMetadata) GetLastModifiedDate() time.Time { + if o == nil || IsNil(o.LastModifiedDate) { + var ret time.Time + return ret } - return &o.LastModifiedDate.Time - + return o.LastModifiedDate.Time } -// GetLastModifiedDateOk returns a tuple with the LastModifiedDate field value +// GetLastModifiedDateOk returns a tuple with the LastModifiedDate 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 *UserMetadata) GetLastModifiedDateOk() (*time.Time, bool) { - if o == nil { - return nil, false - } - - if o.LastModifiedDate == nil { + if o == nil || IsNil(o.LastModifiedDate) { return nil, false } return &o.LastModifiedDate.Time, true - -} - -// SetLastModifiedDate sets field value -func (o *UserMetadata) SetLastModifiedDate(v time.Time) { - - o.LastModifiedDate = &IonosTime{v} - } // HasLastModifiedDate returns a boolean if a field has been set. func (o *UserMetadata) HasLastModifiedDate() bool { - if o != nil && o.LastModifiedDate != nil { + if o != nil && !IsNil(o.LastModifiedDate) { return true } return false } -// GetLastModifiedBy returns the LastModifiedBy field value -// If the value is explicit nil, nil is returned -func (o *UserMetadata) GetLastModifiedBy() *string { - if o == nil { - return nil - } - - return o.LastModifiedBy +// SetLastModifiedDate gets a reference to the given time.Time and assigns it to the LastModifiedDate field. +func (o *UserMetadata) SetLastModifiedDate(v time.Time) { + o.LastModifiedDate = &IonosTime{v} +} +// GetLastModifiedBy returns the LastModifiedBy field value if set, zero value otherwise. +func (o *UserMetadata) GetLastModifiedBy() string { + if o == nil || IsNil(o.LastModifiedBy) { + var ret string + return ret + } + return *o.LastModifiedBy } -// GetLastModifiedByOk returns a tuple with the LastModifiedBy field value +// GetLastModifiedByOk returns a tuple with the LastModifiedBy 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 *UserMetadata) GetLastModifiedByOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.LastModifiedBy) { return nil, false } - return o.LastModifiedBy, true } -// SetLastModifiedBy sets field value -func (o *UserMetadata) SetLastModifiedBy(v string) { - - o.LastModifiedBy = &v - -} - // HasLastModifiedBy returns a boolean if a field has been set. func (o *UserMetadata) HasLastModifiedBy() bool { - if o != nil && o.LastModifiedBy != nil { + if o != nil && !IsNil(o.LastModifiedBy) { return true } return false } -// GetLastModifiedByUserId returns the LastModifiedByUserId field value -// If the value is explicit nil, nil is returned -func (o *UserMetadata) GetLastModifiedByUserId() *string { - if o == nil { - return nil - } - - return o.LastModifiedByUserId +// SetLastModifiedBy gets a reference to the given string and assigns it to the LastModifiedBy field. +func (o *UserMetadata) SetLastModifiedBy(v string) { + o.LastModifiedBy = &v +} +// GetLastModifiedByUserId returns the LastModifiedByUserId field value if set, zero value otherwise. +func (o *UserMetadata) GetLastModifiedByUserId() string { + if o == nil || IsNil(o.LastModifiedByUserId) { + var ret string + return ret + } + return *o.LastModifiedByUserId } -// GetLastModifiedByUserIdOk returns a tuple with the LastModifiedByUserId field value +// GetLastModifiedByUserIdOk returns a tuple with the LastModifiedByUserId 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 *UserMetadata) GetLastModifiedByUserIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.LastModifiedByUserId) { return nil, false } - return o.LastModifiedByUserId, true } -// SetLastModifiedByUserId sets field value -func (o *UserMetadata) SetLastModifiedByUserId(v string) { - - o.LastModifiedByUserId = &v - -} - // HasLastModifiedByUserId returns a boolean if a field has been set. func (o *UserMetadata) HasLastModifiedByUserId() bool { - if o != nil && o.LastModifiedByUserId != nil { + if o != nil && !IsNil(o.LastModifiedByUserId) { return true } return false } -// GetLastLogin returns the LastLogin field value -// If the value is explicit nil, nil is returned -func (o *UserMetadata) GetLastLogin() *time.Time { - if o == nil { - return nil - } +// SetLastModifiedByUserId gets a reference to the given string and assigns it to the LastModifiedByUserId field. +func (o *UserMetadata) SetLastModifiedByUserId(v string) { + o.LastModifiedByUserId = &v +} - if o.LastLogin == nil { - return nil +// GetLastLogin returns the LastLogin field value if set, zero value otherwise. +func (o *UserMetadata) GetLastLogin() time.Time { + if o == nil || IsNil(o.LastLogin) { + var ret time.Time + return ret } - return &o.LastLogin.Time - + return o.LastLogin.Time } -// GetLastLoginOk returns a tuple with the LastLogin field value +// GetLastLoginOk returns a tuple with the LastLogin 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 *UserMetadata) GetLastLoginOk() (*time.Time, bool) { - if o == nil { - return nil, false - } - - if o.LastLogin == nil { + if o == nil || IsNil(o.LastLogin) { return nil, false } return &o.LastLogin.Time, true - -} - -// SetLastLogin sets field value -func (o *UserMetadata) SetLastLogin(v time.Time) { - - o.LastLogin = &IonosTime{v} - } // HasLastLogin returns a boolean if a field has been set. func (o *UserMetadata) HasLastLogin() bool { - if o != nil && o.LastLogin != nil { + if o != nil && !IsNil(o.LastLogin) { return true } return false } +// SetLastLogin gets a reference to the given time.Time and assigns it to the LastLogin field. +func (o *UserMetadata) SetLastLogin(v time.Time) { + o.LastLogin = &IonosTime{v} +} + func (o UserMetadata) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UserMetadata) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Etag != nil { + if !IsNil(o.Etag) { toSerialize["etag"] = o.Etag } - - if o.CreatedDate != nil { + if !IsNil(o.CreatedDate) { toSerialize["createdDate"] = o.CreatedDate } - - if o.CreatedBy != nil { + if !IsNil(o.CreatedBy) { toSerialize["createdBy"] = o.CreatedBy } - - if o.CreatedByUserId != nil { + if !IsNil(o.CreatedByUserId) { toSerialize["createdByUserId"] = o.CreatedByUserId } - - if o.LastModifiedDate != nil { + if !IsNil(o.LastModifiedDate) { toSerialize["lastModifiedDate"] = o.LastModifiedDate } - - if o.LastModifiedBy != nil { + if !IsNil(o.LastModifiedBy) { toSerialize["lastModifiedBy"] = o.LastModifiedBy } - - if o.LastModifiedByUserId != nil { + if !IsNil(o.LastModifiedByUserId) { toSerialize["lastModifiedByUserId"] = o.LastModifiedByUserId } - - if o.LastLogin != nil { + if !IsNil(o.LastLogin) { toSerialize["lastLogin"] = o.LastLogin } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableUserMetadata struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_user_post.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_user_post.go similarity index 81% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_user_post.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_user_post.go index 4d82a48fc..d4f91a924 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_user_post.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_user_post.go @@ -14,9 +14,12 @@ import ( "encoding/json" ) +// checks if the UserPost type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UserPost{} + // UserPost struct for UserPost type UserPost struct { - Properties *UserPropertiesPost `json:"properties"` + Properties UserPropertiesPost `json:"properties"` } // NewUserPost instantiates a new UserPost object @@ -26,7 +29,7 @@ type UserPost struct { func NewUserPost(properties UserPropertiesPost) *UserPost { this := UserPost{} - this.Properties = &properties + this.Properties = properties return &this } @@ -40,50 +43,41 @@ func NewUserPostWithDefaults() *UserPost { } // GetProperties returns the Properties field value -// If the value is explicit nil, nil is returned -func (o *UserPost) GetProperties() *UserPropertiesPost { +func (o *UserPost) GetProperties() UserPropertiesPost { if o == nil { - return nil + var ret UserPropertiesPost + return ret } return o.Properties - } // GetPropertiesOk returns a tuple with the Properties field value // 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 *UserPost) GetPropertiesOk() (*UserPropertiesPost, bool) { if o == nil { return nil, false } - - return o.Properties, true + return &o.Properties, true } // SetProperties sets field value func (o *UserPost) SetProperties(v UserPropertiesPost) { - - o.Properties = &v - + o.Properties = v } -// HasProperties returns a boolean if a field has been set. -func (o *UserPost) HasProperties() bool { - if o != nil && o.Properties != nil { - return true +func (o UserPost) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } - - return false + return json.Marshal(toSerialize) } -func (o UserPost) MarshalJSON() ([]byte, error) { +func (o UserPost) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Properties != nil { - toSerialize["properties"] = o.Properties - } - - return json.Marshal(toSerialize) + toSerialize["properties"] = o.Properties + return toSerialize, nil } type NullableUserPost struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_user_properties.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_user_properties.go similarity index 63% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_user_properties.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_user_properties.go index f9746581d..ee359c539 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_user_properties.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_user_properties.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the UserProperties type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UserProperties{} + // UserProperties struct for UserProperties type UserProperties struct { // The first name of the user. @@ -52,345 +55,297 @@ func NewUserPropertiesWithDefaults() *UserProperties { return &this } -// GetFirstname returns the Firstname field value -// If the value is explicit nil, nil is returned -func (o *UserProperties) GetFirstname() *string { - if o == nil { - return nil +// GetFirstname returns the Firstname field value if set, zero value otherwise. +func (o *UserProperties) GetFirstname() string { + if o == nil || IsNil(o.Firstname) { + var ret string + return ret } - - return o.Firstname - + return *o.Firstname } -// GetFirstnameOk returns a tuple with the Firstname field value +// GetFirstnameOk returns a tuple with the Firstname 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 *UserProperties) GetFirstnameOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Firstname) { return nil, false } - return o.Firstname, true } -// SetFirstname sets field value -func (o *UserProperties) SetFirstname(v string) { - - o.Firstname = &v - -} - // HasFirstname returns a boolean if a field has been set. func (o *UserProperties) HasFirstname() bool { - if o != nil && o.Firstname != nil { + if o != nil && !IsNil(o.Firstname) { return true } return false } -// GetLastname returns the Lastname field value -// If the value is explicit nil, nil is returned -func (o *UserProperties) GetLastname() *string { - if o == nil { - return nil - } - - return o.Lastname +// SetFirstname gets a reference to the given string and assigns it to the Firstname field. +func (o *UserProperties) SetFirstname(v string) { + o.Firstname = &v +} +// GetLastname returns the Lastname field value if set, zero value otherwise. +func (o *UserProperties) 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 +// GetLastnameOk returns a tuple with the Lastname 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 *UserProperties) GetLastnameOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Lastname) { return nil, false } - return o.Lastname, true } -// SetLastname sets field value -func (o *UserProperties) SetLastname(v string) { - - o.Lastname = &v - -} - // HasLastname returns a boolean if a field has been set. func (o *UserProperties) HasLastname() bool { - if o != nil && o.Lastname != nil { + if o != nil && !IsNil(o.Lastname) { return true } return false } -// GetEmail returns the Email field value -// If the value is explicit nil, nil is returned -func (o *UserProperties) GetEmail() *string { - if o == nil { - return nil - } - - return o.Email +// SetLastname gets a reference to the given string and assigns it to the Lastname field. +func (o *UserProperties) SetLastname(v string) { + o.Lastname = &v +} +// GetEmail returns the Email field value if set, zero value otherwise. +func (o *UserProperties) 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 +// GetEmailOk returns a tuple with the Email 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 *UserProperties) GetEmailOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Email) { return nil, false } - return o.Email, true } -// SetEmail sets field value -func (o *UserProperties) SetEmail(v string) { - - o.Email = &v - -} - // HasEmail returns a boolean if a field has been set. func (o *UserProperties) HasEmail() bool { - if o != nil && o.Email != nil { + if o != nil && !IsNil(o.Email) { return true } return false } -// GetAdministrator returns the Administrator field value -// If the value is explicit nil, nil is returned -func (o *UserProperties) GetAdministrator() *bool { - if o == nil { - return nil - } - - return o.Administrator +// SetEmail gets a reference to the given string and assigns it to the Email field. +func (o *UserProperties) SetEmail(v string) { + o.Email = &v +} +// GetAdministrator returns the Administrator field value if set, zero value otherwise. +func (o *UserProperties) GetAdministrator() bool { + if o == nil || IsNil(o.Administrator) { + var ret bool + return ret + } + return *o.Administrator } -// GetAdministratorOk returns a tuple with the Administrator field value +// GetAdministratorOk returns a tuple with the Administrator 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 *UserProperties) GetAdministratorOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.Administrator) { return nil, false } - return o.Administrator, true } -// SetAdministrator sets field value -func (o *UserProperties) SetAdministrator(v bool) { - - o.Administrator = &v - -} - // HasAdministrator returns a boolean if a field has been set. func (o *UserProperties) HasAdministrator() bool { - if o != nil && o.Administrator != nil { + if o != nil && !IsNil(o.Administrator) { return true } return false } -// GetForceSecAuth returns the ForceSecAuth field value -// If the value is explicit nil, nil is returned -func (o *UserProperties) GetForceSecAuth() *bool { - if o == nil { - return nil - } - - return o.ForceSecAuth +// SetAdministrator gets a reference to the given bool and assigns it to the Administrator field. +func (o *UserProperties) SetAdministrator(v bool) { + o.Administrator = &v +} +// GetForceSecAuth returns the ForceSecAuth field value if set, zero value otherwise. +func (o *UserProperties) GetForceSecAuth() bool { + if o == nil || IsNil(o.ForceSecAuth) { + var ret bool + return ret + } + return *o.ForceSecAuth } -// GetForceSecAuthOk returns a tuple with the ForceSecAuth field value +// GetForceSecAuthOk returns a tuple with the ForceSecAuth 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 *UserProperties) GetForceSecAuthOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.ForceSecAuth) { return nil, false } - return o.ForceSecAuth, true } -// SetForceSecAuth sets field value -func (o *UserProperties) SetForceSecAuth(v bool) { - - o.ForceSecAuth = &v - -} - // HasForceSecAuth returns a boolean if a field has been set. func (o *UserProperties) HasForceSecAuth() bool { - if o != nil && o.ForceSecAuth != nil { + if o != nil && !IsNil(o.ForceSecAuth) { return true } return false } -// GetSecAuthActive returns the SecAuthActive field value -// If the value is explicit nil, nil is returned -func (o *UserProperties) GetSecAuthActive() *bool { - if o == nil { - return nil - } - - return o.SecAuthActive +// SetForceSecAuth gets a reference to the given bool and assigns it to the ForceSecAuth field. +func (o *UserProperties) SetForceSecAuth(v bool) { + o.ForceSecAuth = &v +} +// GetSecAuthActive returns the SecAuthActive field value if set, zero value otherwise. +func (o *UserProperties) GetSecAuthActive() bool { + if o == nil || IsNil(o.SecAuthActive) { + var ret bool + return ret + } + return *o.SecAuthActive } -// GetSecAuthActiveOk returns a tuple with the SecAuthActive field value +// GetSecAuthActiveOk returns a tuple with the SecAuthActive 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 *UserProperties) GetSecAuthActiveOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.SecAuthActive) { return nil, false } - return o.SecAuthActive, true } -// SetSecAuthActive sets field value -func (o *UserProperties) SetSecAuthActive(v bool) { - - o.SecAuthActive = &v - -} - // HasSecAuthActive returns a boolean if a field has been set. func (o *UserProperties) HasSecAuthActive() bool { - if o != nil && o.SecAuthActive != nil { + if o != nil && !IsNil(o.SecAuthActive) { return true } return false } -// GetS3CanonicalUserId returns the S3CanonicalUserId field value -// If the value is explicit nil, nil is returned -func (o *UserProperties) GetS3CanonicalUserId() *string { - if o == nil { - return nil - } - - return o.S3CanonicalUserId +// SetSecAuthActive gets a reference to the given bool and assigns it to the SecAuthActive field. +func (o *UserProperties) SetSecAuthActive(v bool) { + o.SecAuthActive = &v +} +// GetS3CanonicalUserId returns the S3CanonicalUserId field value if set, zero value otherwise. +func (o *UserProperties) GetS3CanonicalUserId() string { + if o == nil || IsNil(o.S3CanonicalUserId) { + var ret string + return ret + } + return *o.S3CanonicalUserId } -// GetS3CanonicalUserIdOk returns a tuple with the S3CanonicalUserId field value +// GetS3CanonicalUserIdOk returns a tuple with the S3CanonicalUserId 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 *UserProperties) GetS3CanonicalUserIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.S3CanonicalUserId) { return nil, false } - return o.S3CanonicalUserId, true } -// SetS3CanonicalUserId sets field value -func (o *UserProperties) SetS3CanonicalUserId(v string) { - - o.S3CanonicalUserId = &v - -} - // HasS3CanonicalUserId returns a boolean if a field has been set. func (o *UserProperties) HasS3CanonicalUserId() bool { - if o != nil && o.S3CanonicalUserId != nil { + if o != nil && !IsNil(o.S3CanonicalUserId) { return true } return false } -// GetActive returns the Active field value -// If the value is explicit nil, nil is returned -func (o *UserProperties) GetActive() *bool { - if o == nil { - return nil - } - - return o.Active +// SetS3CanonicalUserId gets a reference to the given string and assigns it to the S3CanonicalUserId field. +func (o *UserProperties) SetS3CanonicalUserId(v string) { + o.S3CanonicalUserId = &v +} +// GetActive returns the Active field value if set, zero value otherwise. +func (o *UserProperties) GetActive() bool { + if o == nil || IsNil(o.Active) { + var ret bool + return ret + } + return *o.Active } -// GetActiveOk returns a tuple with the Active field value +// GetActiveOk returns a tuple with the Active 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 *UserProperties) GetActiveOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.Active) { return nil, false } - return o.Active, true } -// SetActive sets field value -func (o *UserProperties) SetActive(v bool) { - - o.Active = &v - -} - // HasActive returns a boolean if a field has been set. func (o *UserProperties) HasActive() bool { - if o != nil && o.Active != nil { + if o != nil && !IsNil(o.Active) { return true } return false } +// SetActive gets a reference to the given bool and assigns it to the Active field. +func (o *UserProperties) SetActive(v bool) { + o.Active = &v +} + func (o UserProperties) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UserProperties) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Firstname != nil { + if !IsNil(o.Firstname) { toSerialize["firstname"] = o.Firstname } - - if o.Lastname != nil { + if !IsNil(o.Lastname) { toSerialize["lastname"] = o.Lastname } - - if o.Email != nil { + if !IsNil(o.Email) { toSerialize["email"] = o.Email } - - if o.Administrator != nil { + if !IsNil(o.Administrator) { toSerialize["administrator"] = o.Administrator } - - if o.ForceSecAuth != nil { + if !IsNil(o.ForceSecAuth) { toSerialize["forceSecAuth"] = o.ForceSecAuth } - - if o.SecAuthActive != nil { + if !IsNil(o.SecAuthActive) { toSerialize["secAuthActive"] = o.SecAuthActive } - - if o.S3CanonicalUserId != nil { + if !IsNil(o.S3CanonicalUserId) { toSerialize["s3CanonicalUserId"] = o.S3CanonicalUserId } - - if o.Active != nil { + if !IsNil(o.Active) { toSerialize["active"] = o.Active } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableUserProperties struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_user_properties_post.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_user_properties_post.go similarity index 62% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_user_properties_post.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_user_properties_post.go index 23e3b5568..323b530c9 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_user_properties_post.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_user_properties_post.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the UserPropertiesPost type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UserPropertiesPost{} + // UserPropertiesPost struct for UserPropertiesPost type UserPropertiesPost struct { // The first name of the user. @@ -52,345 +55,297 @@ func NewUserPropertiesPostWithDefaults() *UserPropertiesPost { return &this } -// GetFirstname returns the Firstname field value -// If the value is explicit nil, nil is returned -func (o *UserPropertiesPost) GetFirstname() *string { - if o == nil { - return nil +// GetFirstname returns the Firstname field value if set, zero value otherwise. +func (o *UserPropertiesPost) GetFirstname() string { + if o == nil || IsNil(o.Firstname) { + var ret string + return ret } - - return o.Firstname - + return *o.Firstname } -// GetFirstnameOk returns a tuple with the Firstname field value +// GetFirstnameOk returns a tuple with the Firstname 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 *UserPropertiesPost) GetFirstnameOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Firstname) { return nil, false } - return o.Firstname, true } -// SetFirstname sets field value -func (o *UserPropertiesPost) SetFirstname(v string) { - - o.Firstname = &v - -} - // HasFirstname returns a boolean if a field has been set. func (o *UserPropertiesPost) HasFirstname() bool { - if o != nil && o.Firstname != nil { + if o != nil && !IsNil(o.Firstname) { return true } return false } -// GetLastname returns the Lastname field value -// If the value is explicit nil, nil is returned -func (o *UserPropertiesPost) GetLastname() *string { - if o == nil { - return nil - } - - return o.Lastname +// SetFirstname gets a reference to the given string and assigns it to the Firstname field. +func (o *UserPropertiesPost) SetFirstname(v string) { + o.Firstname = &v +} +// GetLastname returns the Lastname field value if set, zero value otherwise. +func (o *UserPropertiesPost) 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 +// GetLastnameOk returns a tuple with the Lastname 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 *UserPropertiesPost) GetLastnameOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Lastname) { return nil, false } - return o.Lastname, true } -// SetLastname sets field value -func (o *UserPropertiesPost) SetLastname(v string) { - - o.Lastname = &v - -} - // HasLastname returns a boolean if a field has been set. func (o *UserPropertiesPost) HasLastname() bool { - if o != nil && o.Lastname != nil { + if o != nil && !IsNil(o.Lastname) { return true } return false } -// GetEmail returns the Email field value -// If the value is explicit nil, nil is returned -func (o *UserPropertiesPost) GetEmail() *string { - if o == nil { - return nil - } - - return o.Email +// SetLastname gets a reference to the given string and assigns it to the Lastname field. +func (o *UserPropertiesPost) SetLastname(v string) { + o.Lastname = &v +} +// GetEmail returns the Email field value if set, zero value otherwise. +func (o *UserPropertiesPost) 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 +// GetEmailOk returns a tuple with the Email 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 *UserPropertiesPost) GetEmailOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Email) { return nil, false } - return o.Email, true } -// SetEmail sets field value -func (o *UserPropertiesPost) SetEmail(v string) { - - o.Email = &v - -} - // HasEmail returns a boolean if a field has been set. func (o *UserPropertiesPost) HasEmail() bool { - if o != nil && o.Email != nil { + if o != nil && !IsNil(o.Email) { return true } return false } -// GetAdministrator returns the Administrator field value -// If the value is explicit nil, nil is returned -func (o *UserPropertiesPost) GetAdministrator() *bool { - if o == nil { - return nil - } - - return o.Administrator +// SetEmail gets a reference to the given string and assigns it to the Email field. +func (o *UserPropertiesPost) SetEmail(v string) { + o.Email = &v +} +// GetAdministrator returns the Administrator field value if set, zero value otherwise. +func (o *UserPropertiesPost) GetAdministrator() bool { + if o == nil || IsNil(o.Administrator) { + var ret bool + return ret + } + return *o.Administrator } -// GetAdministratorOk returns a tuple with the Administrator field value +// GetAdministratorOk returns a tuple with the Administrator 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 *UserPropertiesPost) GetAdministratorOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.Administrator) { return nil, false } - return o.Administrator, true } -// SetAdministrator sets field value -func (o *UserPropertiesPost) SetAdministrator(v bool) { - - o.Administrator = &v - -} - // HasAdministrator returns a boolean if a field has been set. func (o *UserPropertiesPost) HasAdministrator() bool { - if o != nil && o.Administrator != nil { + if o != nil && !IsNil(o.Administrator) { return true } return false } -// GetForceSecAuth returns the ForceSecAuth field value -// If the value is explicit nil, nil is returned -func (o *UserPropertiesPost) GetForceSecAuth() *bool { - if o == nil { - return nil - } - - return o.ForceSecAuth +// SetAdministrator gets a reference to the given bool and assigns it to the Administrator field. +func (o *UserPropertiesPost) SetAdministrator(v bool) { + o.Administrator = &v +} +// GetForceSecAuth returns the ForceSecAuth field value if set, zero value otherwise. +func (o *UserPropertiesPost) GetForceSecAuth() bool { + if o == nil || IsNil(o.ForceSecAuth) { + var ret bool + return ret + } + return *o.ForceSecAuth } -// GetForceSecAuthOk returns a tuple with the ForceSecAuth field value +// GetForceSecAuthOk returns a tuple with the ForceSecAuth 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 *UserPropertiesPost) GetForceSecAuthOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.ForceSecAuth) { return nil, false } - return o.ForceSecAuth, true } -// SetForceSecAuth sets field value -func (o *UserPropertiesPost) SetForceSecAuth(v bool) { - - o.ForceSecAuth = &v - -} - // HasForceSecAuth returns a boolean if a field has been set. func (o *UserPropertiesPost) HasForceSecAuth() bool { - if o != nil && o.ForceSecAuth != nil { + if o != nil && !IsNil(o.ForceSecAuth) { return true } return false } -// GetSecAuthActive returns the SecAuthActive field value -// If the value is explicit nil, nil is returned -func (o *UserPropertiesPost) GetSecAuthActive() *bool { - if o == nil { - return nil - } - - return o.SecAuthActive +// SetForceSecAuth gets a reference to the given bool and assigns it to the ForceSecAuth field. +func (o *UserPropertiesPost) SetForceSecAuth(v bool) { + o.ForceSecAuth = &v +} +// GetSecAuthActive returns the SecAuthActive field value if set, zero value otherwise. +func (o *UserPropertiesPost) GetSecAuthActive() bool { + if o == nil || IsNil(o.SecAuthActive) { + var ret bool + return ret + } + return *o.SecAuthActive } -// GetSecAuthActiveOk returns a tuple with the SecAuthActive field value +// GetSecAuthActiveOk returns a tuple with the SecAuthActive 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 *UserPropertiesPost) GetSecAuthActiveOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.SecAuthActive) { return nil, false } - return o.SecAuthActive, true } -// SetSecAuthActive sets field value -func (o *UserPropertiesPost) SetSecAuthActive(v bool) { - - o.SecAuthActive = &v - -} - // HasSecAuthActive returns a boolean if a field has been set. func (o *UserPropertiesPost) HasSecAuthActive() bool { - if o != nil && o.SecAuthActive != nil { + if o != nil && !IsNil(o.SecAuthActive) { return true } return false } -// GetPassword returns the Password field value -// If the value is explicit nil, nil is returned -func (o *UserPropertiesPost) GetPassword() *string { - if o == nil { - return nil - } - - return o.Password +// SetSecAuthActive gets a reference to the given bool and assigns it to the SecAuthActive field. +func (o *UserPropertiesPost) SetSecAuthActive(v bool) { + o.SecAuthActive = &v +} +// GetPassword returns the Password field value if set, zero value otherwise. +func (o *UserPropertiesPost) 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 +// GetPasswordOk returns a tuple with the Password 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 *UserPropertiesPost) GetPasswordOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Password) { return nil, false } - return o.Password, true } -// SetPassword sets field value -func (o *UserPropertiesPost) SetPassword(v string) { - - o.Password = &v - -} - // HasPassword returns a boolean if a field has been set. func (o *UserPropertiesPost) HasPassword() bool { - if o != nil && o.Password != nil { + if o != nil && !IsNil(o.Password) { return true } return false } -// GetActive returns the Active field value -// If the value is explicit nil, nil is returned -func (o *UserPropertiesPost) GetActive() *bool { - if o == nil { - return nil - } - - return o.Active +// SetPassword gets a reference to the given string and assigns it to the Password field. +func (o *UserPropertiesPost) SetPassword(v string) { + o.Password = &v +} +// GetActive returns the Active field value if set, zero value otherwise. +func (o *UserPropertiesPost) GetActive() bool { + if o == nil || IsNil(o.Active) { + var ret bool + return ret + } + return *o.Active } -// GetActiveOk returns a tuple with the Active field value +// GetActiveOk returns a tuple with the Active 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 *UserPropertiesPost) GetActiveOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.Active) { return nil, false } - return o.Active, true } -// SetActive sets field value -func (o *UserPropertiesPost) SetActive(v bool) { - - o.Active = &v - -} - // HasActive returns a boolean if a field has been set. func (o *UserPropertiesPost) HasActive() bool { - if o != nil && o.Active != nil { + if o != nil && !IsNil(o.Active) { return true } return false } +// SetActive gets a reference to the given bool and assigns it to the Active field. +func (o *UserPropertiesPost) SetActive(v bool) { + o.Active = &v +} + func (o UserPropertiesPost) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UserPropertiesPost) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Firstname != nil { + if !IsNil(o.Firstname) { toSerialize["firstname"] = o.Firstname } - - if o.Lastname != nil { + if !IsNil(o.Lastname) { toSerialize["lastname"] = o.Lastname } - - if o.Email != nil { + if !IsNil(o.Email) { toSerialize["email"] = o.Email } - - if o.Administrator != nil { + if !IsNil(o.Administrator) { toSerialize["administrator"] = o.Administrator } - - if o.ForceSecAuth != nil { + if !IsNil(o.ForceSecAuth) { toSerialize["forceSecAuth"] = o.ForceSecAuth } - - if o.SecAuthActive != nil { + if !IsNil(o.SecAuthActive) { toSerialize["secAuthActive"] = o.SecAuthActive } - - if o.Password != nil { + if !IsNil(o.Password) { toSerialize["password"] = o.Password } - - if o.Active != nil { + if !IsNil(o.Active) { toSerialize["active"] = o.Active } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableUserPropertiesPost struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_user_properties_put.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_user_properties_put.go similarity index 62% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_user_properties_put.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_user_properties_put.go index badd4a779..cae3e4a5e 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_user_properties_put.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_user_properties_put.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the UserPropertiesPut type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UserPropertiesPut{} + // UserPropertiesPut struct for UserPropertiesPut type UserPropertiesPut struct { // The first name of the user. @@ -52,345 +55,297 @@ func NewUserPropertiesPutWithDefaults() *UserPropertiesPut { return &this } -// GetFirstname returns the Firstname field value -// If the value is explicit nil, nil is returned -func (o *UserPropertiesPut) GetFirstname() *string { - if o == nil { - return nil +// GetFirstname returns the Firstname field value if set, zero value otherwise. +func (o *UserPropertiesPut) GetFirstname() string { + if o == nil || IsNil(o.Firstname) { + var ret string + return ret } - - return o.Firstname - + return *o.Firstname } -// GetFirstnameOk returns a tuple with the Firstname field value +// GetFirstnameOk returns a tuple with the Firstname 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 *UserPropertiesPut) GetFirstnameOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Firstname) { return nil, false } - return o.Firstname, true } -// SetFirstname sets field value -func (o *UserPropertiesPut) SetFirstname(v string) { - - o.Firstname = &v - -} - // HasFirstname returns a boolean if a field has been set. func (o *UserPropertiesPut) HasFirstname() bool { - if o != nil && o.Firstname != nil { + if o != nil && !IsNil(o.Firstname) { return true } return false } -// GetLastname returns the Lastname field value -// If the value is explicit nil, nil is returned -func (o *UserPropertiesPut) GetLastname() *string { - if o == nil { - return nil - } - - return o.Lastname +// SetFirstname gets a reference to the given string and assigns it to the Firstname field. +func (o *UserPropertiesPut) SetFirstname(v string) { + o.Firstname = &v +} +// GetLastname returns the Lastname field value if set, zero value otherwise. +func (o *UserPropertiesPut) 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 +// GetLastnameOk returns a tuple with the Lastname 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 *UserPropertiesPut) GetLastnameOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Lastname) { return nil, false } - return o.Lastname, true } -// SetLastname sets field value -func (o *UserPropertiesPut) SetLastname(v string) { - - o.Lastname = &v - -} - // HasLastname returns a boolean if a field has been set. func (o *UserPropertiesPut) HasLastname() bool { - if o != nil && o.Lastname != nil { + if o != nil && !IsNil(o.Lastname) { return true } return false } -// GetEmail returns the Email field value -// If the value is explicit nil, nil is returned -func (o *UserPropertiesPut) GetEmail() *string { - if o == nil { - return nil - } - - return o.Email +// SetLastname gets a reference to the given string and assigns it to the Lastname field. +func (o *UserPropertiesPut) SetLastname(v string) { + o.Lastname = &v +} +// GetEmail returns the Email field value if set, zero value otherwise. +func (o *UserPropertiesPut) 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 +// GetEmailOk returns a tuple with the Email 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 *UserPropertiesPut) GetEmailOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Email) { return nil, false } - return o.Email, true } -// SetEmail sets field value -func (o *UserPropertiesPut) SetEmail(v string) { - - o.Email = &v - -} - // HasEmail returns a boolean if a field has been set. func (o *UserPropertiesPut) HasEmail() bool { - if o != nil && o.Email != nil { + if o != nil && !IsNil(o.Email) { return true } return false } -// GetPassword returns the Password field value -// If the value is explicit nil, nil is returned -func (o *UserPropertiesPut) GetPassword() *string { - if o == nil { - return nil - } - - return o.Password +// SetEmail gets a reference to the given string and assigns it to the Email field. +func (o *UserPropertiesPut) SetEmail(v string) { + o.Email = &v +} +// GetPassword returns the Password field value if set, zero value otherwise. +func (o *UserPropertiesPut) 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 +// GetPasswordOk returns a tuple with the Password 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 *UserPropertiesPut) GetPasswordOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Password) { return nil, false } - return o.Password, true } -// SetPassword sets field value -func (o *UserPropertiesPut) SetPassword(v string) { - - o.Password = &v - -} - // HasPassword returns a boolean if a field has been set. func (o *UserPropertiesPut) HasPassword() bool { - if o != nil && o.Password != nil { + if o != nil && !IsNil(o.Password) { return true } return false } -// GetAdministrator returns the Administrator field value -// If the value is explicit nil, nil is returned -func (o *UserPropertiesPut) GetAdministrator() *bool { - if o == nil { - return nil - } - - return o.Administrator +// SetPassword gets a reference to the given string and assigns it to the Password field. +func (o *UserPropertiesPut) SetPassword(v string) { + o.Password = &v +} +// GetAdministrator returns the Administrator field value if set, zero value otherwise. +func (o *UserPropertiesPut) GetAdministrator() bool { + if o == nil || IsNil(o.Administrator) { + var ret bool + return ret + } + return *o.Administrator } -// GetAdministratorOk returns a tuple with the Administrator field value +// GetAdministratorOk returns a tuple with the Administrator 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 *UserPropertiesPut) GetAdministratorOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.Administrator) { return nil, false } - return o.Administrator, true } -// SetAdministrator sets field value -func (o *UserPropertiesPut) SetAdministrator(v bool) { - - o.Administrator = &v - -} - // HasAdministrator returns a boolean if a field has been set. func (o *UserPropertiesPut) HasAdministrator() bool { - if o != nil && o.Administrator != nil { + if o != nil && !IsNil(o.Administrator) { return true } return false } -// GetForceSecAuth returns the ForceSecAuth field value -// If the value is explicit nil, nil is returned -func (o *UserPropertiesPut) GetForceSecAuth() *bool { - if o == nil { - return nil - } - - return o.ForceSecAuth +// SetAdministrator gets a reference to the given bool and assigns it to the Administrator field. +func (o *UserPropertiesPut) SetAdministrator(v bool) { + o.Administrator = &v +} +// GetForceSecAuth returns the ForceSecAuth field value if set, zero value otherwise. +func (o *UserPropertiesPut) GetForceSecAuth() bool { + if o == nil || IsNil(o.ForceSecAuth) { + var ret bool + return ret + } + return *o.ForceSecAuth } -// GetForceSecAuthOk returns a tuple with the ForceSecAuth field value +// GetForceSecAuthOk returns a tuple with the ForceSecAuth 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 *UserPropertiesPut) GetForceSecAuthOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.ForceSecAuth) { return nil, false } - return o.ForceSecAuth, true } -// SetForceSecAuth sets field value -func (o *UserPropertiesPut) SetForceSecAuth(v bool) { - - o.ForceSecAuth = &v - -} - // HasForceSecAuth returns a boolean if a field has been set. func (o *UserPropertiesPut) HasForceSecAuth() bool { - if o != nil && o.ForceSecAuth != nil { + if o != nil && !IsNil(o.ForceSecAuth) { return true } return false } -// GetSecAuthActive returns the SecAuthActive field value -// If the value is explicit nil, nil is returned -func (o *UserPropertiesPut) GetSecAuthActive() *bool { - if o == nil { - return nil - } - - return o.SecAuthActive +// SetForceSecAuth gets a reference to the given bool and assigns it to the ForceSecAuth field. +func (o *UserPropertiesPut) SetForceSecAuth(v bool) { + o.ForceSecAuth = &v +} +// GetSecAuthActive returns the SecAuthActive field value if set, zero value otherwise. +func (o *UserPropertiesPut) GetSecAuthActive() bool { + if o == nil || IsNil(o.SecAuthActive) { + var ret bool + return ret + } + return *o.SecAuthActive } -// GetSecAuthActiveOk returns a tuple with the SecAuthActive field value +// GetSecAuthActiveOk returns a tuple with the SecAuthActive 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 *UserPropertiesPut) GetSecAuthActiveOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.SecAuthActive) { return nil, false } - return o.SecAuthActive, true } -// SetSecAuthActive sets field value -func (o *UserPropertiesPut) SetSecAuthActive(v bool) { - - o.SecAuthActive = &v - -} - // HasSecAuthActive returns a boolean if a field has been set. func (o *UserPropertiesPut) HasSecAuthActive() bool { - if o != nil && o.SecAuthActive != nil { + if o != nil && !IsNil(o.SecAuthActive) { return true } return false } -// GetActive returns the Active field value -// If the value is explicit nil, nil is returned -func (o *UserPropertiesPut) GetActive() *bool { - if o == nil { - return nil - } - - return o.Active +// SetSecAuthActive gets a reference to the given bool and assigns it to the SecAuthActive field. +func (o *UserPropertiesPut) SetSecAuthActive(v bool) { + o.SecAuthActive = &v +} +// GetActive returns the Active field value if set, zero value otherwise. +func (o *UserPropertiesPut) GetActive() bool { + if o == nil || IsNil(o.Active) { + var ret bool + return ret + } + return *o.Active } -// GetActiveOk returns a tuple with the Active field value +// GetActiveOk returns a tuple with the Active 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 *UserPropertiesPut) GetActiveOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.Active) { return nil, false } - return o.Active, true } -// SetActive sets field value -func (o *UserPropertiesPut) SetActive(v bool) { - - o.Active = &v - -} - // HasActive returns a boolean if a field has been set. func (o *UserPropertiesPut) HasActive() bool { - if o != nil && o.Active != nil { + if o != nil && !IsNil(o.Active) { return true } return false } +// SetActive gets a reference to the given bool and assigns it to the Active field. +func (o *UserPropertiesPut) SetActive(v bool) { + o.Active = &v +} + func (o UserPropertiesPut) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UserPropertiesPut) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Firstname != nil { + if !IsNil(o.Firstname) { toSerialize["firstname"] = o.Firstname } - - if o.Lastname != nil { + if !IsNil(o.Lastname) { toSerialize["lastname"] = o.Lastname } - - if o.Email != nil { + if !IsNil(o.Email) { toSerialize["email"] = o.Email } - - if o.Password != nil { + if !IsNil(o.Password) { toSerialize["password"] = o.Password } - - if o.Administrator != nil { + if !IsNil(o.Administrator) { toSerialize["administrator"] = o.Administrator } - - if o.ForceSecAuth != nil { + if !IsNil(o.ForceSecAuth) { toSerialize["forceSecAuth"] = o.ForceSecAuth } - - if o.SecAuthActive != nil { + if !IsNil(o.SecAuthActive) { toSerialize["secAuthActive"] = o.SecAuthActive } - - if o.Active != nil { + if !IsNil(o.Active) { toSerialize["active"] = o.Active } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableUserPropertiesPut struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_user_put.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_user_put.go similarity index 74% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_user_put.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_user_put.go index f9dfa688a..e7c2c465e 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_user_put.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_user_put.go @@ -14,11 +14,14 @@ import ( "encoding/json" ) +// checks if the UserPut type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UserPut{} + // UserPut struct for UserPut type UserPut struct { // The resource's unique identifier. - Id *string `json:"id,omitempty"` - Properties *UserPropertiesPut `json:"properties"` + Id *string `json:"id,omitempty"` + Properties UserPropertiesPut `json:"properties"` } // NewUserPut instantiates a new UserPut object @@ -28,7 +31,7 @@ type UserPut struct { func NewUserPut(properties UserPropertiesPut) *UserPut { this := UserPut{} - this.Properties = &properties + this.Properties = properties return &this } @@ -41,93 +44,77 @@ func NewUserPutWithDefaults() *UserPut { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *UserPut) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *UserPut) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *UserPut) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *UserPut) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *UserPut) HasId() bool { - if o != nil && o.Id != nil { + 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 *UserPut) SetId(v string) { + o.Id = &v +} + // GetProperties returns the Properties field value -// If the value is explicit nil, nil is returned -func (o *UserPut) GetProperties() *UserPropertiesPut { +func (o *UserPut) GetProperties() UserPropertiesPut { if o == nil { - return nil + var ret UserPropertiesPut + return ret } return o.Properties - } // GetPropertiesOk returns a tuple with the Properties field value // 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 *UserPut) GetPropertiesOk() (*UserPropertiesPut, bool) { if o == nil { return nil, false } - - return o.Properties, true + return &o.Properties, true } // SetProperties sets field value func (o *UserPut) SetProperties(v UserPropertiesPut) { - - o.Properties = &v - + o.Properties = v } -// HasProperties returns a boolean if a field has been set. -func (o *UserPut) HasProperties() bool { - if o != nil && o.Properties != nil { - return true +func (o UserPut) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } - - return false + return json.Marshal(toSerialize) } -func (o UserPut) MarshalJSON() ([]byte, error) { +func (o UserPut) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Properties != nil { - toSerialize["properties"] = o.Properties - } - - return json.Marshal(toSerialize) + toSerialize["properties"] = o.Properties + return toSerialize, nil } type NullableUserPut struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_users.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_users.go similarity index 59% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_users.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_users.go index 1af8169a9..e58db725e 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_users.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_users.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the Users type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Users{} + // Users struct for Users type Users struct { // The resource's unique identifier. @@ -23,7 +26,7 @@ type Users struct { // URL to the object representation (absolute path). Href *string `json:"href,omitempty"` // Array of items in the collection. - Items *[]User `json:"items,omitempty"` + Items []User `json:"items,omitempty"` // The offset (if specified in the request). Offset *float32 `json:"offset,omitempty"` // The limit (if specified in the request). @@ -49,303 +52,262 @@ func NewUsersWithDefaults() *Users { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *Users) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *Users) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *Users) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *Users) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *Users) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *Users) GetType() *Type { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Users) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *Users) GetType() Type { + if o == nil || IsNil(o.Type) { + var ret Type + return ret + } + return *o.Type } -// GetTypeOk returns a tuple with the Type field value +// GetTypeOk returns a tuple with the Type 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 *Users) GetTypeOk() (*Type, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *Users) SetType(v Type) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *Users) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *Users) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given Type and assigns it to the Type field. +func (o *Users) SetType(v Type) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *Users) 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 +// GetHrefOk returns a tuple with the Href 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 *Users) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *Users) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *Users) HasHref() bool { - if o != nil && o.Href != nil { + if o != nil && !IsNil(o.Href) { return true } return false } -// GetItems returns the Items field value -// If the value is explicit nil, nil is returned -func (o *Users) GetItems() *[]User { - if o == nil { - return nil - } +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *Users) SetHref(v string) { + o.Href = &v +} +// GetItems returns the Items field value if set, zero value otherwise. +func (o *Users) GetItems() []User { + if o == nil || IsNil(o.Items) { + var ret []User + return ret + } return o.Items - } -// GetItemsOk returns a tuple with the Items field value +// GetItemsOk returns a tuple with the Items 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 *Users) GetItemsOk() (*[]User, bool) { - if o == nil { +func (o *Users) GetItemsOk() ([]User, bool) { + if o == nil || IsNil(o.Items) { return nil, false } - return o.Items, true } -// SetItems sets field value -func (o *Users) SetItems(v []User) { - - o.Items = &v - -} - // HasItems returns a boolean if a field has been set. func (o *Users) HasItems() bool { - if o != nil && o.Items != nil { + if o != nil && !IsNil(o.Items) { return true } return false } -// GetOffset returns the Offset field value -// If the value is explicit nil, nil is returned -func (o *Users) GetOffset() *float32 { - if o == nil { - return nil - } - - return o.Offset +// SetItems gets a reference to the given []User and assigns it to the Items field. +func (o *Users) SetItems(v []User) { + o.Items = v +} +// GetOffset returns the Offset field value if set, zero value otherwise. +func (o *Users) GetOffset() float32 { + if o == nil || IsNil(o.Offset) { + var ret float32 + return ret + } + return *o.Offset } -// GetOffsetOk returns a tuple with the Offset field value +// GetOffsetOk returns a tuple with the Offset 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 *Users) GetOffsetOk() (*float32, bool) { - if o == nil { + if o == nil || IsNil(o.Offset) { return nil, false } - return o.Offset, true } -// SetOffset sets field value -func (o *Users) SetOffset(v float32) { - - o.Offset = &v - -} - // HasOffset returns a boolean if a field has been set. func (o *Users) HasOffset() bool { - if o != nil && o.Offset != nil { + if o != nil && !IsNil(o.Offset) { return true } return false } -// GetLimit returns the Limit field value -// If the value is explicit nil, nil is returned -func (o *Users) GetLimit() *float32 { - if o == nil { - return nil - } - - return o.Limit +// SetOffset gets a reference to the given float32 and assigns it to the Offset field. +func (o *Users) SetOffset(v float32) { + o.Offset = &v +} +// GetLimit returns the Limit field value if set, zero value otherwise. +func (o *Users) GetLimit() float32 { + if o == nil || IsNil(o.Limit) { + var ret float32 + return ret + } + return *o.Limit } -// GetLimitOk returns a tuple with the Limit field value +// GetLimitOk returns a tuple with the Limit 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 *Users) GetLimitOk() (*float32, bool) { - if o == nil { + if o == nil || IsNil(o.Limit) { return nil, false } - return o.Limit, true } -// SetLimit sets field value -func (o *Users) SetLimit(v float32) { - - o.Limit = &v - -} - // HasLimit returns a boolean if a field has been set. func (o *Users) HasLimit() bool { - if o != nil && o.Limit != nil { + if o != nil && !IsNil(o.Limit) { return true } return false } -// GetLinks returns the Links field value -// If the value is explicit nil, nil is returned -func (o *Users) GetLinks() *PaginationLinks { - if o == nil { - return nil - } - - return o.Links +// SetLimit gets a reference to the given float32 and assigns it to the Limit field. +func (o *Users) SetLimit(v float32) { + o.Limit = &v +} +// GetLinks returns the Links field value if set, zero value otherwise. +func (o *Users) GetLinks() PaginationLinks { + if o == nil || IsNil(o.Links) { + var ret PaginationLinks + return ret + } + return *o.Links } -// GetLinksOk returns a tuple with the Links field value +// GetLinksOk returns a tuple with the Links 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 *Users) GetLinksOk() (*PaginationLinks, bool) { - if o == nil { + if o == nil || IsNil(o.Links) { return nil, false } - return o.Links, true } -// SetLinks sets field value -func (o *Users) SetLinks(v PaginationLinks) { - - o.Links = &v - -} - // HasLinks returns a boolean if a field has been set. func (o *Users) HasLinks() bool { - if o != nil && o.Links != nil { + if o != nil && !IsNil(o.Links) { return true } return false } +// SetLinks gets a reference to the given PaginationLinks and assigns it to the Links field. +func (o *Users) SetLinks(v PaginationLinks) { + o.Links = &v +} + func (o Users) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Users) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Items != nil { + if !IsNil(o.Items) { toSerialize["items"] = o.Items } - - if o.Offset != nil { + if !IsNil(o.Offset) { toSerialize["offset"] = o.Offset } - - if o.Limit != nil { + if !IsNil(o.Limit) { toSerialize["limit"] = o.Limit } - - if o.Links != nil { + if !IsNil(o.Links) { toSerialize["_links"] = o.Links } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableUsers struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_users_entities.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_users_entities.go similarity index 71% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_users_entities.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_users_entities.go index cf03db079..ab911ea2e 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_users_entities.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_users_entities.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the UsersEntities type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UsersEntities{} + // UsersEntities struct for UsersEntities type UsersEntities struct { Owns *ResourcesUsers `json:"owns,omitempty"` @@ -38,93 +41,87 @@ func NewUsersEntitiesWithDefaults() *UsersEntities { return &this } -// GetOwns returns the Owns field value -// If the value is explicit nil, nil is returned -func (o *UsersEntities) GetOwns() *ResourcesUsers { - if o == nil { - return nil +// GetOwns returns the Owns field value if set, zero value otherwise. +func (o *UsersEntities) GetOwns() ResourcesUsers { + if o == nil || IsNil(o.Owns) { + var ret ResourcesUsers + return ret } - - return o.Owns - + return *o.Owns } -// GetOwnsOk returns a tuple with the Owns field value +// GetOwnsOk returns a tuple with the Owns 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 *UsersEntities) GetOwnsOk() (*ResourcesUsers, bool) { - if o == nil { + if o == nil || IsNil(o.Owns) { return nil, false } - return o.Owns, true } -// SetOwns sets field value -func (o *UsersEntities) SetOwns(v ResourcesUsers) { - - o.Owns = &v - -} - // HasOwns returns a boolean if a field has been set. func (o *UsersEntities) HasOwns() bool { - if o != nil && o.Owns != nil { + if o != nil && !IsNil(o.Owns) { return true } return false } -// GetGroups returns the Groups field value -// If the value is explicit nil, nil is returned -func (o *UsersEntities) GetGroups() *GroupUsers { - if o == nil { - return nil - } - - return o.Groups +// SetOwns gets a reference to the given ResourcesUsers and assigns it to the Owns field. +func (o *UsersEntities) SetOwns(v ResourcesUsers) { + o.Owns = &v +} +// GetGroups returns the Groups field value if set, zero value otherwise. +func (o *UsersEntities) GetGroups() GroupUsers { + if o == nil || IsNil(o.Groups) { + var ret GroupUsers + return ret + } + return *o.Groups } -// GetGroupsOk returns a tuple with the Groups field value +// GetGroupsOk returns a tuple with the Groups 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 *UsersEntities) GetGroupsOk() (*GroupUsers, bool) { - if o == nil { + if o == nil || IsNil(o.Groups) { return nil, false } - return o.Groups, true } -// SetGroups sets field value -func (o *UsersEntities) SetGroups(v GroupUsers) { - - o.Groups = &v - -} - // HasGroups returns a boolean if a field has been set. func (o *UsersEntities) HasGroups() bool { - if o != nil && o.Groups != nil { + if o != nil && !IsNil(o.Groups) { return true } return false } +// SetGroups gets a reference to the given GroupUsers and assigns it to the Groups field. +func (o *UsersEntities) SetGroups(v GroupUsers) { + o.Groups = &v +} + func (o UsersEntities) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UsersEntities) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Owns != nil { + if !IsNil(o.Owns) { toSerialize["owns"] = o.Owns } - - if o.Groups != nil { + if !IsNil(o.Groups) { toSerialize["groups"] = o.Groups } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableUsersEntities struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_volume.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_volume.go similarity index 65% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_volume.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_volume.go index a3f13d711..87a3c0010 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_volume.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_volume.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the Volume type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Volume{} + // Volume struct for Volume type Volume struct { // The resource's unique identifier. @@ -23,7 +26,7 @@ type Volume struct { // The URL to the object representation (absolute path). Href *string `json:"href,omitempty"` Metadata *DatacenterElementMetadata `json:"metadata,omitempty"` - Properties *VolumeProperties `json:"properties"` + Properties VolumeProperties `json:"properties"` } // NewVolume instantiates a new Volume object @@ -33,7 +36,7 @@ type Volume struct { func NewVolume(properties VolumeProperties) *Volume { this := Volume{} - this.Properties = &properties + this.Properties = properties return &this } @@ -46,219 +49,182 @@ func NewVolumeWithDefaults() *Volume { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *Volume) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *Volume) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *Volume) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *Volume) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *Volume) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *Volume) GetType() *Type { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Volume) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *Volume) GetType() Type { + if o == nil || IsNil(o.Type) { + var ret Type + return ret + } + return *o.Type } -// GetTypeOk returns a tuple with the Type field value +// GetTypeOk returns a tuple with the Type 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 *Volume) GetTypeOk() (*Type, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *Volume) SetType(v Type) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *Volume) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *Volume) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given Type and assigns it to the Type field. +func (o *Volume) SetType(v Type) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *Volume) 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 +// GetHrefOk returns a tuple with the Href 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 *Volume) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *Volume) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *Volume) HasHref() bool { - if o != nil && o.Href != nil { + if o != nil && !IsNil(o.Href) { return true } return false } -// GetMetadata returns the Metadata field value -// If the value is explicit nil, nil is returned -func (o *Volume) GetMetadata() *DatacenterElementMetadata { - if o == nil { - return nil - } - - return o.Metadata +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *Volume) SetHref(v string) { + o.Href = &v +} +// GetMetadata returns the Metadata field value if set, zero value otherwise. +func (o *Volume) GetMetadata() DatacenterElementMetadata { + if o == nil || IsNil(o.Metadata) { + var ret DatacenterElementMetadata + return ret + } + return *o.Metadata } -// GetMetadataOk returns a tuple with the Metadata field value +// GetMetadataOk returns a tuple with the Metadata 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 *Volume) GetMetadataOk() (*DatacenterElementMetadata, bool) { - if o == nil { + if o == nil || IsNil(o.Metadata) { return nil, false } - return o.Metadata, true } -// SetMetadata sets field value -func (o *Volume) SetMetadata(v DatacenterElementMetadata) { - - o.Metadata = &v - -} - // HasMetadata returns a boolean if a field has been set. func (o *Volume) HasMetadata() bool { - if o != nil && o.Metadata != nil { + if o != nil && !IsNil(o.Metadata) { return true } return false } +// SetMetadata gets a reference to the given DatacenterElementMetadata and assigns it to the Metadata field. +func (o *Volume) SetMetadata(v DatacenterElementMetadata) { + o.Metadata = &v +} + // GetProperties returns the Properties field value -// If the value is explicit nil, nil is returned -func (o *Volume) GetProperties() *VolumeProperties { +func (o *Volume) GetProperties() VolumeProperties { if o == nil { - return nil + var ret VolumeProperties + return ret } return o.Properties - } // GetPropertiesOk returns a tuple with the Properties field value // 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 *Volume) GetPropertiesOk() (*VolumeProperties, bool) { if o == nil { return nil, false } - - return o.Properties, true + return &o.Properties, true } // SetProperties sets field value func (o *Volume) SetProperties(v VolumeProperties) { - - o.Properties = &v - + o.Properties = v } -// HasProperties returns a boolean if a field has been set. -func (o *Volume) HasProperties() bool { - if o != nil && o.Properties != nil { - return true +func (o Volume) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err } - - return false + return json.Marshal(toSerialize) } -func (o Volume) MarshalJSON() ([]byte, error) { +func (o Volume) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Metadata != nil { + if !IsNil(o.Metadata) { toSerialize["metadata"] = o.Metadata } - - if o.Properties != nil { - toSerialize["properties"] = o.Properties - } - - return json.Marshal(toSerialize) + toSerialize["properties"] = o.Properties + return toSerialize, nil } type NullableVolume struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_volume_properties.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_volume_properties.go similarity index 61% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_volume_properties.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_volume_properties.go index c5b2445ac..da605bd63 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_volume_properties.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_volume_properties.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the VolumeProperties type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &VolumeProperties{} + // VolumeProperties struct for VolumeProperties type VolumeProperties struct { // The name of the resource. @@ -21,7 +24,7 @@ type VolumeProperties struct { // Hardware type of the volume. DAS (Direct Attached Storage) could be used only in a composite call with a Cube server. Type *string `json:"type,omitempty"` // The size of the volume in GB. - Size *float32 `json:"size"` + Size float32 `json:"size"` // The availability zone in which the volume should be provisioned. The storage volume will be provisioned on as few physical storage devices as possible, but this cannot be guaranteed upfront. This is uavailable for DAS (Direct Attached Storage), and subject to availability for SSD. AvailabilityZone *string `json:"availabilityZone,omitempty"` // Image or snapshot ID to be used as template for this volume. @@ -30,7 +33,7 @@ type VolumeProperties struct { ImagePassword *string `json:"imagePassword,omitempty"` ImageAlias *string `json:"imageAlias,omitempty"` // Public SSH keys are set on the image as authorized keys for appropriate SSH login to the instance using the corresponding private key. This field may only be set in creation requests. When reading, it always returns null. SSH keys are only supported if a public Linux image is used for the volume creation. - SshKeys *[]string `json:"sshKeys,omitempty"` + SshKeys []string `json:"sshKeys,omitempty"` // The bus type for this volume; default is VIRTIO. Bus *string `json:"bus,omitempty"` // OS type for this volume. @@ -60,8 +63,7 @@ type VolumeProperties struct { // The UUID of the attached server. BootServer *string `json:"bootServer,omitempty"` // Determines whether the volume will be used as a boot volume. Set to `NONE`, the volume will not be used as boot volume. Set to `PRIMARY`, the volume will be used as boot volume and all other volumes must be set to `NONE`. Set to `AUTO` or `null` requires all volumes to be set to `AUTO` or `null`; this will use the legacy behavior, which is to use the volume as a boot volume only if there are no other volumes or cdrom devices. - // to set this field to `nil` in order to be marshalled, the explicit nil address `Nilstring` can be used, or the setter `SetBootOrderNil` - BootOrder *string `json:"bootOrder,omitempty"` + BootOrder NullableString `json:"bootOrder,omitempty"` } // NewVolumeProperties instantiates a new VolumeProperties object @@ -71,11 +73,11 @@ type VolumeProperties struct { func NewVolumeProperties(size float32) *VolumeProperties { this := VolumeProperties{} - this.Size = &size + this.Size = size var exposeSerial bool = false this.ExposeSerial = &exposeSerial var bootOrder = "AUTO" - this.BootOrder = &bootOrder + this.BootOrder = *NewNullableString(&bootOrder) return &this } @@ -88,985 +90,827 @@ func NewVolumePropertiesWithDefaults() *VolumeProperties { var exposeSerial bool = false this.ExposeSerial = &exposeSerial var bootOrder = "AUTO" - this.BootOrder = &bootOrder + this.BootOrder = *NewNullableString(&bootOrder) return &this } -// GetName returns the Name field value -// If the value is explicit nil, nil is returned -func (o *VolumeProperties) GetName() *string { - if o == nil { - return nil +// GetName returns the Name field value if set, zero value otherwise. +func (o *VolumeProperties) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret } - - return o.Name - + return *o.Name } -// GetNameOk returns a tuple with the Name field value +// GetNameOk returns a tuple with the Name 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 *VolumeProperties) GetNameOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Name) { return nil, false } - return o.Name, true } -// SetName sets field value -func (o *VolumeProperties) SetName(v string) { - - o.Name = &v - -} - // HasName returns a boolean if a field has been set. func (o *VolumeProperties) HasName() bool { - if o != nil && o.Name != nil { + if o != nil && !IsNil(o.Name) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *VolumeProperties) GetType() *string { - if o == nil { - return nil - } - - return o.Type +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *VolumeProperties) SetName(v string) { + o.Name = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *VolumeProperties) 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 +// GetTypeOk returns a tuple with the Type 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 *VolumeProperties) GetTypeOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *VolumeProperties) SetType(v string) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *VolumeProperties) HasType() bool { - if o != nil && o.Type != nil { + 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 *VolumeProperties) SetType(v string) { + o.Type = &v +} + // GetSize returns the Size field value -// If the value is explicit nil, nil is returned -func (o *VolumeProperties) GetSize() *float32 { +func (o *VolumeProperties) GetSize() float32 { if o == nil { - return nil + var ret float32 + return ret } return o.Size - } // GetSizeOk returns a tuple with the Size field value // 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 *VolumeProperties) GetSizeOk() (*float32, bool) { if o == nil { return nil, false } - - return o.Size, true + return &o.Size, true } // SetSize sets field value func (o *VolumeProperties) SetSize(v float32) { - - o.Size = &v - -} - -// HasSize returns a boolean if a field has been set. -func (o *VolumeProperties) HasSize() bool { - if o != nil && o.Size != nil { - return true - } - - return false + o.Size = v } -// GetAvailabilityZone returns the AvailabilityZone field value -// If the value is explicit nil, nil is returned -func (o *VolumeProperties) GetAvailabilityZone() *string { - if o == nil { - return nil +// GetAvailabilityZone returns the AvailabilityZone field value if set, zero value otherwise. +func (o *VolumeProperties) GetAvailabilityZone() string { + if o == nil || IsNil(o.AvailabilityZone) { + var ret string + return ret } - - return o.AvailabilityZone - + return *o.AvailabilityZone } -// GetAvailabilityZoneOk returns a tuple with the AvailabilityZone field value +// GetAvailabilityZoneOk returns a tuple with the AvailabilityZone 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 *VolumeProperties) GetAvailabilityZoneOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.AvailabilityZone) { return nil, false } - return o.AvailabilityZone, true } -// SetAvailabilityZone sets field value -func (o *VolumeProperties) SetAvailabilityZone(v string) { - - o.AvailabilityZone = &v - -} - // HasAvailabilityZone returns a boolean if a field has been set. func (o *VolumeProperties) HasAvailabilityZone() bool { - if o != nil && o.AvailabilityZone != nil { + if o != nil && !IsNil(o.AvailabilityZone) { return true } return false } -// GetImage returns the Image field value -// If the value is explicit nil, nil is returned -func (o *VolumeProperties) GetImage() *string { - if o == nil { - return nil - } - - return o.Image +// SetAvailabilityZone gets a reference to the given string and assigns it to the AvailabilityZone field. +func (o *VolumeProperties) SetAvailabilityZone(v string) { + o.AvailabilityZone = &v +} +// GetImage returns the Image field value if set, zero value otherwise. +func (o *VolumeProperties) GetImage() string { + if o == nil || IsNil(o.Image) { + var ret string + return ret + } + return *o.Image } -// GetImageOk returns a tuple with the Image field value +// GetImageOk returns a tuple with the Image 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 *VolumeProperties) GetImageOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Image) { return nil, false } - return o.Image, true } -// SetImage sets field value -func (o *VolumeProperties) SetImage(v string) { - - o.Image = &v - -} - // HasImage returns a boolean if a field has been set. func (o *VolumeProperties) HasImage() bool { - if o != nil && o.Image != nil { + if o != nil && !IsNil(o.Image) { return true } return false } -// GetImagePassword returns the ImagePassword field value -// If the value is explicit nil, nil is returned -func (o *VolumeProperties) GetImagePassword() *string { - if o == nil { - return nil - } - - return o.ImagePassword +// SetImage gets a reference to the given string and assigns it to the Image field. +func (o *VolumeProperties) SetImage(v string) { + o.Image = &v +} +// GetImagePassword returns the ImagePassword field value if set, zero value otherwise. +func (o *VolumeProperties) GetImagePassword() string { + if o == nil || IsNil(o.ImagePassword) { + var ret string + return ret + } + return *o.ImagePassword } -// GetImagePasswordOk returns a tuple with the ImagePassword field value +// GetImagePasswordOk returns a tuple with the ImagePassword 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 *VolumeProperties) GetImagePasswordOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.ImagePassword) { return nil, false } - return o.ImagePassword, true } -// SetImagePassword sets field value -func (o *VolumeProperties) SetImagePassword(v string) { - - o.ImagePassword = &v - -} - // HasImagePassword returns a boolean if a field has been set. func (o *VolumeProperties) HasImagePassword() bool { - if o != nil && o.ImagePassword != nil { + if o != nil && !IsNil(o.ImagePassword) { return true } return false } -// GetImageAlias returns the ImageAlias field value -// If the value is explicit nil, nil is returned -func (o *VolumeProperties) GetImageAlias() *string { - if o == nil { - return nil - } - - return o.ImageAlias +// SetImagePassword gets a reference to the given string and assigns it to the ImagePassword field. +func (o *VolumeProperties) SetImagePassword(v string) { + o.ImagePassword = &v +} +// GetImageAlias returns the ImageAlias field value if set, zero value otherwise. +func (o *VolumeProperties) GetImageAlias() string { + if o == nil || IsNil(o.ImageAlias) { + var ret string + return ret + } + return *o.ImageAlias } -// GetImageAliasOk returns a tuple with the ImageAlias field value +// GetImageAliasOk returns a tuple with the ImageAlias 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 *VolumeProperties) GetImageAliasOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.ImageAlias) { return nil, false } - return o.ImageAlias, true } -// SetImageAlias sets field value -func (o *VolumeProperties) SetImageAlias(v string) { - - o.ImageAlias = &v - -} - // HasImageAlias returns a boolean if a field has been set. func (o *VolumeProperties) HasImageAlias() bool { - if o != nil && o.ImageAlias != nil { + if o != nil && !IsNil(o.ImageAlias) { return true } return false } -// GetSshKeys returns the SshKeys field value -// If the value is explicit nil, nil is returned -func (o *VolumeProperties) GetSshKeys() *[]string { - if o == nil { - return nil - } +// SetImageAlias gets a reference to the given string and assigns it to the ImageAlias field. +func (o *VolumeProperties) SetImageAlias(v string) { + o.ImageAlias = &v +} +// GetSshKeys returns the SshKeys field value if set, zero value otherwise. +func (o *VolumeProperties) 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 +// GetSshKeysOk returns a tuple with the SshKeys 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 *VolumeProperties) GetSshKeysOk() (*[]string, bool) { - if o == nil { +func (o *VolumeProperties) GetSshKeysOk() ([]string, bool) { + if o == nil || IsNil(o.SshKeys) { return nil, false } - return o.SshKeys, true } -// SetSshKeys sets field value -func (o *VolumeProperties) SetSshKeys(v []string) { - - o.SshKeys = &v - -} - // HasSshKeys returns a boolean if a field has been set. func (o *VolumeProperties) HasSshKeys() bool { - if o != nil && o.SshKeys != nil { + if o != nil && !IsNil(o.SshKeys) { return true } return false } -// GetBus returns the Bus field value -// If the value is explicit nil, nil is returned -func (o *VolumeProperties) GetBus() *string { - if o == nil { - return nil - } - - return o.Bus +// SetSshKeys gets a reference to the given []string and assigns it to the SshKeys field. +func (o *VolumeProperties) SetSshKeys(v []string) { + o.SshKeys = v +} +// GetBus returns the Bus field value if set, zero value otherwise. +func (o *VolumeProperties) GetBus() string { + if o == nil || IsNil(o.Bus) { + var ret string + return ret + } + return *o.Bus } -// GetBusOk returns a tuple with the Bus field value +// GetBusOk returns a tuple with the Bus 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 *VolumeProperties) GetBusOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Bus) { return nil, false } - return o.Bus, true } -// SetBus sets field value -func (o *VolumeProperties) SetBus(v string) { - - o.Bus = &v - -} - // HasBus returns a boolean if a field has been set. func (o *VolumeProperties) HasBus() bool { - if o != nil && o.Bus != nil { + if o != nil && !IsNil(o.Bus) { return true } return false } -// GetLicenceType returns the LicenceType field value -// If the value is explicit nil, nil is returned -func (o *VolumeProperties) GetLicenceType() *string { - if o == nil { - return nil - } - - return o.LicenceType +// SetBus gets a reference to the given string and assigns it to the Bus field. +func (o *VolumeProperties) SetBus(v string) { + o.Bus = &v +} +// GetLicenceType returns the LicenceType field value if set, zero value otherwise. +func (o *VolumeProperties) GetLicenceType() string { + if o == nil || IsNil(o.LicenceType) { + var ret string + return ret + } + return *o.LicenceType } -// GetLicenceTypeOk returns a tuple with the LicenceType field value +// GetLicenceTypeOk returns a tuple with the LicenceType 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 *VolumeProperties) GetLicenceTypeOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.LicenceType) { return nil, false } - return o.LicenceType, true } -// SetLicenceType sets field value -func (o *VolumeProperties) SetLicenceType(v string) { - - o.LicenceType = &v - -} - // HasLicenceType returns a boolean if a field has been set. func (o *VolumeProperties) HasLicenceType() bool { - if o != nil && o.LicenceType != nil { + if o != nil && !IsNil(o.LicenceType) { return true } return false } -// GetCpuHotPlug returns the CpuHotPlug field value -// If the value is explicit nil, nil is returned -func (o *VolumeProperties) GetCpuHotPlug() *bool { - if o == nil { - return nil - } - - return o.CpuHotPlug +// SetLicenceType gets a reference to the given string and assigns it to the LicenceType field. +func (o *VolumeProperties) SetLicenceType(v string) { + o.LicenceType = &v +} +// GetCpuHotPlug returns the CpuHotPlug field value if set, zero value otherwise. +func (o *VolumeProperties) GetCpuHotPlug() bool { + if o == nil || IsNil(o.CpuHotPlug) { + var ret bool + return ret + } + return *o.CpuHotPlug } -// GetCpuHotPlugOk returns a tuple with the CpuHotPlug field value +// GetCpuHotPlugOk returns a tuple with the CpuHotPlug 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 *VolumeProperties) GetCpuHotPlugOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.CpuHotPlug) { return nil, false } - return o.CpuHotPlug, true } -// SetCpuHotPlug sets field value -func (o *VolumeProperties) SetCpuHotPlug(v bool) { - - o.CpuHotPlug = &v - -} - // HasCpuHotPlug returns a boolean if a field has been set. func (o *VolumeProperties) HasCpuHotPlug() bool { - if o != nil && o.CpuHotPlug != nil { + if o != nil && !IsNil(o.CpuHotPlug) { return true } return false } -// GetRamHotPlug returns the RamHotPlug field value -// If the value is explicit nil, nil is returned -func (o *VolumeProperties) GetRamHotPlug() *bool { - if o == nil { - return nil - } - - return o.RamHotPlug +// SetCpuHotPlug gets a reference to the given bool and assigns it to the CpuHotPlug field. +func (o *VolumeProperties) SetCpuHotPlug(v bool) { + o.CpuHotPlug = &v +} +// GetRamHotPlug returns the RamHotPlug field value if set, zero value otherwise. +func (o *VolumeProperties) GetRamHotPlug() bool { + if o == nil || IsNil(o.RamHotPlug) { + var ret bool + return ret + } + return *o.RamHotPlug } -// GetRamHotPlugOk returns a tuple with the RamHotPlug field value +// GetRamHotPlugOk returns a tuple with the RamHotPlug 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 *VolumeProperties) GetRamHotPlugOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.RamHotPlug) { return nil, false } - return o.RamHotPlug, true } -// SetRamHotPlug sets field value -func (o *VolumeProperties) SetRamHotPlug(v bool) { - - o.RamHotPlug = &v - -} - // HasRamHotPlug returns a boolean if a field has been set. func (o *VolumeProperties) HasRamHotPlug() bool { - if o != nil && o.RamHotPlug != nil { + if o != nil && !IsNil(o.RamHotPlug) { return true } return false } -// GetNicHotPlug returns the NicHotPlug field value -// If the value is explicit nil, nil is returned -func (o *VolumeProperties) GetNicHotPlug() *bool { - if o == nil { - return nil - } - - return o.NicHotPlug +// SetRamHotPlug gets a reference to the given bool and assigns it to the RamHotPlug field. +func (o *VolumeProperties) SetRamHotPlug(v bool) { + o.RamHotPlug = &v +} +// GetNicHotPlug returns the NicHotPlug field value if set, zero value otherwise. +func (o *VolumeProperties) GetNicHotPlug() bool { + if o == nil || IsNil(o.NicHotPlug) { + var ret bool + return ret + } + return *o.NicHotPlug } -// GetNicHotPlugOk returns a tuple with the NicHotPlug field value +// GetNicHotPlugOk returns a tuple with the NicHotPlug 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 *VolumeProperties) GetNicHotPlugOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.NicHotPlug) { return nil, false } - return o.NicHotPlug, true } -// SetNicHotPlug sets field value -func (o *VolumeProperties) SetNicHotPlug(v bool) { - - o.NicHotPlug = &v - -} - // HasNicHotPlug returns a boolean if a field has been set. func (o *VolumeProperties) HasNicHotPlug() bool { - if o != nil && o.NicHotPlug != nil { + if o != nil && !IsNil(o.NicHotPlug) { return true } return false } -// GetNicHotUnplug returns the NicHotUnplug field value -// If the value is explicit nil, nil is returned -func (o *VolumeProperties) GetNicHotUnplug() *bool { - if o == nil { - return nil - } - - return o.NicHotUnplug +// SetNicHotPlug gets a reference to the given bool and assigns it to the NicHotPlug field. +func (o *VolumeProperties) SetNicHotPlug(v bool) { + o.NicHotPlug = &v +} +// GetNicHotUnplug returns the NicHotUnplug field value if set, zero value otherwise. +func (o *VolumeProperties) GetNicHotUnplug() bool { + if o == nil || IsNil(o.NicHotUnplug) { + var ret bool + return ret + } + return *o.NicHotUnplug } -// GetNicHotUnplugOk returns a tuple with the NicHotUnplug field value +// GetNicHotUnplugOk returns a tuple with the NicHotUnplug 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 *VolumeProperties) GetNicHotUnplugOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.NicHotUnplug) { return nil, false } - return o.NicHotUnplug, true } -// SetNicHotUnplug sets field value -func (o *VolumeProperties) SetNicHotUnplug(v bool) { - - o.NicHotUnplug = &v - -} - // HasNicHotUnplug returns a boolean if a field has been set. func (o *VolumeProperties) HasNicHotUnplug() bool { - if o != nil && o.NicHotUnplug != nil { + if o != nil && !IsNil(o.NicHotUnplug) { return true } return false } -// GetDiscVirtioHotPlug returns the DiscVirtioHotPlug field value -// If the value is explicit nil, nil is returned -func (o *VolumeProperties) GetDiscVirtioHotPlug() *bool { - if o == nil { - return nil - } - - return o.DiscVirtioHotPlug +// SetNicHotUnplug gets a reference to the given bool and assigns it to the NicHotUnplug field. +func (o *VolumeProperties) SetNicHotUnplug(v bool) { + o.NicHotUnplug = &v +} +// GetDiscVirtioHotPlug returns the DiscVirtioHotPlug field value if set, zero value otherwise. +func (o *VolumeProperties) GetDiscVirtioHotPlug() bool { + if o == nil || IsNil(o.DiscVirtioHotPlug) { + var ret bool + return ret + } + return *o.DiscVirtioHotPlug } -// GetDiscVirtioHotPlugOk returns a tuple with the DiscVirtioHotPlug field value +// GetDiscVirtioHotPlugOk returns a tuple with the DiscVirtioHotPlug 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 *VolumeProperties) GetDiscVirtioHotPlugOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.DiscVirtioHotPlug) { return nil, false } - return o.DiscVirtioHotPlug, true } -// SetDiscVirtioHotPlug sets field value -func (o *VolumeProperties) SetDiscVirtioHotPlug(v bool) { - - o.DiscVirtioHotPlug = &v - -} - // HasDiscVirtioHotPlug returns a boolean if a field has been set. func (o *VolumeProperties) HasDiscVirtioHotPlug() bool { - if o != nil && o.DiscVirtioHotPlug != nil { + if o != nil && !IsNil(o.DiscVirtioHotPlug) { return true } return false } -// GetDiscVirtioHotUnplug returns the DiscVirtioHotUnplug field value -// If the value is explicit nil, nil is returned -func (o *VolumeProperties) GetDiscVirtioHotUnplug() *bool { - if o == nil { - return nil - } - - return o.DiscVirtioHotUnplug +// SetDiscVirtioHotPlug gets a reference to the given bool and assigns it to the DiscVirtioHotPlug field. +func (o *VolumeProperties) SetDiscVirtioHotPlug(v bool) { + o.DiscVirtioHotPlug = &v +} +// GetDiscVirtioHotUnplug returns the DiscVirtioHotUnplug field value if set, zero value otherwise. +func (o *VolumeProperties) GetDiscVirtioHotUnplug() bool { + if o == nil || IsNil(o.DiscVirtioHotUnplug) { + var ret bool + return ret + } + return *o.DiscVirtioHotUnplug } -// GetDiscVirtioHotUnplugOk returns a tuple with the DiscVirtioHotUnplug field value +// GetDiscVirtioHotUnplugOk returns a tuple with the DiscVirtioHotUnplug 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 *VolumeProperties) GetDiscVirtioHotUnplugOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.DiscVirtioHotUnplug) { return nil, false } - return o.DiscVirtioHotUnplug, true } -// SetDiscVirtioHotUnplug sets field value -func (o *VolumeProperties) SetDiscVirtioHotUnplug(v bool) { - - o.DiscVirtioHotUnplug = &v - -} - // HasDiscVirtioHotUnplug returns a boolean if a field has been set. func (o *VolumeProperties) HasDiscVirtioHotUnplug() bool { - if o != nil && o.DiscVirtioHotUnplug != nil { + if o != nil && !IsNil(o.DiscVirtioHotUnplug) { return true } return false } -// GetExposeSerial returns the ExposeSerial field value -// If the value is explicit nil, nil is returned -func (o *VolumeProperties) GetExposeSerial() *bool { - if o == nil { - return nil - } - - return o.ExposeSerial +// SetDiscVirtioHotUnplug gets a reference to the given bool and assigns it to the DiscVirtioHotUnplug field. +func (o *VolumeProperties) SetDiscVirtioHotUnplug(v bool) { + o.DiscVirtioHotUnplug = &v +} +// GetExposeSerial returns the ExposeSerial field value if set, zero value otherwise. +func (o *VolumeProperties) GetExposeSerial() bool { + if o == nil || IsNil(o.ExposeSerial) { + var ret bool + return ret + } + return *o.ExposeSerial } -// GetExposeSerialOk returns a tuple with the ExposeSerial field value +// GetExposeSerialOk returns a tuple with the ExposeSerial 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 *VolumeProperties) GetExposeSerialOk() (*bool, bool) { - if o == nil { + if o == nil || IsNil(o.ExposeSerial) { return nil, false } - return o.ExposeSerial, true } -// SetExposeSerial sets field value -func (o *VolumeProperties) SetExposeSerial(v bool) { - - o.ExposeSerial = &v - -} - // HasExposeSerial returns a boolean if a field has been set. func (o *VolumeProperties) HasExposeSerial() bool { - if o != nil && o.ExposeSerial != nil { + if o != nil && !IsNil(o.ExposeSerial) { return true } return false } -// GetDeviceNumber returns the DeviceNumber field value -// If the value is explicit nil, nil is returned -func (o *VolumeProperties) GetDeviceNumber() *int64 { - if o == nil { - return nil - } - - return o.DeviceNumber +// SetExposeSerial gets a reference to the given bool and assigns it to the ExposeSerial field. +func (o *VolumeProperties) SetExposeSerial(v bool) { + o.ExposeSerial = &v +} +// GetDeviceNumber returns the DeviceNumber field value if set, zero value otherwise. +func (o *VolumeProperties) GetDeviceNumber() int64 { + if o == nil || IsNil(o.DeviceNumber) { + var ret int64 + return ret + } + return *o.DeviceNumber } -// GetDeviceNumberOk returns a tuple with the DeviceNumber field value +// GetDeviceNumberOk returns a tuple with the DeviceNumber 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 *VolumeProperties) GetDeviceNumberOk() (*int64, bool) { - if o == nil { + if o == nil || IsNil(o.DeviceNumber) { return nil, false } - return o.DeviceNumber, true } -// SetDeviceNumber sets field value -func (o *VolumeProperties) SetDeviceNumber(v int64) { - - o.DeviceNumber = &v - -} - // HasDeviceNumber returns a boolean if a field has been set. func (o *VolumeProperties) HasDeviceNumber() bool { - if o != nil && o.DeviceNumber != nil { + if o != nil && !IsNil(o.DeviceNumber) { return true } return false } -// GetPciSlot returns the PciSlot field value -// If the value is explicit nil, nil is returned -func (o *VolumeProperties) GetPciSlot() *int32 { - if o == nil { - return nil - } - - return o.PciSlot +// SetDeviceNumber gets a reference to the given int64 and assigns it to the DeviceNumber field. +func (o *VolumeProperties) SetDeviceNumber(v int64) { + o.DeviceNumber = &v +} +// GetPciSlot returns the PciSlot field value if set, zero value otherwise. +func (o *VolumeProperties) GetPciSlot() int32 { + if o == nil || IsNil(o.PciSlot) { + var ret int32 + return ret + } + return *o.PciSlot } -// GetPciSlotOk returns a tuple with the PciSlot field value +// GetPciSlotOk returns a tuple with the PciSlot 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 *VolumeProperties) GetPciSlotOk() (*int32, bool) { - if o == nil { + if o == nil || IsNil(o.PciSlot) { return nil, false } - return o.PciSlot, true } -// SetPciSlot sets field value -func (o *VolumeProperties) SetPciSlot(v int32) { - - o.PciSlot = &v - -} - // HasPciSlot returns a boolean if a field has been set. func (o *VolumeProperties) HasPciSlot() bool { - if o != nil && o.PciSlot != nil { + if o != nil && !IsNil(o.PciSlot) { return true } return false } -// GetBackupunitId returns the BackupunitId field value -// If the value is explicit nil, nil is returned -func (o *VolumeProperties) GetBackupunitId() *string { - if o == nil { - return nil - } - - return o.BackupunitId +// SetPciSlot gets a reference to the given int32 and assigns it to the PciSlot field. +func (o *VolumeProperties) SetPciSlot(v int32) { + o.PciSlot = &v +} +// GetBackupunitId returns the BackupunitId field value if set, zero value otherwise. +func (o *VolumeProperties) GetBackupunitId() string { + if o == nil || IsNil(o.BackupunitId) { + var ret string + return ret + } + return *o.BackupunitId } -// GetBackupunitIdOk returns a tuple with the BackupunitId field value +// GetBackupunitIdOk returns a tuple with the BackupunitId 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 *VolumeProperties) GetBackupunitIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.BackupunitId) { return nil, false } - return o.BackupunitId, true } -// SetBackupunitId sets field value -func (o *VolumeProperties) SetBackupunitId(v string) { - - o.BackupunitId = &v - -} - // HasBackupunitId returns a boolean if a field has been set. func (o *VolumeProperties) HasBackupunitId() bool { - if o != nil && o.BackupunitId != nil { + if o != nil && !IsNil(o.BackupunitId) { return true } return false } -// GetUserData returns the UserData field value -// If the value is explicit nil, nil is returned -func (o *VolumeProperties) GetUserData() *string { - if o == nil { - return nil - } - - return o.UserData +// SetBackupunitId gets a reference to the given string and assigns it to the BackupunitId field. +func (o *VolumeProperties) SetBackupunitId(v string) { + o.BackupunitId = &v +} +// GetUserData returns the UserData field value if set, zero value otherwise. +func (o *VolumeProperties) 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 +// GetUserDataOk returns a tuple with the UserData 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 *VolumeProperties) GetUserDataOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.UserData) { return nil, false } - return o.UserData, true } -// SetUserData sets field value -func (o *VolumeProperties) SetUserData(v string) { - - o.UserData = &v - -} - // HasUserData returns a boolean if a field has been set. func (o *VolumeProperties) HasUserData() bool { - if o != nil && o.UserData != nil { + if o != nil && !IsNil(o.UserData) { return true } return false } -// GetBootServer returns the BootServer field value -// If the value is explicit nil, nil is returned -func (o *VolumeProperties) GetBootServer() *string { - if o == nil { - return nil - } - - return o.BootServer +// SetUserData gets a reference to the given string and assigns it to the UserData field. +func (o *VolumeProperties) SetUserData(v string) { + o.UserData = &v +} +// GetBootServer returns the BootServer field value if set, zero value otherwise. +func (o *VolumeProperties) GetBootServer() string { + if o == nil || IsNil(o.BootServer) { + var ret string + return ret + } + return *o.BootServer } -// GetBootServerOk returns a tuple with the BootServer field value +// GetBootServerOk returns a tuple with the BootServer 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 *VolumeProperties) GetBootServerOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.BootServer) { return nil, false } - return o.BootServer, true } -// SetBootServer sets field value -func (o *VolumeProperties) SetBootServer(v string) { - - o.BootServer = &v - -} - // HasBootServer returns a boolean if a field has been set. func (o *VolumeProperties) HasBootServer() bool { - if o != nil && o.BootServer != nil { + if o != nil && !IsNil(o.BootServer) { return true } return false } -// GetBootOrder returns the BootOrder field value -// If the value is explicit nil, nil is returned -func (o *VolumeProperties) GetBootOrder() *string { - if o == nil { - return nil - } - - return o.BootOrder +// SetBootServer gets a reference to the given string and assigns it to the BootServer field. +func (o *VolumeProperties) SetBootServer(v string) { + o.BootServer = &v +} +// GetBootOrder returns the BootOrder field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *VolumeProperties) GetBootOrder() string { + if o == nil || IsNil(o.BootOrder.Get()) { + var ret string + return ret + } + return *o.BootOrder.Get() } -// GetBootOrderOk returns a tuple with the BootOrder field value +// GetBootOrderOk returns a tuple with the BootOrder 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 *VolumeProperties) GetBootOrderOk() (*string, bool) { if o == nil { return nil, false } - - return o.BootOrder, true + return o.BootOrder.Get(), o.BootOrder.IsSet() } -// SetBootOrder sets field value -func (o *VolumeProperties) SetBootOrder(v string) { +// HasBootOrder returns a boolean if a field has been set. +func (o *VolumeProperties) HasBootOrder() bool { + if o != nil && o.BootOrder.IsSet() { + return true + } - o.BootOrder = &v + return false +} +// SetBootOrder gets a reference to the given NullableString and assigns it to the BootOrder field. +func (o *VolumeProperties) SetBootOrder(v string) { + o.BootOrder.Set(&v) } -// sets BootOrder to the explicit address that will be encoded as nil when marshaled +// SetBootOrderNil sets the value for BootOrder to be an explicit nil func (o *VolumeProperties) SetBootOrderNil() { - o.BootOrder = &Nilstring + o.BootOrder.Set(nil) } -// HasBootOrder returns a boolean if a field has been set. -func (o *VolumeProperties) HasBootOrder() bool { - if o != nil && o.BootOrder != nil { - return true - } - - return false +// UnsetBootOrder ensures that no value is present for BootOrder, not even an explicit nil +func (o *VolumeProperties) UnsetBootOrder() { + o.BootOrder.Unset() } func (o VolumeProperties) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o VolumeProperties) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Name != nil { + if !IsNil(o.Name) { toSerialize["name"] = o.Name } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Size != nil { - toSerialize["size"] = o.Size - } - - if o.AvailabilityZone != nil { + toSerialize["size"] = o.Size + if !IsNil(o.AvailabilityZone) { toSerialize["availabilityZone"] = o.AvailabilityZone } - - if o.Image != nil { + if !IsNil(o.Image) { toSerialize["image"] = o.Image } - - if o.ImagePassword != nil { + if !IsNil(o.ImagePassword) { toSerialize["imagePassword"] = o.ImagePassword } - - if o.ImageAlias != nil { + if !IsNil(o.ImageAlias) { toSerialize["imageAlias"] = o.ImageAlias } - - if o.SshKeys != nil { + if !IsNil(o.SshKeys) { toSerialize["sshKeys"] = o.SshKeys } - - if o.Bus != nil { + if !IsNil(o.Bus) { toSerialize["bus"] = o.Bus } - - if o.LicenceType != nil { + if !IsNil(o.LicenceType) { toSerialize["licenceType"] = o.LicenceType } - - if o.CpuHotPlug != nil { + if !IsNil(o.CpuHotPlug) { toSerialize["cpuHotPlug"] = o.CpuHotPlug } - - if o.RamHotPlug != nil { + if !IsNil(o.RamHotPlug) { toSerialize["ramHotPlug"] = o.RamHotPlug } - - if o.NicHotPlug != nil { + if !IsNil(o.NicHotPlug) { toSerialize["nicHotPlug"] = o.NicHotPlug } - - if o.NicHotUnplug != nil { + if !IsNil(o.NicHotUnplug) { toSerialize["nicHotUnplug"] = o.NicHotUnplug } - - if o.DiscVirtioHotPlug != nil { + if !IsNil(o.DiscVirtioHotPlug) { toSerialize["discVirtioHotPlug"] = o.DiscVirtioHotPlug } - - if o.DiscVirtioHotUnplug != nil { + if !IsNil(o.DiscVirtioHotUnplug) { toSerialize["discVirtioHotUnplug"] = o.DiscVirtioHotUnplug } - - if o.ExposeSerial != nil { + if !IsNil(o.ExposeSerial) { toSerialize["exposeSerial"] = o.ExposeSerial } - - if o.DeviceNumber != nil { + if !IsNil(o.DeviceNumber) { toSerialize["deviceNumber"] = o.DeviceNumber } - - if o.PciSlot != nil { + if !IsNil(o.PciSlot) { toSerialize["pciSlot"] = o.PciSlot } - - if o.BackupunitId != nil { + if !IsNil(o.BackupunitId) { toSerialize["backupunitId"] = o.BackupunitId } - - if o.UserData != nil { + if !IsNil(o.UserData) { toSerialize["userData"] = o.UserData } - - if o.BootServer != nil { + if !IsNil(o.BootServer) { toSerialize["bootServer"] = o.BootServer } - - if o.BootOrder == &Nilstring { - toSerialize["bootOrder"] = nil - } else if o.BootOrder != nil { - toSerialize["bootOrder"] = o.BootOrder + if o.BootOrder.IsSet() { + toSerialize["bootOrder"] = o.BootOrder.Get() } - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableVolumeProperties struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_volumes.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_volumes.go similarity index 59% rename from vendor/github.com/ionos-cloud/sdk-go/v6/model_volumes.go rename to vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_volumes.go index 361fe2c33..e9cbc3e23 100644 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_volumes.go +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/model_volumes.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the Volumes type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Volumes{} + // Volumes struct for Volumes type Volumes struct { // The resource's unique identifier. @@ -23,7 +26,7 @@ type Volumes struct { // URL to the object representation (absolute path). Href *string `json:"href,omitempty"` // Array of items in the collection. - Items *[]Volume `json:"items,omitempty"` + Items []Volume `json:"items,omitempty"` // The offset (if specified in the request). Offset *float32 `json:"offset,omitempty"` // The limit (if specified in the request). @@ -49,303 +52,262 @@ func NewVolumesWithDefaults() *Volumes { return &this } -// GetId returns the Id field value -// If the value is explicit nil, nil is returned -func (o *Volumes) GetId() *string { - if o == nil { - return nil +// GetId returns the Id field value if set, zero value otherwise. +func (o *Volumes) GetId() string { + if o == nil || IsNil(o.Id) { + var ret string + return ret } - - return o.Id - + return *o.Id } -// GetIdOk returns a tuple with the Id field value +// GetIdOk returns a tuple with the Id 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 *Volumes) GetIdOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Id) { return nil, false } - return o.Id, true } -// SetId sets field value -func (o *Volumes) SetId(v string) { - - o.Id = &v - -} - // HasId returns a boolean if a field has been set. func (o *Volumes) HasId() bool { - if o != nil && o.Id != nil { + if o != nil && !IsNil(o.Id) { return true } return false } -// GetType returns the Type field value -// If the value is explicit nil, nil is returned -func (o *Volumes) GetType() *Type { - if o == nil { - return nil - } - - return o.Type +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *Volumes) SetId(v string) { + o.Id = &v +} +// GetType returns the Type field value if set, zero value otherwise. +func (o *Volumes) GetType() Type { + if o == nil || IsNil(o.Type) { + var ret Type + return ret + } + return *o.Type } -// GetTypeOk returns a tuple with the Type field value +// GetTypeOk returns a tuple with the Type 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 *Volumes) GetTypeOk() (*Type, bool) { - if o == nil { + if o == nil || IsNil(o.Type) { return nil, false } - return o.Type, true } -// SetType sets field value -func (o *Volumes) SetType(v Type) { - - o.Type = &v - -} - // HasType returns a boolean if a field has been set. func (o *Volumes) HasType() bool { - if o != nil && o.Type != nil { + if o != nil && !IsNil(o.Type) { return true } return false } -// GetHref returns the Href field value -// If the value is explicit nil, nil is returned -func (o *Volumes) GetHref() *string { - if o == nil { - return nil - } - - return o.Href +// SetType gets a reference to the given Type and assigns it to the Type field. +func (o *Volumes) SetType(v Type) { + o.Type = &v +} +// GetHref returns the Href field value if set, zero value otherwise. +func (o *Volumes) 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 +// GetHrefOk returns a tuple with the Href 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 *Volumes) GetHrefOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.Href) { return nil, false } - return o.Href, true } -// SetHref sets field value -func (o *Volumes) SetHref(v string) { - - o.Href = &v - -} - // HasHref returns a boolean if a field has been set. func (o *Volumes) HasHref() bool { - if o != nil && o.Href != nil { + if o != nil && !IsNil(o.Href) { return true } return false } -// GetItems returns the Items field value -// If the value is explicit nil, nil is returned -func (o *Volumes) GetItems() *[]Volume { - if o == nil { - return nil - } +// SetHref gets a reference to the given string and assigns it to the Href field. +func (o *Volumes) SetHref(v string) { + o.Href = &v +} +// GetItems returns the Items field value if set, zero value otherwise. +func (o *Volumes) GetItems() []Volume { + if o == nil || IsNil(o.Items) { + var ret []Volume + return ret + } return o.Items - } -// GetItemsOk returns a tuple with the Items field value +// GetItemsOk returns a tuple with the Items 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 *Volumes) GetItemsOk() (*[]Volume, bool) { - if o == nil { +func (o *Volumes) GetItemsOk() ([]Volume, bool) { + if o == nil || IsNil(o.Items) { return nil, false } - return o.Items, true } -// SetItems sets field value -func (o *Volumes) SetItems(v []Volume) { - - o.Items = &v - -} - // HasItems returns a boolean if a field has been set. func (o *Volumes) HasItems() bool { - if o != nil && o.Items != nil { + if o != nil && !IsNil(o.Items) { return true } return false } -// GetOffset returns the Offset field value -// If the value is explicit nil, nil is returned -func (o *Volumes) GetOffset() *float32 { - if o == nil { - return nil - } - - return o.Offset +// SetItems gets a reference to the given []Volume and assigns it to the Items field. +func (o *Volumes) SetItems(v []Volume) { + o.Items = v +} +// GetOffset returns the Offset field value if set, zero value otherwise. +func (o *Volumes) GetOffset() float32 { + if o == nil || IsNil(o.Offset) { + var ret float32 + return ret + } + return *o.Offset } -// GetOffsetOk returns a tuple with the Offset field value +// GetOffsetOk returns a tuple with the Offset 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 *Volumes) GetOffsetOk() (*float32, bool) { - if o == nil { + if o == nil || IsNil(o.Offset) { return nil, false } - return o.Offset, true } -// SetOffset sets field value -func (o *Volumes) SetOffset(v float32) { - - o.Offset = &v - -} - // HasOffset returns a boolean if a field has been set. func (o *Volumes) HasOffset() bool { - if o != nil && o.Offset != nil { + if o != nil && !IsNil(o.Offset) { return true } return false } -// GetLimit returns the Limit field value -// If the value is explicit nil, nil is returned -func (o *Volumes) GetLimit() *float32 { - if o == nil { - return nil - } - - return o.Limit +// SetOffset gets a reference to the given float32 and assigns it to the Offset field. +func (o *Volumes) SetOffset(v float32) { + o.Offset = &v +} +// GetLimit returns the Limit field value if set, zero value otherwise. +func (o *Volumes) GetLimit() float32 { + if o == nil || IsNil(o.Limit) { + var ret float32 + return ret + } + return *o.Limit } -// GetLimitOk returns a tuple with the Limit field value +// GetLimitOk returns a tuple with the Limit 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 *Volumes) GetLimitOk() (*float32, bool) { - if o == nil { + if o == nil || IsNil(o.Limit) { return nil, false } - return o.Limit, true } -// SetLimit sets field value -func (o *Volumes) SetLimit(v float32) { - - o.Limit = &v - -} - // HasLimit returns a boolean if a field has been set. func (o *Volumes) HasLimit() bool { - if o != nil && o.Limit != nil { + if o != nil && !IsNil(o.Limit) { return true } return false } -// GetLinks returns the Links field value -// If the value is explicit nil, nil is returned -func (o *Volumes) GetLinks() *PaginationLinks { - if o == nil { - return nil - } - - return o.Links +// SetLimit gets a reference to the given float32 and assigns it to the Limit field. +func (o *Volumes) SetLimit(v float32) { + o.Limit = &v +} +// GetLinks returns the Links field value if set, zero value otherwise. +func (o *Volumes) GetLinks() PaginationLinks { + if o == nil || IsNil(o.Links) { + var ret PaginationLinks + return ret + } + return *o.Links } -// GetLinksOk returns a tuple with the Links field value +// GetLinksOk returns a tuple with the Links 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 *Volumes) GetLinksOk() (*PaginationLinks, bool) { - if o == nil { + if o == nil || IsNil(o.Links) { return nil, false } - return o.Links, true } -// SetLinks sets field value -func (o *Volumes) SetLinks(v PaginationLinks) { - - o.Links = &v - -} - // HasLinks returns a boolean if a field has been set. func (o *Volumes) HasLinks() bool { - if o != nil && o.Links != nil { + if o != nil && !IsNil(o.Links) { return true } return false } +// SetLinks gets a reference to the given PaginationLinks and assigns it to the Links field. +func (o *Volumes) SetLinks(v PaginationLinks) { + o.Links = &v +} + func (o Volumes) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Volumes) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if o.Id != nil { + if !IsNil(o.Id) { toSerialize["id"] = o.Id } - - if o.Type != nil { + if !IsNil(o.Type) { toSerialize["type"] = o.Type } - - if o.Href != nil { + if !IsNil(o.Href) { toSerialize["href"] = o.Href } - - if o.Items != nil { + if !IsNil(o.Items) { toSerialize["items"] = o.Items } - - if o.Offset != nil { + if !IsNil(o.Offset) { toSerialize["offset"] = o.Offset } - - if o.Limit != nil { + if !IsNil(o.Limit) { toSerialize["limit"] = o.Limit } - - if o.Links != nil { + if !IsNil(o.Links) { toSerialize["_links"] = o.Links } - - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableVolumes struct { diff --git a/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/utils.go b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/utils.go new file mode 100644 index 000000000..d9bfc7873 --- /dev/null +++ b/vendor/github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2/utils.go @@ -0,0 +1,358 @@ +/* + * CLOUD API + * + * IONOS Enterprise-grade Infrastructure as a Service (IaaS) solutions can be managed through the Cloud API, in addition or as an alternative to the \"Data Center Designer\" (DCD) browser-based tool. Both methods employ consistent concepts and features, deliver similar power and flexibility, and can be used to perform a multitude of management tasks, including adding servers, volumes, configuring networks, and so on. + * + * API version: 6.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package ionoscloud + +import ( + "encoding/json" + "github.com/ionos-cloud/sdk-go-bundle/shared" + "reflect" + "strings" + "time" +) + +type IonosTime struct { + time.Time +} + +func (t *IonosTime) UnmarshalJSON(data []byte) error { + str := string(data) + if shared.Strlen(str) == 0 { + t = nil + return nil + } + if str[0] == '"' { + str = str[1:] + } + if str[len(str)-1] == '"' { + str = str[:len(str)-1] + } + if !strings.Contains(str, "Z") { + /* forcefully adding timezone suffix to be able to parse the + * string using RFC3339 */ + str += "Z" + } + tt, err := time.Parse(time.RFC3339, str) + if err != nil { + return err + } + *t = IonosTime{tt} + return nil +} + +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 v.value.MarshalJSON() +} + +func (v *NullableTime) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type MappedNullable interface { + ToMap() (map[string]interface{}, error) +} + +// 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 +} + +func IsZero(v interface{}) bool { + return reflect.ValueOf(v).IsZero() +} diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/.gitbook.yaml b/vendor/github.com/ionos-cloud/sdk-go/v6/.gitbook.yaml deleted file mode 100644 index 6c8fbd82b..000000000 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/.gitbook.yaml +++ /dev/null @@ -1,4 +0,0 @@ -root: docs -structure: - readme: README.md - summary: summary.md diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/LICENSE b/vendor/github.com/ionos-cloud/sdk-go/v6/LICENSE deleted file mode 100644 index b9d5d805f..000000000 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/LICENSE +++ /dev/null @@ -1,190 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - Copyright 2021 IONOS - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. \ No newline at end of file diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/configuration.go b/vendor/github.com/ionos-cloud/sdk-go/v6/configuration.go deleted file mode 100644 index 469e42079..000000000 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/configuration.go +++ /dev/null @@ -1,315 +0,0 @@ -/* - * CLOUD API - * - * IONOS Enterprise-grade Infrastructure as a Service (IaaS) solutions can be managed through the Cloud API, in addition or as an alternative to the \"Data Center Designer\" (DCD) browser-based tool. Both methods employ consistent concepts and features, deliver similar power and flexibility, and can be used to perform a multitude of management tasks, including adding servers, volumes, configuring networks, and so on. - * - * API version: 6.0 - */ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package ionoscloud - -import ( - "context" - "fmt" - "net/http" - "net/url" - "os" - "strconv" - "strings" - "time" -) - -const ( - IonosUsernameEnvVar = "IONOS_USERNAME" - IonosPasswordEnvVar = "IONOS_PASSWORD" - IonosTokenEnvVar = "IONOS_TOKEN" - IonosApiUrlEnvVar = "IONOS_API_URL" - IonosPinnedCertEnvVar = "IONOS_PINNED_CERT" - IonosLogLevelEnvVar = "IONOS_LOG_LEVEL" - IonosContractNumber = "IONOS_CONTRACT_NUMBER" - DefaultIonosServerUrl = "https://api.ionos.com/cloudapi/v6" - DefaultIonosBasePath = "/cloudapi/v6" - defaultMaxRetries = 3 - defaultWaitTime = time.Duration(100) * time.Millisecond - defaultMaxWaitTime = time.Duration(2000) * time.Millisecond -) - -// 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 ( - // ContextOAuth2 takes an oauth2.TokenSource as authentication for the request. - ContextOAuth2 = contextKey("token") - - // ContextBasicAuth takes BasicAuth as authentication for the request. - ContextBasicAuth = contextKey("basic") - - // ContextAccessToken takes a string oauth2 access token as authentication for the request. - ContextAccessToken = contextKey("accesstoken") - - // ContextAPIKeys takes a string apikey as authentication for the request - ContextAPIKeys = contextKey("apiKeys") - - // ContextHttpSignatureAuth takes HttpSignatureAuth as authentication for the request. - ContextHttpSignatureAuth = contextKey("httpsignature") - - // 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"` - DefaultQueryParams url.Values `json:"defaultQueryParams,omitempty"` - UserAgent string `json:"userAgent,omitempty"` - // Debug is deprecated, will be replaced by LogLevel - Debug bool `json:"debug,omitempty"` - Servers ServerConfigurations - OperationServers map[string]ServerConfigurations - HTTPClient *http.Client - Username string `json:"username,omitempty"` - Password string `json:"password,omitempty"` - Token string `json:"token,omitempty"` - MaxRetries int `json:"maxRetries,omitempty"` - WaitTime time.Duration `json:"waitTime,omitempty"` - MaxWaitTime time.Duration `json:"maxWaitTime,omitempty"` - LogLevel LogLevel - Logger Logger -} - -// NewConfiguration returns a new Configuration object -func NewConfiguration(username, password, token, hostUrl string) *Configuration { - cfg := &Configuration{ - DefaultHeader: make(map[string]string), - DefaultQueryParams: url.Values{}, - UserAgent: "ionos-cloud-sdk-go/v6.3.2", - Debug: false, - Username: username, - Password: password, - Token: token, - MaxRetries: defaultMaxRetries, - MaxWaitTime: defaultMaxWaitTime, - WaitTime: defaultWaitTime, - Logger: NewDefaultLogger(), - LogLevel: getLogLevelFromEnv(), - Host: getHost(hostUrl), - Scheme: getScheme(hostUrl), - Servers: ServerConfigurations{ - { - URL: getServerUrl(hostUrl), - Description: "No description provided", - }, - }, - OperationServers: map[string]ServerConfigurations{}, - } - return cfg -} - -func NewConfigurationFromEnv() *Configuration { - return NewConfiguration(os.Getenv(IonosUsernameEnvVar), os.Getenv(IonosPasswordEnvVar), os.Getenv(IonosTokenEnvVar), os.Getenv(IonosApiUrlEnvVar)) -} - -// SetDepth sets the depth query param for all the requests -func (c *Configuration) SetDepth(depth int32) { - c.DefaultQueryParams["depth"] = []string{strconv.Itoa(int(depth))} -} - -// 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 -} - -func (c *Configuration) AddDefaultQueryParam(key string, value string) { - c.DefaultQueryParams[key] = []string{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) -} - -func getServerUrl(serverUrl string) string { - if serverUrl == "" { - return DefaultIonosServerUrl - } - if !strings.HasPrefix(serverUrl, "https://") && !strings.HasPrefix(serverUrl, "http://") { - serverUrl = fmt.Sprintf("https://%s", serverUrl) - } - if !strings.HasSuffix(serverUrl, DefaultIonosBasePath) { - serverUrl = fmt.Sprintf("%s%s", serverUrl, DefaultIonosBasePath) - } - return serverUrl -} - -func getHost(serverUrl string) string { - // url.Parse only interprets the host correctly when the scheme is set, so we prepend one here if needed - if !strings.HasPrefix(serverUrl, "https://") && !strings.HasPrefix(serverUrl, "http://") { - serverUrl = "http://" + serverUrl - } - url, err := url.Parse(serverUrl) - if err != nil { - return "" - } - return url.Host -} - -func getScheme(serverUrl string) string { - url, err := url.Parse(serverUrl) - if err != nil { - return "" - } - return url.Scheme -} - -// 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/ionos-cloud/sdk-go/v6/git_push.sh b/vendor/github.com/ionos-cloud/sdk-go/v6/git_push.sh deleted file mode 100644 index 2c5840bee..000000000 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/git_push.sh +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/sh - -git_user_id=$1 -git_repo_id=$2 -release_note=$3 -git_host=$4 - -if [ "$git_host" = "" ]; then - git_host="github.com" - echo "[INFO] No command line input provided. Set \$git_host to $git_host" -fi - -if [ "$git_user_id" = "" ]; then - git_user_id="ionos-cloud" - echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" -fi - -if [ "$git_repo_id" = "" ]; then - git_repo_id="sdk-go" - echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" -fi - -if [ "$release_note" = "" ]; then - release_note="Minor update" - echo "[INFO] No command line input provided. Set \$release_note to $release_note" -fi - -# Initialize the local directory as a Git repository -git init - -# Adds the files in the local repository and stages them for commit. -git add . - -# Commits the tracked changes and prepares them to be pushed to a remote repository. -git commit -m "$release_note" - -# Sets the new remote -git_remote=`git remote` -if [ "$git_remote" = "" ]; then # git remote not defined - - if [ "$GIT_TOKEN" = "" ]; then - echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." - git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git - else - git remote add origin https://${git_user_id}:${GIT_TOKEN}@${git_host}/${git_user_id}/${git_repo_id}.git - fi - -fi - -git pull origin master - -# Pushes (Forces) the changes in the local repository up to the remote repository -echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" -git push origin master 2>&1 | grep -v 'To https' - diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/logger.go b/vendor/github.com/ionos-cloud/sdk-go/v6/logger.go deleted file mode 100644 index 3eb9ad714..000000000 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/logger.go +++ /dev/null @@ -1,80 +0,0 @@ -/* - * CLOUD API - * - * IONOS Enterprise-grade Infrastructure as a Service (IaaS) solutions can be managed through the Cloud API, in addition or as an alternative to the \"Data Center Designer\" (DCD) browser-based tool. Both methods employ consistent concepts and features, deliver similar power and flexibility, and can be used to perform a multitude of management tasks, including adding servers, volumes, configuring networks, and so on. - * - * API version: 6.0 - */ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package ionoscloud - -import ( - "log" - "os" - "strings" -) - -type LogLevel uint - -func (l *LogLevel) Get() LogLevel { - if l != nil { - return *l - } - return Off -} - -// Satisfies returns true if this LogLevel is at least high enough for v -func (l *LogLevel) Satisfies(v LogLevel) bool { - return l.Get() >= v -} - -const ( - Off LogLevel = 0x100 * iota - Debug - // Trace We recommend you only set this field for debugging purposes. - // Disable it in your production environments because it can log sensitive data. - // It logs the full request and response without encryption, even for an HTTPS call. - // Verbose request and response logging can also significantly impact your application's performance. - Trace -) - -var LogLevelMap = map[string]LogLevel{ - "off": Off, - "debug": Debug, - "trace": Trace, -} - -// getLogLevelFromEnv - gets LogLevel type from env variable IONOS_LOG_LEVEL -// returns Off if an invalid log level is encountered -func getLogLevelFromEnv() LogLevel { - strLogLevel := "off" - if os.Getenv(IonosLogLevelEnvVar) != "" { - strLogLevel = os.Getenv(IonosLogLevelEnvVar) - } - - logLevel, ok := LogLevelMap[strings.ToLower(strLogLevel)] - if !ok { - log.Printf("Cannot set logLevel for value: %s, setting loglevel to Off", strLogLevel) - } - return logLevel -} - -type Logger interface { - Printf(format string, args ...interface{}) -} - -func NewDefaultLogger() Logger { - return &defaultLogger{ - logger: log.New(os.Stderr, "IONOSLOG ", log.LstdFlags), - } -} - -type defaultLogger struct { - logger *log.Logger -} - -func (l defaultLogger) Printf(format string, args ...interface{}) { - l.logger.Printf(format, args...) -} diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_data_center_entities.go b/vendor/github.com/ionos-cloud/sdk-go/v6/model_data_center_entities.go deleted file mode 100644 index 1ac919fe6..000000000 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_data_center_entities.go +++ /dev/null @@ -1,379 +0,0 @@ -/* - * CLOUD API - * - * IONOS Enterprise-grade Infrastructure as a Service (IaaS) solutions can be managed through the Cloud API, in addition or as an alternative to the \"Data Center Designer\" (DCD) browser-based tool. Both methods employ consistent concepts and features, deliver similar power and flexibility, and can be used to perform a multitude of management tasks, including adding servers, volumes, configuring networks, and so on. - * - * API version: 6.0 - */ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package ionoscloud - -import ( - "encoding/json" -) - -// DataCenterEntities struct for DataCenterEntities -type DataCenterEntities struct { - Servers *Servers `json:"servers,omitempty"` - Volumes *Volumes `json:"volumes,omitempty"` - Loadbalancers *Loadbalancers `json:"loadbalancers,omitempty"` - Lans *Lans `json:"lans,omitempty"` - Networkloadbalancers *NetworkLoadBalancers `json:"networkloadbalancers,omitempty"` - Natgateways *NatGateways `json:"natgateways,omitempty"` - Securitygroups *SecurityGroups `json:"securitygroups,omitempty"` -} - -// NewDataCenterEntities instantiates a new DataCenterEntities 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 NewDataCenterEntities() *DataCenterEntities { - this := DataCenterEntities{} - - return &this -} - -// NewDataCenterEntitiesWithDefaults instantiates a new DataCenterEntities 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 NewDataCenterEntitiesWithDefaults() *DataCenterEntities { - this := DataCenterEntities{} - return &this -} - -// GetServers returns the Servers field value -// If the value is explicit nil, nil is returned -func (o *DataCenterEntities) GetServers() *Servers { - if o == nil { - return nil - } - - return o.Servers - -} - -// GetServersOk returns a tuple with the Servers field value -// 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 *DataCenterEntities) GetServersOk() (*Servers, bool) { - if o == nil { - return nil, false - } - - return o.Servers, true -} - -// SetServers sets field value -func (o *DataCenterEntities) SetServers(v Servers) { - - o.Servers = &v - -} - -// HasServers returns a boolean if a field has been set. -func (o *DataCenterEntities) HasServers() bool { - if o != nil && o.Servers != nil { - return true - } - - return false -} - -// GetVolumes returns the Volumes field value -// If the value is explicit nil, nil is returned -func (o *DataCenterEntities) GetVolumes() *Volumes { - if o == nil { - return nil - } - - return o.Volumes - -} - -// GetVolumesOk returns a tuple with the Volumes field value -// 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 *DataCenterEntities) GetVolumesOk() (*Volumes, bool) { - if o == nil { - return nil, false - } - - return o.Volumes, true -} - -// SetVolumes sets field value -func (o *DataCenterEntities) SetVolumes(v Volumes) { - - o.Volumes = &v - -} - -// HasVolumes returns a boolean if a field has been set. -func (o *DataCenterEntities) HasVolumes() bool { - if o != nil && o.Volumes != nil { - return true - } - - return false -} - -// GetLoadbalancers returns the Loadbalancers field value -// If the value is explicit nil, nil is returned -func (o *DataCenterEntities) GetLoadbalancers() *Loadbalancers { - if o == nil { - return nil - } - - return o.Loadbalancers - -} - -// GetLoadbalancersOk returns a tuple with the Loadbalancers field value -// 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 *DataCenterEntities) GetLoadbalancersOk() (*Loadbalancers, bool) { - if o == nil { - return nil, false - } - - return o.Loadbalancers, true -} - -// SetLoadbalancers sets field value -func (o *DataCenterEntities) SetLoadbalancers(v Loadbalancers) { - - o.Loadbalancers = &v - -} - -// HasLoadbalancers returns a boolean if a field has been set. -func (o *DataCenterEntities) HasLoadbalancers() bool { - if o != nil && o.Loadbalancers != nil { - return true - } - - return false -} - -// GetLans returns the Lans field value -// If the value is explicit nil, nil is returned -func (o *DataCenterEntities) GetLans() *Lans { - if o == nil { - return nil - } - - return o.Lans - -} - -// GetLansOk returns a tuple with the Lans field value -// 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 *DataCenterEntities) GetLansOk() (*Lans, bool) { - if o == nil { - return nil, false - } - - return o.Lans, true -} - -// SetLans sets field value -func (o *DataCenterEntities) SetLans(v Lans) { - - o.Lans = &v - -} - -// HasLans returns a boolean if a field has been set. -func (o *DataCenterEntities) HasLans() bool { - if o != nil && o.Lans != nil { - return true - } - - return false -} - -// GetNetworkloadbalancers returns the Networkloadbalancers field value -// If the value is explicit nil, nil is returned -func (o *DataCenterEntities) GetNetworkloadbalancers() *NetworkLoadBalancers { - if o == nil { - return nil - } - - return o.Networkloadbalancers - -} - -// GetNetworkloadbalancersOk returns a tuple with the Networkloadbalancers field value -// 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 *DataCenterEntities) GetNetworkloadbalancersOk() (*NetworkLoadBalancers, bool) { - if o == nil { - return nil, false - } - - return o.Networkloadbalancers, true -} - -// SetNetworkloadbalancers sets field value -func (o *DataCenterEntities) SetNetworkloadbalancers(v NetworkLoadBalancers) { - - o.Networkloadbalancers = &v - -} - -// HasNetworkloadbalancers returns a boolean if a field has been set. -func (o *DataCenterEntities) HasNetworkloadbalancers() bool { - if o != nil && o.Networkloadbalancers != nil { - return true - } - - return false -} - -// GetNatgateways returns the Natgateways field value -// If the value is explicit nil, nil is returned -func (o *DataCenterEntities) GetNatgateways() *NatGateways { - if o == nil { - return nil - } - - return o.Natgateways - -} - -// GetNatgatewaysOk returns a tuple with the Natgateways field value -// 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 *DataCenterEntities) GetNatgatewaysOk() (*NatGateways, bool) { - if o == nil { - return nil, false - } - - return o.Natgateways, true -} - -// SetNatgateways sets field value -func (o *DataCenterEntities) SetNatgateways(v NatGateways) { - - o.Natgateways = &v - -} - -// HasNatgateways returns a boolean if a field has been set. -func (o *DataCenterEntities) HasNatgateways() bool { - if o != nil && o.Natgateways != nil { - return true - } - - return false -} - -// GetSecuritygroups returns the Securitygroups field value -// If the value is explicit nil, nil is returned -func (o *DataCenterEntities) GetSecuritygroups() *SecurityGroups { - if o == nil { - return nil - } - - return o.Securitygroups - -} - -// GetSecuritygroupsOk returns a tuple with the Securitygroups field value -// 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 *DataCenterEntities) GetSecuritygroupsOk() (*SecurityGroups, bool) { - if o == nil { - return nil, false - } - - return o.Securitygroups, true -} - -// SetSecuritygroups sets field value -func (o *DataCenterEntities) SetSecuritygroups(v SecurityGroups) { - - o.Securitygroups = &v - -} - -// HasSecuritygroups returns a boolean if a field has been set. -func (o *DataCenterEntities) HasSecuritygroups() bool { - if o != nil && o.Securitygroups != nil { - return true - } - - return false -} - -func (o DataCenterEntities) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.Servers != nil { - toSerialize["servers"] = o.Servers - } - - if o.Volumes != nil { - toSerialize["volumes"] = o.Volumes - } - - if o.Loadbalancers != nil { - toSerialize["loadbalancers"] = o.Loadbalancers - } - - if o.Lans != nil { - toSerialize["lans"] = o.Lans - } - - if o.Networkloadbalancers != nil { - toSerialize["networkloadbalancers"] = o.Networkloadbalancers - } - - if o.Natgateways != nil { - toSerialize["natgateways"] = o.Natgateways - } - - if o.Securitygroups != nil { - toSerialize["securitygroups"] = o.Securitygroups - } - - return json.Marshal(toSerialize) -} - -type NullableDataCenterEntities struct { - value *DataCenterEntities - isSet bool -} - -func (v NullableDataCenterEntities) Get() *DataCenterEntities { - return v.value -} - -func (v *NullableDataCenterEntities) Set(val *DataCenterEntities) { - v.value = val - v.isSet = true -} - -func (v NullableDataCenterEntities) IsSet() bool { - return v.isSet -} - -func (v *NullableDataCenterEntities) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableDataCenterEntities(val *DataCenterEntities) *NullableDataCenterEntities { - return &NullableDataCenterEntities{value: val, isSet: true} -} - -func (v NullableDataCenterEntities) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableDataCenterEntities) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/model_resource_limits.go b/vendor/github.com/ionos-cloud/sdk-go/v6/model_resource_limits.go deleted file mode 100644 index e7402fe46..000000000 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/model_resource_limits.go +++ /dev/null @@ -1,1204 +0,0 @@ -/* - * CLOUD API - * - * IONOS Enterprise-grade Infrastructure as a Service (IaaS) solutions can be managed through the Cloud API, in addition or as an alternative to the \"Data Center Designer\" (DCD) browser-based tool. Both methods employ consistent concepts and features, deliver similar power and flexibility, and can be used to perform a multitude of management tasks, including adding servers, volumes, configuring networks, and so on. - * - * API version: 6.0 - */ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package ionoscloud - -import ( - "encoding/json" -) - -// ResourceLimits struct for ResourceLimits -type ResourceLimits struct { - // The maximum number of CPU cores per server. - CoresPerServer *int32 `json:"coresPerServer"` - // The maximum number of CPU cores per contract. - CoresPerContract *int32 `json:"coresPerContract"` - // The number of CPU cores provisioned. - CoresProvisioned *int32 `json:"coresProvisioned"` - // The maximum amount of RAM (in MB) that can be provisioned for a particular server under this contract. - RamPerServer *int32 `json:"ramPerServer"` - // The maximum amount of RAM (in MB) that can be provisioned under this contract. - RamPerContract *int32 `json:"ramPerContract"` - // The amount of RAM (in MB) provisioned under this contract. - RamProvisioned *int32 `json:"ramProvisioned"` - // The maximum size (in MB) of an idividual hard disk volume. - HddLimitPerVolume *int64 `json:"hddLimitPerVolume"` - // The maximum amount of disk space (in MB) that can be provided under this contract. - HddLimitPerContract *int64 `json:"hddLimitPerContract"` - // The amount of hard disk space (in MB) that is currently provisioned. - HddVolumeProvisioned *int64 `json:"hddVolumeProvisioned"` - // The maximum size (in MB) of an individual solid state disk volume. - SsdLimitPerVolume *int64 `json:"ssdLimitPerVolume"` - // The maximum amount of solid state disk space (in MB) that can be provisioned under this contract. - SsdLimitPerContract *int64 `json:"ssdLimitPerContract"` - // The amount of solid state disk space (in MB) that is currently provisioned. - SsdVolumeProvisioned *int64 `json:"ssdVolumeProvisioned"` - // The amount of DAS disk space (in MB) in a Cube server that is currently provisioned. - DasVolumeProvisioned *int64 `json:"dasVolumeProvisioned"` - // The maximum number of static public IP addresses that can be reserved by this customer across contracts. - ReservableIps *int32 `json:"reservableIps"` - // The maximum number of static public IP addresses that can be reserved for this contract. - ReservedIpsOnContract *int32 `json:"reservedIpsOnContract"` - // The number of static public IP addresses in use. - ReservedIpsInUse *int32 `json:"reservedIpsInUse"` - // The maximum number of Kubernetes clusters that can be created under this contract. - K8sClusterLimitTotal *int32 `json:"k8sClusterLimitTotal"` - // The amount of Kubernetes clusters that is currently provisioned. - K8sClustersProvisioned *int32 `json:"k8sClustersProvisioned"` - // The NLB total limit. - NlbLimitTotal *int32 `json:"nlbLimitTotal"` - // The NLBs provisioned. - NlbProvisioned *int32 `json:"nlbProvisioned"` - // The NAT Gateway total limit. - NatGatewayLimitTotal *int32 `json:"natGatewayLimitTotal"` - // The NAT Gateways provisioned. - NatGatewayProvisioned *int32 `json:"natGatewayProvisioned"` - // The maximum number of security groups per VDC. - SecurityGroupsPerVdc *int32 `json:"securityGroupsPerVdc"` - // The maximum number of security groups that can be attached to a NIC or a VM individually. For example, a user can have maximum 10 security groups per NIC and 10 per VM. - SecurityGroupsPerResource *int32 `json:"securityGroupsPerResource"` - // The maximum number of rules per security group. - RulesPerSecurityGroup *int32 `json:"rulesPerSecurityGroup"` -} - -// NewResourceLimits instantiates a new ResourceLimits 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 NewResourceLimits(coresPerServer int32, coresPerContract int32, coresProvisioned int32, ramPerServer int32, ramPerContract int32, ramProvisioned int32, hddLimitPerVolume int64, hddLimitPerContract int64, hddVolumeProvisioned int64, ssdLimitPerVolume int64, ssdLimitPerContract int64, ssdVolumeProvisioned int64, dasVolumeProvisioned int64, reservableIps int32, reservedIpsOnContract int32, reservedIpsInUse int32, k8sClusterLimitTotal int32, k8sClustersProvisioned int32, nlbLimitTotal int32, nlbProvisioned int32, natGatewayLimitTotal int32, natGatewayProvisioned int32, securityGroupsPerVdc int32, securityGroupsPerResource int32, rulesPerSecurityGroup int32) *ResourceLimits { - this := ResourceLimits{} - - this.CoresPerServer = &coresPerServer - this.CoresPerContract = &coresPerContract - this.CoresProvisioned = &coresProvisioned - this.RamPerServer = &ramPerServer - this.RamPerContract = &ramPerContract - this.RamProvisioned = &ramProvisioned - this.HddLimitPerVolume = &hddLimitPerVolume - this.HddLimitPerContract = &hddLimitPerContract - this.HddVolumeProvisioned = &hddVolumeProvisioned - this.SsdLimitPerVolume = &ssdLimitPerVolume - this.SsdLimitPerContract = &ssdLimitPerContract - this.SsdVolumeProvisioned = &ssdVolumeProvisioned - this.DasVolumeProvisioned = &dasVolumeProvisioned - this.ReservableIps = &reservableIps - this.ReservedIpsOnContract = &reservedIpsOnContract - this.ReservedIpsInUse = &reservedIpsInUse - this.K8sClusterLimitTotal = &k8sClusterLimitTotal - this.K8sClustersProvisioned = &k8sClustersProvisioned - this.NlbLimitTotal = &nlbLimitTotal - this.NlbProvisioned = &nlbProvisioned - this.NatGatewayLimitTotal = &natGatewayLimitTotal - this.NatGatewayProvisioned = &natGatewayProvisioned - this.SecurityGroupsPerVdc = &securityGroupsPerVdc - this.SecurityGroupsPerResource = &securityGroupsPerResource - this.RulesPerSecurityGroup = &rulesPerSecurityGroup - - return &this -} - -// NewResourceLimitsWithDefaults instantiates a new ResourceLimits 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 NewResourceLimitsWithDefaults() *ResourceLimits { - this := ResourceLimits{} - return &this -} - -// GetCoresPerServer returns the CoresPerServer field value -// If the value is explicit nil, nil is returned -func (o *ResourceLimits) GetCoresPerServer() *int32 { - if o == nil { - return nil - } - - return o.CoresPerServer - -} - -// GetCoresPerServerOk returns a tuple with the CoresPerServer field value -// 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 *ResourceLimits) GetCoresPerServerOk() (*int32, bool) { - if o == nil { - return nil, false - } - - return o.CoresPerServer, true -} - -// SetCoresPerServer sets field value -func (o *ResourceLimits) SetCoresPerServer(v int32) { - - o.CoresPerServer = &v - -} - -// HasCoresPerServer returns a boolean if a field has been set. -func (o *ResourceLimits) HasCoresPerServer() bool { - if o != nil && o.CoresPerServer != nil { - return true - } - - return false -} - -// GetCoresPerContract returns the CoresPerContract field value -// If the value is explicit nil, nil is returned -func (o *ResourceLimits) GetCoresPerContract() *int32 { - if o == nil { - return nil - } - - return o.CoresPerContract - -} - -// GetCoresPerContractOk returns a tuple with the CoresPerContract field value -// 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 *ResourceLimits) GetCoresPerContractOk() (*int32, bool) { - if o == nil { - return nil, false - } - - return o.CoresPerContract, true -} - -// SetCoresPerContract sets field value -func (o *ResourceLimits) SetCoresPerContract(v int32) { - - o.CoresPerContract = &v - -} - -// HasCoresPerContract returns a boolean if a field has been set. -func (o *ResourceLimits) HasCoresPerContract() bool { - if o != nil && o.CoresPerContract != nil { - return true - } - - return false -} - -// GetCoresProvisioned returns the CoresProvisioned field value -// If the value is explicit nil, nil is returned -func (o *ResourceLimits) GetCoresProvisioned() *int32 { - if o == nil { - return nil - } - - return o.CoresProvisioned - -} - -// GetCoresProvisionedOk returns a tuple with the CoresProvisioned field value -// 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 *ResourceLimits) GetCoresProvisionedOk() (*int32, bool) { - if o == nil { - return nil, false - } - - return o.CoresProvisioned, true -} - -// SetCoresProvisioned sets field value -func (o *ResourceLimits) SetCoresProvisioned(v int32) { - - o.CoresProvisioned = &v - -} - -// HasCoresProvisioned returns a boolean if a field has been set. -func (o *ResourceLimits) HasCoresProvisioned() bool { - if o != nil && o.CoresProvisioned != nil { - return true - } - - return false -} - -// GetRamPerServer returns the RamPerServer field value -// If the value is explicit nil, nil is returned -func (o *ResourceLimits) GetRamPerServer() *int32 { - if o == nil { - return nil - } - - return o.RamPerServer - -} - -// GetRamPerServerOk returns a tuple with the RamPerServer field value -// 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 *ResourceLimits) GetRamPerServerOk() (*int32, bool) { - if o == nil { - return nil, false - } - - return o.RamPerServer, true -} - -// SetRamPerServer sets field value -func (o *ResourceLimits) SetRamPerServer(v int32) { - - o.RamPerServer = &v - -} - -// HasRamPerServer returns a boolean if a field has been set. -func (o *ResourceLimits) HasRamPerServer() bool { - if o != nil && o.RamPerServer != nil { - return true - } - - return false -} - -// GetRamPerContract returns the RamPerContract field value -// If the value is explicit nil, nil is returned -func (o *ResourceLimits) GetRamPerContract() *int32 { - if o == nil { - return nil - } - - return o.RamPerContract - -} - -// GetRamPerContractOk returns a tuple with the RamPerContract field value -// 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 *ResourceLimits) GetRamPerContractOk() (*int32, bool) { - if o == nil { - return nil, false - } - - return o.RamPerContract, true -} - -// SetRamPerContract sets field value -func (o *ResourceLimits) SetRamPerContract(v int32) { - - o.RamPerContract = &v - -} - -// HasRamPerContract returns a boolean if a field has been set. -func (o *ResourceLimits) HasRamPerContract() bool { - if o != nil && o.RamPerContract != nil { - return true - } - - return false -} - -// GetRamProvisioned returns the RamProvisioned field value -// If the value is explicit nil, nil is returned -func (o *ResourceLimits) GetRamProvisioned() *int32 { - if o == nil { - return nil - } - - return o.RamProvisioned - -} - -// GetRamProvisionedOk returns a tuple with the RamProvisioned field value -// 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 *ResourceLimits) GetRamProvisionedOk() (*int32, bool) { - if o == nil { - return nil, false - } - - return o.RamProvisioned, true -} - -// SetRamProvisioned sets field value -func (o *ResourceLimits) SetRamProvisioned(v int32) { - - o.RamProvisioned = &v - -} - -// HasRamProvisioned returns a boolean if a field has been set. -func (o *ResourceLimits) HasRamProvisioned() bool { - if o != nil && o.RamProvisioned != nil { - return true - } - - return false -} - -// GetHddLimitPerVolume returns the HddLimitPerVolume field value -// If the value is explicit nil, nil is returned -func (o *ResourceLimits) GetHddLimitPerVolume() *int64 { - if o == nil { - return nil - } - - return o.HddLimitPerVolume - -} - -// GetHddLimitPerVolumeOk returns a tuple with the HddLimitPerVolume field value -// 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 *ResourceLimits) GetHddLimitPerVolumeOk() (*int64, bool) { - if o == nil { - return nil, false - } - - return o.HddLimitPerVolume, true -} - -// SetHddLimitPerVolume sets field value -func (o *ResourceLimits) SetHddLimitPerVolume(v int64) { - - o.HddLimitPerVolume = &v - -} - -// HasHddLimitPerVolume returns a boolean if a field has been set. -func (o *ResourceLimits) HasHddLimitPerVolume() bool { - if o != nil && o.HddLimitPerVolume != nil { - return true - } - - return false -} - -// GetHddLimitPerContract returns the HddLimitPerContract field value -// If the value is explicit nil, nil is returned -func (o *ResourceLimits) GetHddLimitPerContract() *int64 { - if o == nil { - return nil - } - - return o.HddLimitPerContract - -} - -// GetHddLimitPerContractOk returns a tuple with the HddLimitPerContract field value -// 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 *ResourceLimits) GetHddLimitPerContractOk() (*int64, bool) { - if o == nil { - return nil, false - } - - return o.HddLimitPerContract, true -} - -// SetHddLimitPerContract sets field value -func (o *ResourceLimits) SetHddLimitPerContract(v int64) { - - o.HddLimitPerContract = &v - -} - -// HasHddLimitPerContract returns a boolean if a field has been set. -func (o *ResourceLimits) HasHddLimitPerContract() bool { - if o != nil && o.HddLimitPerContract != nil { - return true - } - - return false -} - -// GetHddVolumeProvisioned returns the HddVolumeProvisioned field value -// If the value is explicit nil, nil is returned -func (o *ResourceLimits) GetHddVolumeProvisioned() *int64 { - if o == nil { - return nil - } - - return o.HddVolumeProvisioned - -} - -// GetHddVolumeProvisionedOk returns a tuple with the HddVolumeProvisioned field value -// 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 *ResourceLimits) GetHddVolumeProvisionedOk() (*int64, bool) { - if o == nil { - return nil, false - } - - return o.HddVolumeProvisioned, true -} - -// SetHddVolumeProvisioned sets field value -func (o *ResourceLimits) SetHddVolumeProvisioned(v int64) { - - o.HddVolumeProvisioned = &v - -} - -// HasHddVolumeProvisioned returns a boolean if a field has been set. -func (o *ResourceLimits) HasHddVolumeProvisioned() bool { - if o != nil && o.HddVolumeProvisioned != nil { - return true - } - - return false -} - -// GetSsdLimitPerVolume returns the SsdLimitPerVolume field value -// If the value is explicit nil, nil is returned -func (o *ResourceLimits) GetSsdLimitPerVolume() *int64 { - if o == nil { - return nil - } - - return o.SsdLimitPerVolume - -} - -// GetSsdLimitPerVolumeOk returns a tuple with the SsdLimitPerVolume field value -// 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 *ResourceLimits) GetSsdLimitPerVolumeOk() (*int64, bool) { - if o == nil { - return nil, false - } - - return o.SsdLimitPerVolume, true -} - -// SetSsdLimitPerVolume sets field value -func (o *ResourceLimits) SetSsdLimitPerVolume(v int64) { - - o.SsdLimitPerVolume = &v - -} - -// HasSsdLimitPerVolume returns a boolean if a field has been set. -func (o *ResourceLimits) HasSsdLimitPerVolume() bool { - if o != nil && o.SsdLimitPerVolume != nil { - return true - } - - return false -} - -// GetSsdLimitPerContract returns the SsdLimitPerContract field value -// If the value is explicit nil, nil is returned -func (o *ResourceLimits) GetSsdLimitPerContract() *int64 { - if o == nil { - return nil - } - - return o.SsdLimitPerContract - -} - -// GetSsdLimitPerContractOk returns a tuple with the SsdLimitPerContract field value -// 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 *ResourceLimits) GetSsdLimitPerContractOk() (*int64, bool) { - if o == nil { - return nil, false - } - - return o.SsdLimitPerContract, true -} - -// SetSsdLimitPerContract sets field value -func (o *ResourceLimits) SetSsdLimitPerContract(v int64) { - - o.SsdLimitPerContract = &v - -} - -// HasSsdLimitPerContract returns a boolean if a field has been set. -func (o *ResourceLimits) HasSsdLimitPerContract() bool { - if o != nil && o.SsdLimitPerContract != nil { - return true - } - - return false -} - -// GetSsdVolumeProvisioned returns the SsdVolumeProvisioned field value -// If the value is explicit nil, nil is returned -func (o *ResourceLimits) GetSsdVolumeProvisioned() *int64 { - if o == nil { - return nil - } - - return o.SsdVolumeProvisioned - -} - -// GetSsdVolumeProvisionedOk returns a tuple with the SsdVolumeProvisioned field value -// 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 *ResourceLimits) GetSsdVolumeProvisionedOk() (*int64, bool) { - if o == nil { - return nil, false - } - - return o.SsdVolumeProvisioned, true -} - -// SetSsdVolumeProvisioned sets field value -func (o *ResourceLimits) SetSsdVolumeProvisioned(v int64) { - - o.SsdVolumeProvisioned = &v - -} - -// HasSsdVolumeProvisioned returns a boolean if a field has been set. -func (o *ResourceLimits) HasSsdVolumeProvisioned() bool { - if o != nil && o.SsdVolumeProvisioned != nil { - return true - } - - return false -} - -// GetDasVolumeProvisioned returns the DasVolumeProvisioned field value -// If the value is explicit nil, nil is returned -func (o *ResourceLimits) GetDasVolumeProvisioned() *int64 { - if o == nil { - return nil - } - - return o.DasVolumeProvisioned - -} - -// GetDasVolumeProvisionedOk returns a tuple with the DasVolumeProvisioned field value -// 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 *ResourceLimits) GetDasVolumeProvisionedOk() (*int64, bool) { - if o == nil { - return nil, false - } - - return o.DasVolumeProvisioned, true -} - -// SetDasVolumeProvisioned sets field value -func (o *ResourceLimits) SetDasVolumeProvisioned(v int64) { - - o.DasVolumeProvisioned = &v - -} - -// HasDasVolumeProvisioned returns a boolean if a field has been set. -func (o *ResourceLimits) HasDasVolumeProvisioned() bool { - if o != nil && o.DasVolumeProvisioned != nil { - return true - } - - return false -} - -// GetReservableIps returns the ReservableIps field value -// If the value is explicit nil, nil is returned -func (o *ResourceLimits) GetReservableIps() *int32 { - if o == nil { - return nil - } - - return o.ReservableIps - -} - -// GetReservableIpsOk returns a tuple with the ReservableIps field value -// 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 *ResourceLimits) GetReservableIpsOk() (*int32, bool) { - if o == nil { - return nil, false - } - - return o.ReservableIps, true -} - -// SetReservableIps sets field value -func (o *ResourceLimits) SetReservableIps(v int32) { - - o.ReservableIps = &v - -} - -// HasReservableIps returns a boolean if a field has been set. -func (o *ResourceLimits) HasReservableIps() bool { - if o != nil && o.ReservableIps != nil { - return true - } - - return false -} - -// GetReservedIpsOnContract returns the ReservedIpsOnContract field value -// If the value is explicit nil, nil is returned -func (o *ResourceLimits) GetReservedIpsOnContract() *int32 { - if o == nil { - return nil - } - - return o.ReservedIpsOnContract - -} - -// GetReservedIpsOnContractOk returns a tuple with the ReservedIpsOnContract field value -// 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 *ResourceLimits) GetReservedIpsOnContractOk() (*int32, bool) { - if o == nil { - return nil, false - } - - return o.ReservedIpsOnContract, true -} - -// SetReservedIpsOnContract sets field value -func (o *ResourceLimits) SetReservedIpsOnContract(v int32) { - - o.ReservedIpsOnContract = &v - -} - -// HasReservedIpsOnContract returns a boolean if a field has been set. -func (o *ResourceLimits) HasReservedIpsOnContract() bool { - if o != nil && o.ReservedIpsOnContract != nil { - return true - } - - return false -} - -// GetReservedIpsInUse returns the ReservedIpsInUse field value -// If the value is explicit nil, nil is returned -func (o *ResourceLimits) GetReservedIpsInUse() *int32 { - if o == nil { - return nil - } - - return o.ReservedIpsInUse - -} - -// GetReservedIpsInUseOk returns a tuple with the ReservedIpsInUse field value -// 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 *ResourceLimits) GetReservedIpsInUseOk() (*int32, bool) { - if o == nil { - return nil, false - } - - return o.ReservedIpsInUse, true -} - -// SetReservedIpsInUse sets field value -func (o *ResourceLimits) SetReservedIpsInUse(v int32) { - - o.ReservedIpsInUse = &v - -} - -// HasReservedIpsInUse returns a boolean if a field has been set. -func (o *ResourceLimits) HasReservedIpsInUse() bool { - if o != nil && o.ReservedIpsInUse != nil { - return true - } - - return false -} - -// GetK8sClusterLimitTotal returns the K8sClusterLimitTotal field value -// If the value is explicit nil, nil is returned -func (o *ResourceLimits) GetK8sClusterLimitTotal() *int32 { - if o == nil { - return nil - } - - return o.K8sClusterLimitTotal - -} - -// GetK8sClusterLimitTotalOk returns a tuple with the K8sClusterLimitTotal field value -// 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 *ResourceLimits) GetK8sClusterLimitTotalOk() (*int32, bool) { - if o == nil { - return nil, false - } - - return o.K8sClusterLimitTotal, true -} - -// SetK8sClusterLimitTotal sets field value -func (o *ResourceLimits) SetK8sClusterLimitTotal(v int32) { - - o.K8sClusterLimitTotal = &v - -} - -// HasK8sClusterLimitTotal returns a boolean if a field has been set. -func (o *ResourceLimits) HasK8sClusterLimitTotal() bool { - if o != nil && o.K8sClusterLimitTotal != nil { - return true - } - - return false -} - -// GetK8sClustersProvisioned returns the K8sClustersProvisioned field value -// If the value is explicit nil, nil is returned -func (o *ResourceLimits) GetK8sClustersProvisioned() *int32 { - if o == nil { - return nil - } - - return o.K8sClustersProvisioned - -} - -// GetK8sClustersProvisionedOk returns a tuple with the K8sClustersProvisioned field value -// 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 *ResourceLimits) GetK8sClustersProvisionedOk() (*int32, bool) { - if o == nil { - return nil, false - } - - return o.K8sClustersProvisioned, true -} - -// SetK8sClustersProvisioned sets field value -func (o *ResourceLimits) SetK8sClustersProvisioned(v int32) { - - o.K8sClustersProvisioned = &v - -} - -// HasK8sClustersProvisioned returns a boolean if a field has been set. -func (o *ResourceLimits) HasK8sClustersProvisioned() bool { - if o != nil && o.K8sClustersProvisioned != nil { - return true - } - - return false -} - -// GetNlbLimitTotal returns the NlbLimitTotal field value -// If the value is explicit nil, nil is returned -func (o *ResourceLimits) GetNlbLimitTotal() *int32 { - if o == nil { - return nil - } - - return o.NlbLimitTotal - -} - -// GetNlbLimitTotalOk returns a tuple with the NlbLimitTotal field value -// 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 *ResourceLimits) GetNlbLimitTotalOk() (*int32, bool) { - if o == nil { - return nil, false - } - - return o.NlbLimitTotal, true -} - -// SetNlbLimitTotal sets field value -func (o *ResourceLimits) SetNlbLimitTotal(v int32) { - - o.NlbLimitTotal = &v - -} - -// HasNlbLimitTotal returns a boolean if a field has been set. -func (o *ResourceLimits) HasNlbLimitTotal() bool { - if o != nil && o.NlbLimitTotal != nil { - return true - } - - return false -} - -// GetNlbProvisioned returns the NlbProvisioned field value -// If the value is explicit nil, nil is returned -func (o *ResourceLimits) GetNlbProvisioned() *int32 { - if o == nil { - return nil - } - - return o.NlbProvisioned - -} - -// GetNlbProvisionedOk returns a tuple with the NlbProvisioned field value -// 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 *ResourceLimits) GetNlbProvisionedOk() (*int32, bool) { - if o == nil { - return nil, false - } - - return o.NlbProvisioned, true -} - -// SetNlbProvisioned sets field value -func (o *ResourceLimits) SetNlbProvisioned(v int32) { - - o.NlbProvisioned = &v - -} - -// HasNlbProvisioned returns a boolean if a field has been set. -func (o *ResourceLimits) HasNlbProvisioned() bool { - if o != nil && o.NlbProvisioned != nil { - return true - } - - return false -} - -// GetNatGatewayLimitTotal returns the NatGatewayLimitTotal field value -// If the value is explicit nil, nil is returned -func (o *ResourceLimits) GetNatGatewayLimitTotal() *int32 { - if o == nil { - return nil - } - - return o.NatGatewayLimitTotal - -} - -// GetNatGatewayLimitTotalOk returns a tuple with the NatGatewayLimitTotal field value -// 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 *ResourceLimits) GetNatGatewayLimitTotalOk() (*int32, bool) { - if o == nil { - return nil, false - } - - return o.NatGatewayLimitTotal, true -} - -// SetNatGatewayLimitTotal sets field value -func (o *ResourceLimits) SetNatGatewayLimitTotal(v int32) { - - o.NatGatewayLimitTotal = &v - -} - -// HasNatGatewayLimitTotal returns a boolean if a field has been set. -func (o *ResourceLimits) HasNatGatewayLimitTotal() bool { - if o != nil && o.NatGatewayLimitTotal != nil { - return true - } - - return false -} - -// GetNatGatewayProvisioned returns the NatGatewayProvisioned field value -// If the value is explicit nil, nil is returned -func (o *ResourceLimits) GetNatGatewayProvisioned() *int32 { - if o == nil { - return nil - } - - return o.NatGatewayProvisioned - -} - -// GetNatGatewayProvisionedOk returns a tuple with the NatGatewayProvisioned field value -// 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 *ResourceLimits) GetNatGatewayProvisionedOk() (*int32, bool) { - if o == nil { - return nil, false - } - - return o.NatGatewayProvisioned, true -} - -// SetNatGatewayProvisioned sets field value -func (o *ResourceLimits) SetNatGatewayProvisioned(v int32) { - - o.NatGatewayProvisioned = &v - -} - -// HasNatGatewayProvisioned returns a boolean if a field has been set. -func (o *ResourceLimits) HasNatGatewayProvisioned() bool { - if o != nil && o.NatGatewayProvisioned != nil { - return true - } - - return false -} - -// GetSecurityGroupsPerVdc returns the SecurityGroupsPerVdc field value -// If the value is explicit nil, nil is returned -func (o *ResourceLimits) GetSecurityGroupsPerVdc() *int32 { - if o == nil { - return nil - } - - return o.SecurityGroupsPerVdc - -} - -// GetSecurityGroupsPerVdcOk returns a tuple with the SecurityGroupsPerVdc field value -// 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 *ResourceLimits) GetSecurityGroupsPerVdcOk() (*int32, bool) { - if o == nil { - return nil, false - } - - return o.SecurityGroupsPerVdc, true -} - -// SetSecurityGroupsPerVdc sets field value -func (o *ResourceLimits) SetSecurityGroupsPerVdc(v int32) { - - o.SecurityGroupsPerVdc = &v - -} - -// HasSecurityGroupsPerVdc returns a boolean if a field has been set. -func (o *ResourceLimits) HasSecurityGroupsPerVdc() bool { - if o != nil && o.SecurityGroupsPerVdc != nil { - return true - } - - return false -} - -// GetSecurityGroupsPerResource returns the SecurityGroupsPerResource field value -// If the value is explicit nil, nil is returned -func (o *ResourceLimits) GetSecurityGroupsPerResource() *int32 { - if o == nil { - return nil - } - - return o.SecurityGroupsPerResource - -} - -// GetSecurityGroupsPerResourceOk returns a tuple with the SecurityGroupsPerResource field value -// 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 *ResourceLimits) GetSecurityGroupsPerResourceOk() (*int32, bool) { - if o == nil { - return nil, false - } - - return o.SecurityGroupsPerResource, true -} - -// SetSecurityGroupsPerResource sets field value -func (o *ResourceLimits) SetSecurityGroupsPerResource(v int32) { - - o.SecurityGroupsPerResource = &v - -} - -// HasSecurityGroupsPerResource returns a boolean if a field has been set. -func (o *ResourceLimits) HasSecurityGroupsPerResource() bool { - if o != nil && o.SecurityGroupsPerResource != nil { - return true - } - - return false -} - -// GetRulesPerSecurityGroup returns the RulesPerSecurityGroup field value -// If the value is explicit nil, nil is returned -func (o *ResourceLimits) GetRulesPerSecurityGroup() *int32 { - if o == nil { - return nil - } - - return o.RulesPerSecurityGroup - -} - -// GetRulesPerSecurityGroupOk returns a tuple with the RulesPerSecurityGroup field value -// 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 *ResourceLimits) GetRulesPerSecurityGroupOk() (*int32, bool) { - if o == nil { - return nil, false - } - - return o.RulesPerSecurityGroup, true -} - -// SetRulesPerSecurityGroup sets field value -func (o *ResourceLimits) SetRulesPerSecurityGroup(v int32) { - - o.RulesPerSecurityGroup = &v - -} - -// HasRulesPerSecurityGroup returns a boolean if a field has been set. -func (o *ResourceLimits) HasRulesPerSecurityGroup() bool { - if o != nil && o.RulesPerSecurityGroup != nil { - return true - } - - return false -} - -func (o ResourceLimits) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.CoresPerServer != nil { - toSerialize["coresPerServer"] = o.CoresPerServer - } - - if o.CoresPerContract != nil { - toSerialize["coresPerContract"] = o.CoresPerContract - } - - if o.CoresProvisioned != nil { - toSerialize["coresProvisioned"] = o.CoresProvisioned - } - - if o.RamPerServer != nil { - toSerialize["ramPerServer"] = o.RamPerServer - } - - if o.RamPerContract != nil { - toSerialize["ramPerContract"] = o.RamPerContract - } - - if o.RamProvisioned != nil { - toSerialize["ramProvisioned"] = o.RamProvisioned - } - - if o.HddLimitPerVolume != nil { - toSerialize["hddLimitPerVolume"] = o.HddLimitPerVolume - } - - if o.HddLimitPerContract != nil { - toSerialize["hddLimitPerContract"] = o.HddLimitPerContract - } - - if o.HddVolumeProvisioned != nil { - toSerialize["hddVolumeProvisioned"] = o.HddVolumeProvisioned - } - - if o.SsdLimitPerVolume != nil { - toSerialize["ssdLimitPerVolume"] = o.SsdLimitPerVolume - } - - if o.SsdLimitPerContract != nil { - toSerialize["ssdLimitPerContract"] = o.SsdLimitPerContract - } - - if o.SsdVolumeProvisioned != nil { - toSerialize["ssdVolumeProvisioned"] = o.SsdVolumeProvisioned - } - - if o.DasVolumeProvisioned != nil { - toSerialize["dasVolumeProvisioned"] = o.DasVolumeProvisioned - } - - if o.ReservableIps != nil { - toSerialize["reservableIps"] = o.ReservableIps - } - - if o.ReservedIpsOnContract != nil { - toSerialize["reservedIpsOnContract"] = o.ReservedIpsOnContract - } - - if o.ReservedIpsInUse != nil { - toSerialize["reservedIpsInUse"] = o.ReservedIpsInUse - } - - if o.K8sClusterLimitTotal != nil { - toSerialize["k8sClusterLimitTotal"] = o.K8sClusterLimitTotal - } - - if o.K8sClustersProvisioned != nil { - toSerialize["k8sClustersProvisioned"] = o.K8sClustersProvisioned - } - - if o.NlbLimitTotal != nil { - toSerialize["nlbLimitTotal"] = o.NlbLimitTotal - } - - if o.NlbProvisioned != nil { - toSerialize["nlbProvisioned"] = o.NlbProvisioned - } - - if o.NatGatewayLimitTotal != nil { - toSerialize["natGatewayLimitTotal"] = o.NatGatewayLimitTotal - } - - if o.NatGatewayProvisioned != nil { - toSerialize["natGatewayProvisioned"] = o.NatGatewayProvisioned - } - - if o.SecurityGroupsPerVdc != nil { - toSerialize["securityGroupsPerVdc"] = o.SecurityGroupsPerVdc - } - - if o.SecurityGroupsPerResource != nil { - toSerialize["securityGroupsPerResource"] = o.SecurityGroupsPerResource - } - - if o.RulesPerSecurityGroup != nil { - toSerialize["rulesPerSecurityGroup"] = o.RulesPerSecurityGroup - } - - return json.Marshal(toSerialize) -} - -type NullableResourceLimits struct { - value *ResourceLimits - isSet bool -} - -func (v NullableResourceLimits) Get() *ResourceLimits { - return v.value -} - -func (v *NullableResourceLimits) Set(val *ResourceLimits) { - v.value = val - v.isSet = true -} - -func (v NullableResourceLimits) IsSet() bool { - return v.isSet -} - -func (v *NullableResourceLimits) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableResourceLimits(val *ResourceLimits) *NullableResourceLimits { - return &NullableResourceLimits{value: val, isSet: true} -} - -func (v NullableResourceLimits) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableResourceLimits) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/response.go b/vendor/github.com/ionos-cloud/sdk-go/v6/response.go deleted file mode 100644 index 0d6a2c908..000000000 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/response.go +++ /dev/null @@ -1,73 +0,0 @@ -/* - * CLOUD API - * - * IONOS Enterprise-grade Infrastructure as a Service (IaaS) solutions can be managed through the Cloud API, in addition or as an alternative to the \"Data Center Designer\" (DCD) browser-based tool. Both methods employ consistent concepts and features, deliver similar power and flexibility, and can be used to perform a multitude of management tasks, including adding servers, volumes, configuring networks, and so on. - * - * API version: 6.0 - */ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package ionoscloud - -import ( - "log" - "net/http" - "time" -) - -// 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"` - // RequestTime is the time duration from the moment the APIClient sends - // the HTTP request to the moment it receives an HTTP response. - RequestTime time.Duration `json:"duration,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 APIResonse 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 -} - -// HttpNotFound - returns true if a 404 status code was returned -// returns false for nil APIResponse values -func (resp *APIResponse) HttpNotFound() bool { - if resp != nil && resp.Response != nil && resp.StatusCode == http.StatusNotFound { - return true - } - return false -} - -// LogInfo - logs APIResponse values like RequestTime, Operation and StatusCode -// does not print anything for nil APIResponse values -func (resp *APIResponse) LogInfo() { - if resp != nil { - log.Printf("[DEBUG] Request time : %s for operation : %s", - resp.RequestTime, resp.Operation) - if resp.Response != nil { - log.Printf("[DEBUG] response status code : %d\n", resp.StatusCode) - } - } -} diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/sonar-project.properties b/vendor/github.com/ionos-cloud/sdk-go/v6/sonar-project.properties deleted file mode 100644 index b22459d68..000000000 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/sonar-project.properties +++ /dev/null @@ -1,12 +0,0 @@ -sonar.projectKey=ionos-cloud_sdk-go -sonar.organization=ionos-cloud - -# This is the name and version displayed in the SonarCloud UI. -#sonar.projectName=sdk-go -#sonar.projectVersion=1.0 - -# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows. -#sonar.sources=. - -# Encoding of the source code. Default is default system encoding -#sonar.sourceEncoding=UTF-8 diff --git a/vendor/github.com/ionos-cloud/sdk-go/v6/utils.go b/vendor/github.com/ionos-cloud/sdk-go/v6/utils.go deleted file mode 100644 index 28c5e0831..000000000 --- a/vendor/github.com/ionos-cloud/sdk-go/v6/utils.go +++ /dev/null @@ -1,790 +0,0 @@ -/* - * CLOUD API - * - * IONOS Enterprise-grade Infrastructure as a Service (IaaS) solutions can be managed through the Cloud API, in addition or as an alternative to the \"Data Center Designer\" (DCD) browser-based tool. Both methods employ consistent concepts and features, deliver similar power and flexibility, and can be used to perform a multitude of management tasks, including adding servers, volumes, configuring networks, and so on. - * - * API version: 6.0 - */ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package ionoscloud - -import ( - "encoding/json" - "reflect" - "strings" - "time" -) - -var ( - // used to set a nullable field to nil. This is a sentinel address that will be checked in the MarshalJson function. - // if set to this address, a nil value will be marshalled - Nilstring string = "<>" - Nilint32 int32 = -334455 - Nilbool bool = false -) - -// ToPtr - returns a pointer to the given value. -func ToPtr[T any](v T) *T { - return &v -} - -// ToValue - returns the value of the pointer passed in -func ToValue[T any](ptr *T) T { - return *ptr -} - -// ToValueDefault - returns the value of the pointer passed in, or the default type value if the pointer is nil -func ToValueDefault[T any](ptr *T) T { - var defaultVal T - if ptr == nil { - return defaultVal - } - return *ptr -} - -func SliceToValueDefault[T any](ptrSlice *[]T) []T { - return append([]T{}, *ptrSlice...) -} - -// PtrBool - returns a pointer to given boolean value. -func PtrBool(v bool) *bool { return &v } - -// PtrInt - returns a pointer to given integer value. -func PtrInt(v int) *int { return &v } - -// PtrInt32 - returns a pointer to given integer value. -func PtrInt32(v int32) *int32 { return &v } - -// PtrInt64 - returns a pointer to given integer value. -func PtrInt64(v int64) *int64 { return &v } - -// PtrFloat32 - returns a pointer to given float value. -func PtrFloat32(v float32) *float32 { return &v } - -// PtrFloat64 - returns a pointer to given float value. -func PtrFloat64(v float64) *float64 { return &v } - -// PtrString - returns a pointer to given string value. -func PtrString(v string) *string { return &v } - -// PtrTime - returns a pointer to given Time value. -func PtrTime(v time.Time) *time.Time { return &v } - -// ToBool - returns the value of the bool pointer passed in -func ToBool(ptr *bool) bool { - return *ptr -} - -// ToBoolDefault - returns the value of the bool pointer passed in, or false if the pointer is nil -func ToBoolDefault(ptr *bool) bool { - var defaultVal bool - if ptr == nil { - return defaultVal - } - return *ptr -} - -// ToBoolSlice - returns a bool slice of the pointer passed in -func ToBoolSlice(ptrSlice *[]bool) []bool { - valSlice := make([]bool, len(*ptrSlice)) - for i, v := range *ptrSlice { - valSlice[i] = v - } - - return valSlice -} - -// ToByte - returns the value of the byte pointer passed in -func ToByte(ptr *byte) byte { - return *ptr -} - -// ToByteDefault - returns the value of the byte pointer passed in, or 0 if the pointer is nil -func ToByteDefault(ptr *byte) byte { - var defaultVal byte - if ptr == nil { - return defaultVal - } - - return *ptr -} - -// ToByteSlice - returns a byte slice of the pointer passed in -func ToByteSlice(ptrSlice *[]byte) []byte { - valSlice := make([]byte, len(*ptrSlice)) - for i, v := range *ptrSlice { - valSlice[i] = v - } - - return valSlice -} - -// ToString - returns the value of the string pointer passed in -func ToString(ptr *string) string { - return *ptr -} - -// ToStringDefault - returns the value of the string pointer passed in, or "" if the pointer is nil -func ToStringDefault(ptr *string) string { - var defaultVal string - if ptr == nil { - return defaultVal - } - - return *ptr -} - -// ToStringSlice - returns a string slice of the pointer passed in -func ToStringSlice(ptrSlice *[]string) []string { - valSlice := make([]string, len(*ptrSlice)) - for i, v := range *ptrSlice { - valSlice[i] = v - } - - return valSlice -} - -// ToInt - returns the value of the int pointer passed in -func ToInt(ptr *int) int { - return *ptr -} - -// ToIntDefault - returns the value of the int pointer passed in, or 0 if the pointer is nil -func ToIntDefault(ptr *int) int { - var defaultVal int - if ptr == nil { - return defaultVal - } - return *ptr -} - -// ToIntSlice - returns a int slice of the pointer passed in -func ToIntSlice(ptrSlice *[]int) []int { - valSlice := make([]int, len(*ptrSlice)) - for i, v := range *ptrSlice { - valSlice[i] = v - } - - return valSlice -} - -// ToInt8 - returns the value of the int8 pointer passed in -func ToInt8(ptr *int8) int8 { - return *ptr -} - -// ToInt8Default - returns the value of the int8 pointer passed in, or 0 if the pointer is nil -func ToInt8Default(ptr *int8) int8 { - var defaultVal int8 - if ptr == nil { - return defaultVal - } - return *ptr -} - -// ToInt8Slice - returns a int8 slice of the pointer passed in -func ToInt8Slice(ptrSlice *[]int8) []int8 { - valSlice := make([]int8, len(*ptrSlice)) - for i, v := range *ptrSlice { - valSlice[i] = v - } - - return valSlice -} - -// ToInt16 - returns the value of the int16 pointer passed in -func ToInt16(ptr *int16) int16 { - return *ptr -} - -// ToInt16Default - returns the value of the int16 pointer passed in, or 0 if the pointer is nil -func ToInt16Default(ptr *int16) int16 { - var defaultVal int16 - if ptr == nil { - return defaultVal - } - return *ptr -} - -// ToInt16Slice - returns a int16 slice of the pointer passed in -func ToInt16Slice(ptrSlice *[]int16) []int16 { - valSlice := make([]int16, len(*ptrSlice)) - for i, v := range *ptrSlice { - valSlice[i] = v - } - - return valSlice -} - -// ToInt32 - returns the value of the int32 pointer passed in -func ToInt32(ptr *int32) int32 { - return *ptr -} - -// ToInt32Default - returns the value of the int32 pointer passed in, or 0 if the pointer is nil -func ToInt32Default(ptr *int32) int32 { - var defaultVal int32 - if ptr == nil { - return defaultVal - } - return *ptr -} - -// ToInt32Slice - returns a int32 slice of the pointer passed in -func ToInt32Slice(ptrSlice *[]int32) []int32 { - valSlice := make([]int32, len(*ptrSlice)) - for i, v := range *ptrSlice { - valSlice[i] = v - } - - return valSlice -} - -// ToInt64 - returns the value of the int64 pointer passed in -func ToInt64(ptr *int64) int64 { - return *ptr -} - -// ToInt64Default - returns the value of the int64 pointer passed in, or 0 if the pointer is nil -func ToInt64Default(ptr *int64) int64 { - var defaultVal int64 - if ptr == nil { - return defaultVal - } - return *ptr -} - -// ToInt64Slice - returns a int64 slice of the pointer passed in -func ToInt64Slice(ptrSlice *[]int64) []int64 { - valSlice := make([]int64, len(*ptrSlice)) - for i, v := range *ptrSlice { - valSlice[i] = v - } - - return valSlice -} - -// ToUint - returns the value of the uint pointer passed in -func ToUint(ptr *uint) uint { - return *ptr -} - -// ToUintDefault - returns the value of the uint pointer passed in, or 0 if the pointer is nil -func ToUintDefault(ptr *uint) uint { - var defaultVal uint - if ptr == nil { - return defaultVal - } - return *ptr -} - -// ToUintSlice - returns a uint slice of the pointer passed in -func ToUintSlice(ptrSlice *[]uint) []uint { - valSlice := make([]uint, len(*ptrSlice)) - for i, v := range *ptrSlice { - valSlice[i] = v - } - - return valSlice -} - -// ToUint8 -returns the value of the uint8 pointer passed in -func ToUint8(ptr *uint8) uint8 { - return *ptr -} - -// ToUint8Default - returns the value of the uint8 pointer passed in, or 0 if the pointer is nil -func ToUint8Default(ptr *uint8) uint8 { - var defaultVal uint8 - if ptr == nil { - return defaultVal - } - return *ptr -} - -// ToUint8Slice - returns a uint8 slice of the pointer passed in -func ToUint8Slice(ptrSlice *[]uint8) []uint8 { - valSlice := make([]uint8, len(*ptrSlice)) - for i, v := range *ptrSlice { - valSlice[i] = v - } - - return valSlice -} - -// ToUint16 - returns the value of the uint16 pointer passed in -func ToUint16(ptr *uint16) uint16 { - return *ptr -} - -// ToUint16Default - returns the value of the uint16 pointer passed in, or 0 if the pointer is nil -func ToUint16Default(ptr *uint16) uint16 { - var defaultVal uint16 - if ptr == nil { - return defaultVal - } - return *ptr -} - -// ToUint16Slice - returns a uint16 slice of the pointer passed in -func ToUint16Slice(ptrSlice *[]uint16) []uint16 { - valSlice := make([]uint16, len(*ptrSlice)) - for i, v := range *ptrSlice { - valSlice[i] = v - } - - return valSlice -} - -// ToUint32 - returns the value of the uint32 pointer passed in -func ToUint32(ptr *uint32) uint32 { - return *ptr -} - -// ToUint32Default - returns the value of the uint32 pointer passed in, or 0 if the pointer is nil -func ToUint32Default(ptr *uint32) uint32 { - var defaultVal uint32 - if ptr == nil { - return defaultVal - } - return *ptr -} - -// ToUint32Slice - returns a uint32 slice of the pointer passed in -func ToUint32Slice(ptrSlice *[]uint32) []uint32 { - valSlice := make([]uint32, len(*ptrSlice)) - for i, v := range *ptrSlice { - valSlice[i] = v - } - - return valSlice -} - -// ToUint64 - returns the value of the uint64 pointer passed in -func ToUint64(ptr *uint64) uint64 { - return *ptr -} - -// ToUint64Default - returns the value of the uint64 pointer passed in, or 0 if the pointer is nil -func ToUint64Default(ptr *uint64) uint64 { - var defaultVal uint64 - if ptr == nil { - return defaultVal - } - return *ptr -} - -// ToUint64Slice - returns a uint63 slice of the pointer passed in -func ToUint64Slice(ptrSlice *[]uint64) []uint64 { - valSlice := make([]uint64, len(*ptrSlice)) - for i, v := range *ptrSlice { - valSlice[i] = v - } - - return valSlice -} - -// ToFloat32 - returns the value of the float32 pointer passed in -func ToFloat32(ptr *float32) float32 { - return *ptr -} - -// ToFloat32Default - returns the value of the float32 pointer passed in, or 0 if the pointer is nil -func ToFloat32Default(ptr *float32) float32 { - var defaultVal float32 - if ptr == nil { - return defaultVal - } - return *ptr -} - -// ToFloat32Slice - returns a float32 slice of the pointer passed in -func ToFloat32Slice(ptrSlice *[]float32) []float32 { - valSlice := make([]float32, len(*ptrSlice)) - for i, v := range *ptrSlice { - valSlice[i] = v - } - - return valSlice -} - -// ToFloat64 - returns the value of the float64 pointer passed in -func ToFloat64(ptr *float64) float64 { - return *ptr -} - -// ToFloat64Default - returns the value of the float64 pointer passed in, or 0 if the pointer is nil -func ToFloat64Default(ptr *float64) float64 { - var defaultVal float64 - if ptr == nil { - return defaultVal - } - return *ptr -} - -// ToFloat64Slice - returns a float64 slice of the pointer passed in -func ToFloat64Slice(ptrSlice *[]float64) []float64 { - valSlice := make([]float64, len(*ptrSlice)) - for i, v := range *ptrSlice { - valSlice[i] = v - } - - return valSlice -} - -// ToTime - returns the value of the Time pointer passed in -func ToTime(ptr *time.Time) time.Time { - return *ptr -} - -// ToTimeDefault - returns the value of the Time pointer passed in, or 0001-01-01 00:00:00 +0000 UTC if the pointer is nil -func ToTimeDefault(ptr *time.Time) time.Time { - var defaultVal time.Time - if ptr == nil { - return defaultVal - } - return *ptr -} - -// ToTimeSlice - returns a Time slice of the pointer passed in -func ToTimeSlice(ptrSlice *[]time.Time) []time.Time { - valSlice := make([]time.Time, len(*ptrSlice)) - for i, v := range *ptrSlice { - valSlice[i] = v - } - - return valSlice -} - -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 v.value.MarshalJSON() -} - -func (v *NullableTime) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} - -type IonosTime struct { - time.Time -} - -func (t *IonosTime) UnmarshalJSON(data []byte) error { - str := string(data) - if strlen(str) == 0 { - t = nil - return nil - } - if str[0] == '"' { - str = str[1:] - } - if str[len(str)-1] == '"' { - str = str[:len(str)-1] - } - if !strings.Contains(str, "Z") { - /* forcefully adding timezone suffix to be able to parse the - * string using RFC3339 */ - str += "Z" - } - tt, err := time.Parse(time.RFC3339, str) - if err != nil { - return err - } - *t = IonosTime{tt} - return nil -} - -// 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 -} diff --git a/vendor/modules.txt b/vendor/modules.txt index 915e25671..dffa37d07 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -317,6 +317,9 @@ github.com/ionos-cloud/sdk-go-api-gateway # github.com/ionos-cloud/sdk-go-bundle/products/cdn/v2 v2.1.0 ## explicit; go 1.22 github.com/ionos-cloud/sdk-go-bundle/products/cdn/v2 +# github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2 v2.0.0-00010101000000-000000000000 => ./../sdks/generated_locally/cloud-bundle +## explicit; go 1.21 +github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2 # github.com/ionos-cloud/sdk-go-bundle/products/logging/v2 v2.1.1 ## explicit; go 1.21 github.com/ionos-cloud/sdk-go-bundle/products/logging/v2 @@ -368,9 +371,6 @@ github.com/ionos-cloud/sdk-go-object-storage-management # github.com/ionos-cloud/sdk-go-vm-autoscaling v1.0.1 ## explicit; go 1.18 github.com/ionos-cloud/sdk-go-vm-autoscaling -# github.com/ionos-cloud/sdk-go/v6 v6.3.2 -## explicit; go 1.21 -github.com/ionos-cloud/sdk-go/v6 # github.com/jmespath/go-jmespath v0.4.0 ## explicit; go 1.14 github.com/jmespath/go-jmespath @@ -618,3 +618,4 @@ google.golang.org/protobuf/types/known/timestamppb # gopkg.in/yaml.v3 v3.0.1 ## explicit gopkg.in/yaml.v3 +# github.com/ionos-cloud/sdk-go-bundle/products/cloud/v2 => ./../sdks/generated_locally/cloud-bundle